Problème script LUA chauffage

Forum dédié aux problématiques concernant les scripts pour DomoticZ.
Entourez votre code et les logs avec les balises nommées code grâce au bouton <\>.
lmet
Messages : 252
Inscription : 30 juin 2017, 18:16
Localisation : Val d'Oise
Contact :

Re: Problème script LUA chauffage

Message par lmet »

En gros :

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
	

	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'
	end

	
return commandArray
Domoticz : V4.10717
Zigate : V4.11230 plugin:4.5.4 firmware:031a
Mon petit blog domotique
fenx2002
Messages : 30
Inscription : 04 avr. 2017, 11:41

Re: Problème script LUA chauffage

Message par fenx2002 »

re

bon j'ai remis des end partout et effectivement ca passe mieux

mais j'ai un nouveau problème

2018-12-28 23:30:00.134 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_all.lua: /home/pi/domoticz/scripts/lua/script_time_all.lua:13: attempt to index global 'timenow' (a nil value)

la ligne 13 est la suivante : minutesnow = timenow.min + timenow.hour * 60
lmet
Messages : 252
Inscription : 30 juin 2017, 18:16
Localisation : Val d'Oise
Contact :

Re: Problème script LUA chauffage

Message par lmet »

Avant la ligne 13 il manque peut-être :

Code : Tout sélectionner

timenow = os.date("*t")
Domoticz : V4.10717
Zigate : V4.11230 plugin:4.5.4 firmware:031a
Mon petit blog domotique
fenx2002
Messages : 30
Inscription : 04 avr. 2017, 11:41

Re: Problème script LUA chauffage

Message par fenx2002 »

halleluja!

pas de pb dans le log pour le moment

j'attends de voir si ça passe au niveau des commandes

Merci en tout cas à tous pour votre aide

Bonne fin de soirée
lmet
Messages : 252
Inscription : 30 juin 2017, 18:16
Localisation : Val d'Oise
Contact :

Re: Problème script LUA chauffage

Message par lmet »

Content pour toi
Par contre cela fait beaucoup de conditions il faudra optimiser ...
Bonnes vacances :D
Dernière modification par lmet le 29 déc. 2018, 00:01, modifié 1 fois.
Domoticz : V4.10717
Zigate : V4.11230 plugin:4.5.4 firmware:031a
Mon petit blog domotique
fenx2002
Messages : 30
Inscription : 04 avr. 2017, 11:41

Re: Problème script LUA chauffage

Message par fenx2002 »

yes mais avec des gamins dans les chambres je suis obligé de découper un peu mais après je me plongerais plus dedans
en tout cas merci pour tout
Répondre