Page 2 sur 3

Re: Problème script LUA chauffage

Publié : 28 déc. 2018, 22:30
par fenx2002
voici le code
ps j'ai modifié mon rad Chloé en rad Chloe si c'était l'accent qui genait mais a priori c'est pas ça...

le problème se situe sur la ligne 20
commandArray['rad Chloe’]='Set Level 25'
commandArray['rad CH1’]='Set Level 25'

en fait j'ai le pb à priori sur toutes les lignes ou il y a rad Chloe et rad CH1...

Code : Tout sélectionner

function IsWeekend()
     local dayNow = tonumber(os.date("%w"))
     local weekend
     if (dayNow == 0) or (dayNow == 6) then weekend = true
     else weekend = false
     end 
     return weekend
end

commandArray = {}

	-- get current time
	minutesnow = timenow.min + timenow.hour * 60


	-- PROG radIATEURS VACANCES
	if(IsWeekend() == false and uservariables["HOLIDAYS"] == "true") then
		commandArray['Salon jardin']='Set Level 25'
		commandArray['rad salon rue']='Set Level 25'
		commandArray['rad Chloe’]='Set Level 25'
		commandArray['rad CH1’]='Set Level 25'
		commandArray['rad Tristan']='Set Level 25'
	End

	-- PROG radIATEURS WEEK END
	if(IsWeekend() == true and uservariables["HOLIDAYS"] == "false" and timenow.hour == 06 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 55'
		commandArray['rad salon rue']='Set Level 55'
		commandArray['rad Chloe’]='Set Level 55'
		commandArray['rad CH1’]='Set Level 55'
		commandArray['rad Tristan']='Set Level 55'
	End

	if(IsWeekend() == true and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 10 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 35'
		commandArray['rad salon rue']='Set Level 35'
		commandArray['rad Chloe’]='Set Level 35'
		commandArray['rad CH1’]='Set Level 25'
		commandArray['rad Tristan']='Set Level 35'
	End

	if(IsWeekend() == true and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 12 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 55'
		commandArray['rad salon rue']='Set Level 55'
		commandArray['rad Chloe’]='Set Level 55'
		commandArray['rad CH1’]='Set Level 25'
		commandArray['rad Tristan']='Set Level 35'
	End

	if(IsWeekend() == true and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 14 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 35'
		commandArray['rad salon rue']='Set Level 35'
		commandArray['rad Chloe’]='Set Level 25'
		commandArray['rad CH1’]='Set Level 25'
		commandArray['rad Tristan']='Set Level 35'
	End

	if(IsWeekend() == true and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 17 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 55'
		commandArray['rad salon rue']='Set Level 55'
		commandArray['rad Chloe’]='Set Level 25'
		commandArray['rad CH1’]='Set Level 25'
		commandArray['rad Tristan']='Set Level 35'
	End

	if(IsWeekend() == true and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 19 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 55'
		commandArray['rad salon rue']='Set Level 55'
		commandArray['rad Chloe’]='Set Level 55'
		commandArray['rad CH1’]='Set Level 55'
		commandArray['rad Tristan']='Set Level 55'
	End

	if(IsWeekend() == true and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 22 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 25'
		commandArray['rad salon rue']='Set Level 25'
		commandArray['rad Chloe’]='Set Level 25'
		commandArray['rad CH1’]='Set Level 25'
		commandArray['rad Tristan']='Set Level 25'
	End

	if(IsWeekend() == true and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 02 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 25'
		commandArray['rad salon rue']='Set Level 25'
		commandArray['rad Chloe’]='Set Level 55'
		commandArray['rad CH1’]='Set Level 55'
		commandArray['rad Tristan']='Set Level 55'
	End

	if(IsWeekend() == true and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 04 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 25'
		commandArray['rad salon rue']='Set Level 25'
		commandArray['rad Chloe’]='Set Level 25'
		commandArray['rad CH1’]='Set Level 25'
		commandArray['rad Tristan']='Set Level 25'
	End

	-- PROG radIATEURS SEMAINE

	if(IsWeekend() == false and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 05 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 55'
		commandArray['rad salon rue']='Set Level 55'
		commandArray['rad Chloe’]='Set Level 55'
		commandArray['rad CH1’]='Set Level 55'
		commandArray['rad Tristan']='Set Level 55'	
	End

	if(IsWeekend() == false and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 06 and timenow.min == 30) then

		commandArray['rad CH1’]='Set Level 25'
	End


	if(IsWeekend() == false and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 07 and timenow.min == 15) then
		commandArray['Salon jardin']='Set Level 25'
		commandArray['rad salon rue']='Set Level 25'
		commandArray['rad Chloe’]='Set Level 25'
		commandArray['rad Tristan']='Set Level 25'
	End

	if(IsWeekend() == false and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 17 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 55'
		commandArray['rad salon rue']='Set Level 55'
		commandArray['rad Chloe’]='Set Level 55'
		commandArray['rad CH1’]='Set Level 55'
		commandArray['rad Tristan']='Set Level 55'
	End

	if(IsWeekend() == false and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 21 and timenow.min == 30) then
		commandArray['rad Chloe’]='Set Level 25'
		commandArray['rad Tristan']='Set Level 25'
	End

	if(IsWeekend() == false and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 22 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 25'
		commandArray['rad salon rue']='Set Level 25'
	End

	if(IsWeekend() == false and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 23 and timenow.min == 00) then
		commandArray['rad CH1’]='Set Level 25'
	End

	if(IsWeekend() == false and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 02 and timenow.min == 30) then
		commandArray['rad Chloe’]='Set Level 55'
		commandArray['rad CH1’]='Set Level 55'
		commandArray['rad Tristan']='Set Level 55'
	End

	iif(IsWeekend() == false and (uservariables["HOLIDAYS"] == "false" and timenow.hour == 04 and timenow.min == 00) then
		commandArray['rad Chloe’]='Set Level 25'
		commandArray['rad CH1’]='Set Level 25'
		commandArray['rad Tristan']='Set Level 25'

	End

	
	return commandArray

Re: Problème script LUA chauffage

Publié : 28 déc. 2018, 22:46
par lmet
Et donc tu as vérifié la syntaxe utilisée dans les devices "rad Chloe" avec un "C" et "rad CH1" avec "CH" je dis cela parce que l'erreur est courante
Le caractère de fin après rad Cloe apparait encore comme étant différent comme le signale chrominator
Encore un petit effort et c'est bon tu vas pouvoir partir en vacances tranquille ;)
On le voit ici :

Code : Tout sélectionner

commandArray['rad Chloe’]='Set Level 25'
commandArray['rad CH1’]='Set Level 25'

Re: Problème script LUA chauffage

Publié : 28 déc. 2018, 22:54
par Neutrino
Bonjour,
Tu as plein de au lieu de '
Change tout par des doubles quotes " histoire de faire le ménage.

Re: Problème script LUA chauffage

Publié : 28 déc. 2018, 22:57
par fenx2002
yes j'ai meme modifier pour enlever les majuscules et les accents

j'ai viré les 2 lignes rad chloe et rad CH1 maintenant il me sort une erreur sur la ligne 24 a savoir
2018-12-28 22:55:00.286 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_test.lua: /home/pi/domoticz/scripts/lua/script_time_test.lua:24: syntax error near 'if'

C'est comme si il n'aimait pas le End

Code : Tout sélectionner

	-- PROG radIATEURS VACANCES
	if(IsWeekend() == false and uservariables["HOLIDAYS"] == "true") then
		commandArray['Salon jardin']='Set Level 25'
		commandArray['rad salon rue']='Set Level 25'
		commandArray['rad Tristan']='Set Level 25'
	End

	-- PROG radIATEURS WEEK END
	if(IsWeekend() == true and uservariables["HOLIDAYS"] == "false" and timenow.hour == 06 and timenow.min == 30) then

Re: Problème script LUA chauffage

Publié : 28 déc. 2018, 23:03
par fenx2002
Neutrino a écrit : 28 déc. 2018, 22:54 Bonjour,
Tu as plein de au lieu de '
Change tout par des doubles quotes " histoire de faire le ménage.
ok j'en avais encore je pensais les avoir tous virer...

Maintenant problème ligne 24 juste avant le If ....

ok j'ai compris il n'aime pas le End par contre si je mets ELSE a la place c'est ok mais comme je mets des heures je ne veux pas qu'il fasse else mais plutôt qu'il enchaine ... il y a une commande particulière du coup?

Re: Problème script LUA chauffage

Publié : 28 déc. 2018, 23:13
par fenx2002
Ca avance !!
j'ai viré tous les end du coup et ça marche
par contre j' en ai mis un en bas a la fin mais il a pas l'air d'aimer

2018-12-28 23:11:00.421 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_all.lua: /home/pi/domoticz/scripts/lua/script_time_all.lua:157: 'end' expected (to close 'if' at line 143) near <eof>

Code : Tout sélectionner

function IsWeekend()
     local dayNow = tonumber(os.date("%w"))
     local weekend
     if (dayNow == 0) or (dayNow == 6) then weekend = true
     else weekend = false
     end 
     return weekend
end

commandArray = {}

	-- get current time
	minutesnow = timenow.min + timenow.hour * 60


	-- PROG radIATEURS VACANCES
	if(IsWeekend() == false and uservariables["HOLIDAYS"] == "true") then
		commandArray['Salon jardin']='Set Level 25'
		commandArray['rad salon rue']='Set Level 25'
		commandArray['rad chloe']='Set Level 25'
		commandArray['rad ch1']='Set Level 25'
		commandArray['rad Tristan']='Set Level 25'


	-- PROG radIATEURS WEEK END
	if(IsWeekend() == true and uservariables["HOLIDAYS"] == "false" and timenow.hour == 06 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 55'
		commandArray['rad salon rue']='Set Level 55'
		commandArray['rad chloe']='Set Level 55'
		commandArray['rad ch1']='Set Level 55'
		commandArray['rad Tristan']='Set Level 55'
	

	if(IsWeekend() == true and uservariables["HOLIDAYS"] == "false" and timenow.hour == 10 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 35'
		commandArray['rad salon rue']='Set Level 35'
		commandArray['rad chloe']='Set Level 35'
		commandArray['rad ch1']='Set Level 25'
		commandArray['rad Tristan']='Set Level 35'
	

	if(IsWeekend() == true and uservariables["HOLIDAYS"] == "false" and timenow.hour == 12 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 55'
		commandArray['rad salon rue']='Set Level 55'
		commandArray['rad chloe']='Set Level 55'
		commandArray['rad ch1']='Set Level 25'
		commandArray['rad Tristan']='Set Level 35'
	

	if(IsWeekend() == true and uservariables["HOLIDAYS"] == "false" and timenow.hour == 14 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 35'
		commandArray['rad salon rue']='Set Level 35'
		commandArray['rad chloe']='Set Level 25'
		commandArray['rad ch1']='Set Level 25'
		commandArray['rad Tristan']='Set Level 35'
	

	if(IsWeekend() == true and uservariables["HOLIDAYS"] == "false" and timenow.hour == 17 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 55'
		commandArray['rad salon rue']='Set Level 55'
		commandArray['rad chloe']='Set Level 25'
		commandArray['rad ch1']='Set Level 25'
		commandArray['rad Tristan']='Set Level 35'
	

	if(IsWeekend() == true and uservariables["HOLIDAYS"] == "false" and timenow.hour == 19 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 55'
		commandArray['rad salon rue']='Set Level 55'
		commandArray['rad chloe']='Set Level 55'
		commandArray['rad ch1']='Set Level 55'
		commandArray['rad Tristan']='Set Level 55'
	

	if(IsWeekend() == true and uservariables["HOLIDAYS"] == "false" and timenow.hour == 22 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 25'
		commandArray['rad salon rue']='Set Level 25'
		commandArray['rad chloe']='Set Level 25'
		commandArray['rad ch1']='Set Level 25'
		commandArray['rad Tristan']='Set Level 25'
	

	if(IsWeekend() == true and uservariables["HOLIDAYS"] == "false" and timenow.hour == 02 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 25'
		commandArray['rad salon rue']='Set Level 25'
		commandArray['rad chloe']='Set Level 55'
		commandArray['rad ch1']='Set Level 55'
		commandArray['rad Tristan']='Set Level 55'
	

	if(IsWeekend() == true and uservariables["HOLIDAYS"] == "false" and timenow.hour == 04 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 25'
		commandArray['rad salon rue']='Set Level 25'
		commandArray['rad chloe']='Set Level 25'
		commandArray['rad ch1']='Set Level 25'
		commandArray['rad Tristan']='Set Level 25'
	

	-- PROG radIATEURS SEMAINE

	if(IsWeekend() == false and uservariables["HOLIDAYS"] == "false" and timenow.hour == 05 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 55'
		commandArray['rad salon rue']='Set Level 55'
		commandArray['rad chloe']='Set Level 55'
		commandArray['rad ch1']='Set Level 55'
		commandArray['rad Tristan']='Set Level 55'	
	

	if(IsWeekend() == false and uservariables["HOLIDAYS"] == "false" and timenow.hour == 06 and timenow.min == 30) then

		commandArray['rad ch1']='Set Level 25'
	


	if(IsWeekend() == false and uservariables["HOLIDAYS"] == "false" and timenow.hour == 07 and timenow.min == 15) then
		commandArray['Salon jardin']='Set Level 25'
		commandArray['rad salon rue']='Set Level 25'
		commandArray['rad chloe']='Set Level 25'
		commandArray['rad Tristan']='Set Level 25'
	

	if(IsWeekend() == false and uservariables["HOLIDAYS"] == "false" and timenow.hour == 17 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 55'
		commandArray['rad salon rue']='Set Level 55'
		commandArray['rad chloe']='Set Level 55'
		commandArray['rad ch1']='Set Level 55'
		commandArray['rad Tristan']='Set Level 55'
	

	if(IsWeekend() == false and uservariables["HOLIDAYS"] == "false" and timenow.hour == 21 and timenow.min == 30) then
		commandArray['rad chloe']='Set Level 25'
		commandArray['rad Tristan']='Set Level 25'
	

	if(IsWeekend() == false and uservariables["HOLIDAYS"] == "false" and timenow.hour == 22 and timenow.min == 30) then
		commandArray['Salon jardin']='Set Level 25'
		commandArray['rad salon rue']='Set Level 25'
	

	if(IsWeekend() == false and uservariables["HOLIDAYS"] == "false" and timenow.hour == 23 and timenow.min == 00) then
		commandArray['rad ch1']='Set Level 25'
	

	if(IsWeekend() == false and uservariables["HOLIDAYS"] == "false" and timenow.hour == 02 and timenow.min == 30) then
		commandArray['rad chloe']='Set Level 55'
		commandArray['rad ch1']='Set Level 55'
		commandArray['rad Tristan']='Set Level 55'
	

	if(IsWeekend() == false and uservariables["HOLIDAYS"] == "false" and timenow.hour == 04 and timenow.min == 00) then
		commandArray['rad chloe']='Set Level 25'
		commandArray['rad ch1']='Set Level 25'
		commandArray['rad Tristan']='Set Level 25'

	
	return commandArray
end

Re: Problème script LUA chauffage

Publié : 28 déc. 2018, 23:15
par lmet
les "end" s'écrivent en minuscule ! et surtout pas après le return commandArray
Désolé, tu peux les remettre

Re: Problème script LUA chauffage

Publié : 28 déc. 2018, 23:17
par fenx2002
lmet a écrit : 28 déc. 2018, 23:15 les end s'écrivent en minuscule !
c'est ce que j'ai mis pourtant en dernière ligne

Re: Problème script LUA chauffage

Publié : 28 déc. 2018, 23:18
par lmet
les "end" s'écrivent en minuscule ! et surtout pas après le return commandArray
Désolé, tu peux les remettre

Re: Problème script LUA chauffage

Publié : 28 déc. 2018, 23:23
par fenx2002
j'ai mis un end avant le return commandarray
mais il me demande encore un 'end'...