Page 1 of 1

Sunblinds problem (commando send nothing happens) SOLVED

Posted: Monday 22 May 2017 16:52
by zicht
Dear,

i have made a script with a selector switch for my sunblinds. 8-)
The Idea is since i took closure and opening timing with a stopwatch, o make it possible with a selector switch to close the sunblind halfway, (half)
or just not fully close it. (kier)

Code: Select all

function Rolluik(commando)
print('rolluik  ' .."   status "..otherdevices["Rolluik"].."   command "..commando)


  
  if commando == "Dicht" then
    commandArray[#commandArray + 1] = {['Rolluik']='Close'}
	print("Dicht done")
  elseif commando == "Open" then
    commandArray[#commandArray + 1] = {['Rolluik']='Open'} 
	print("Open done")
  
  -- kier
  elseif commando == "Kier" and  otherdevices["Rolluik"] == "Stopped" then
    commandArray[#commandArray + 1] = {['Rolluik']='Open'} 
    commandArray[#commandArray + 2] = {['Rolluik']='Dicht AFTER 12'}
    commandArray[#commandArray + 3] = {['Rolluik']='Stop AFTER 17'}
	print("Kier done")

    -- half
  elseif commando == "Half" and otherdevices["Rolluik"] == "Stopped" then
    commandArray[#commandArray + 1] = {['Rolluik']='Open'} 
    commandArray[#commandArray + 2] = {['Rolluik']='Dicht AFTER 12'}
    commandArray[#commandArray + 3] = {['Rolluik']='Stop AFTER 15'}
	print("Half done")
  end
end
I see the command arrive in my function, also see the print line of the command being executed.
see log file :

Code: Select all

2017-05-22 16:43:43.093 User: Admin initiated a switch command (577/Rolluik_Keuze/Set Level)
2017-05-22 16:43:42.578 (RFXCOM) Temp + Humidity + Baro (Binnen)
2017-05-22 16:43:43.093 (RFXCOM) Temp + Humidity + Baro (Binnen)
2017-05-22 16:43:44.281 LUA: rolluik status Stopped command Dicht
2017-05-22 16:43:44.281 LUA: Dicht done
2017-05-22 16:43:43.969 (Dummie) Light/Switch (Rolluik_Keuze)
2017-05-22 16:43:44.328 (RFXCOM) RFY (Rolluik)
2017-05-22 16:43:45.609 (RFXCOM) Temp + Humidity (Douche)
2017-05-22 16:43:49.391 (RFXCOM) Temp + Humidity (Buiten)
So all seems fine, but nothing happens once the stop command is given.
If i use the original manual switch from the dashboard named "Rolluik" all works fine. :!:
It looks like after the command stop is given from LUA it is not possible to give another command from lua any more :shock:

Any idea why this won''t work ?
Many thanks in advance ...

Re: Sunblinds problem (commando send nothing happens)

Posted: Tuesday 23 May 2017 9:17
by zicht
Hi again,

After some terting i can confirm all works, until a stop command is given by the script. :o
After the stop command i can send what i want from lua nothing happens. :roll:

But when i do a manual command (from the orignal RFY switch in domoticz named Rolluik) that works.
After that the script works again. :geek:

So it seems to me something happens on the stop command causing something strange ...
Anyone the same experience ??

By the way it is a somphy motor with RFY support.

Re: Sunblinds problem (commando send nothing happens)

Posted: Monday 29 May 2017 13:05
by zicht
Rewrote the whole thing.. and by surprise it works wel now.
No clue why it did not work.

Re: Sunblinds problem (commando send nothing happens) SOLVED

Posted: Monday 29 May 2017 14:59
by D'rMorris
Can you post your working code so that others might benefit from it?

Thanks :)

Re: Sunblinds problem (commando send nothing happens) SOLVED

Posted: Monday 29 May 2017 16:22
by jvdz
Doubt Domoticz understands the "Dicht AFTER 12" command which probably needed to be "Close AFTER 12"?

Jos

Re: Sunblinds problem (commando send nothing happens) SOLVED

Posted: Monday 05 June 2017 11:00
by zicht
jvdz wrote:Doubt Domoticz understands the "Dicht AFTER 12" command which probably needed to be "Close AFTER 12"?

Jos
Hi Jos,

No Needed to use On and Off :shock: took some time to realise that one but it was right on front of me in the log shown :)

Re: Sunblinds problem (commando send nothing happens) SOLVED

Posted: Monday 05 June 2017 11:09
by zicht

Code: Select all

function Rolluik(commando)
-- Some timings to work with in my case : 
-- Timings : From closed to fully open 	19 Sec | from open to flully closed	 	19 Sec
-- Timings : From closed to ventilation	02 Sec | from open to ventitaltion		14 Sec
-- Timings : From closed to half open 	10 Sec | from open to half open		 	6 Sec
-- from open   3sec = 25%    6sec = 50%   10sec=75%
-- from closed  5sec = 75%   10sec = 50%   15sec=25%
  
  local Rstatus = otherdevices["Rolluik"]
  local Rselector = otherdevices["Rolluik_Keuze"]
  local BuitenT = otherdevices_temperature['Buiten']
  local BuitenTmin = 4
  local BinnenT = otherdevices_temperature['Binnen']
  local Temptresh = 23
  if commando ~= nil then print('rolluik  ' .."   status "..Rstatus.."   command "..commando) end
  
  -- temp correctie
  if commando == nil and otherdevices["Rolluik_Keuze"] == 'Auto' then  
	  if BuitenT < BuitenTmin and Rstatus ~="Closed" then 
				commando = 'Dicht'  print('Dicht koud buiten')
	  elseif BuitenT >= (Temptresh+5)  and Rstatus ~="Closed" then 
				commando = 'Dicht' print('Dicht heet buiten')
	  elseif BuitenT >= Temptresh  and Rstatus ~="Closed" and Rstatus ~="Stopped" then 
				commando = 'Kier' print('Kier warm buiten')
	  elseif  BuitenT >= BuitenTmin and BuitenT <= (Temptresh) and otherdevices['Schemer'] == 'On' 
		   and timenow.hour>9 and timenow.hour<20 and difference29>3600 then 
				commando = 'Open' print('Open temp ok')
	  end
  end
  --------------------------------------
  --- Rolluik uitvoerende functie     --
  --------------------------------------
  -- Dicht /Open
  if commando == "Dicht" then commandArray[#commandArray + 1] = {['Rolluik']='On'} 	print("Dicht done")  
  elseif commando == "Open" then commandArray[#commandArray + 1] = {['Rolluik']='Off'}  print("Open done")
  end
  
  -- Open : Hieronder --> wacht altijd 20 sec om laatste actie af te maken
  if Rstatus =="Open" then
 	  -- half
	  if commando == "Half" then
		commandArray[#commandArray + 1] = {['Rolluik']='On AFTER 20'}   			-- close after 20 sec
		commandArray[#commandArray + 1] = {['Rolluik']='Stop AFTER 26'} 			-- Stop 6 sec later (stukje dicht)
		print("Open : Half done ")
	  -- kier 
	  elseif commando == "Kier" then
		commandArray[#commandArray + 1] = {['Rolluik']='On'}  						-- close
		commandArray[#commandArray + 1] = {['Rolluik']='Off AFTER 20'} 				-- Open after 20 sec
		commandArray[#commandArray + 1] = {['Rolluik']='Stop AFTER 23'} 				-- Stop 10 sec later (ongeveer kierstand)
		print("Open : Kier done")
	  end
  end
  -- Dicht : Hieronder --> wacht altijd 20 sec om laatste actie af te maken
  if Rstatus =="Closed" then
 	  -- half
	  if commando == "Half" then
		commandArray[#commandArray + 1] = {['Rolluik']='Off AFTER 20'}   			-- Open after 20 sec
		commandArray[#commandArray + 1] = {['Rolluik']='Stop AFTER 29'} 			-- Stop 9 sec later (bit open)
		print("Dicht : Half done")
	  -- kier 
	  elseif commando == "Kier" then
		commandArray[#commandArray + 1] = {['Rolluik']='Off AFTER 20'} 			-- Open after 20 sec
		commandArray[#commandArray + 1] = {['Rolluik']='Stop AFTER 23'} 			-- Stop 3 sec later (bit open)
		print("Dicht : Kier done")
	  end
  end
  -- Stopped : Hieronder --> wacht altijd 20 sec om laatste actie af te maken
  if Rstatus =="Stopped" then
 	  -- half
	  if commando == "Half" then
		commandArray[#commandArray + 1] = {['Rolluik']='Off'}   					-- Open doen 
		commandArray[#commandArray + 1] = {['Rolluik']='On AFTER 20'}   			-- dicht doen na 20 sec
		commandArray[#commandArray + 1] = {['Rolluik']='Stop AFTER 26'} 			-- Stop 6 sec later (stukje dicht)
		print("Dicht : Half done")
	  -- kier 
	  elseif commando == "Kier" then
		commandArray[#commandArray + 1] = {['Rolluik']='On'}  						-- Dicht
		commandArray[#commandArray + 1] = {['Rolluik']='Off AFTER 20'} 				-- Open doen na 20 sec
		commandArray[#commandArray + 1] = {['Rolluik']='Stop AFTER 23'} 			-- Stop 3 sec later (ongeveer kierstand)
		print("Dicht : Kier done")
	  end
  end

end
I have a domoticz normal blind switch and an additiona dummy selection switch to have the timing option. The names i use are dutch but you get the clue based on timings and comments.
Differnence29 is a var that holds x sec since the last command to avoid to have to much movenements due to the sunlight sensor (clouds)

You may wonder why wait 20 sec. This has to do with RFY. If you push in domoticz the blind open , the status changes immediatly to open
but the blinds are still rolling. So this could possible mess up the timing. For this reason i wait 20 sec (fully open or close timing)

As written above i discovered i had to use on and off and not open close :)
It works like a charm now

Re: Sunblinds problem (commando send nothing happens) SOLVED

Posted: Sunday 11 June 2017 22:41
by EdddieN
Exactly what I was looking for :)