Page 1 of 1
If device is on for 5 minutes
Posted: Thursday 19 January 2017 23:18
by stingone
Hi everyone,
Is there any possibily to write a rule that uses the (if device is on for 5 minutes then?) could not find it with blockly.
Re: If device is on for 5 minutes
Posted: Thursday 19 January 2017 23:22
by Egregius
Probably not in blockly, but in pass2php very simple:
Code: Select all
if($sdevice=='On'&&$tdevice<time-300){
...
}
Re: If device is on for 5 minutes
Posted: Thursday 19 January 2017 23:56
by Domosapiens
@Egregius:
Yes you are brilliant!
And in pass2php everything is possible,.... as you answer to each question.
But this is the Blockly section, PHP has his own section, and keep it there!
My wife and children don't understand PHP, but can edit and maintain Blockly.
Maintaining domotica is more important than creating domotica.
Rather important: even you will die one day.
@stingone
Use a dummy device (DUMDEV) to remember the state of your device DEV
Something like this (not tested)
IF DEV=ON and DUMDEV=ON
SET DUMDEV OFF after 300 seconds
IF DEV=ON and DUMDEV=OFF
SET "do your thing"
IF DEV=OFF and DUMDEV=OFF
SET DUMDEV=ON
(remember: ELSE is not a real ELSE ... all branches are checked always
Hope this helps
Re: If device is on for 5 minutes
Posted: Friday 20 January 2017 6:43
by Egregius
Oh, because we're not in the PHP board one may not suggest PHP?