I would like to have an event, so that when a switch turns off at a designated time interval it would turn off another switch.
example:
If switch1=on then switch1=off and time 23:00
set switch2=on
My biggest problem is finding a way that blocky knows when a switch is on then turns off. Maybe its really simple but im not seeing it.
Thanks
anyway to do a "Then"?
Moderator: leecollings
-
- Posts: 71
- Joined: Saturday 13 July 2013 2:45
- Target OS: Linux
- Domoticz version: 3.5877
- Location: Scotland
- Contact:
Re: anyway to do a "Then"?
You'd need to store the state in a user variable - because no programming language anywhere allows you to do that - the logic runs at the moment the state changes, if the state changes again - it will be evaluated in another copy of the same script. So instead you would need something a bit like:
if switch1==off and uservariable[prevSwitchState]==On and time > 23:00 and time < 07:00 then
switch2=on
elseif switch1==on then
set uservariable[prevswitchState]="On"
elseif switch1==off then
set uservariable[prevSwitchState]="Off"
end
if switch1==off and uservariable[prevSwitchState]==On and time > 23:00 and time < 07:00 then
switch2=on
elseif switch1==on then
set uservariable[prevswitchState]="On"
elseif switch1==off then
set uservariable[prevSwitchState]="Off"
end
AEOTEC ZStick, 11 ZWave Nodes, RFXCOMM, 50ish Byron Sockets.. HE851 (PIR), 2x HE852 (DoorContact)
WS2300, CM180, CC128, 2xTHGR122NX, 2xPiZeroW w/DS18B20, 8Ch 1W Relay Board.
8 Panasonic IP Cams, 1 16ch CCTV DVR + 15 CCTV Cams
WS2300, CM180, CC128, 2xTHGR122NX, 2xPiZeroW w/DS18B20, 8Ch 1W Relay Board.
8 Panasonic IP Cams, 1 16ch CCTV DVR + 15 CCTV Cams
-
- Posts: 70
- Joined: Monday 06 February 2017 12:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.9700
- Location: Azores
- Contact:
Re: anyway to do a "Then"?
ok will try that this weekend, thanks 

Who is online
Users browsing this forum: No registered users and 1 guest