Page 29 of 36
Re: Blockly examples
Posted: Monday 06 August 2018 16:00
by henk99
Thanks for your quick response, will try this!
Re: Blockly examples
Posted: Monday 06 August 2018 19:28
by burton666
I don't know if this has been answered already but I did not find it. What is the best way to create this scenario from using a motiondetector/PIR with a lamp.
1.When movement is detected lamp is turned on for 10 min.
2. if movement is detected when the lamp is on then the timer is reset to 10min again
Last time I tried I used the "set x = y after z seconds" and also "set x = y for z minutes" and I also tried using blocky to change a user variable from 0 to 1 in different ways. But none of them worked as expected. They always flicker when the previous timer ended even as the new timer where supposed to have started.
Re: Blockly examples
Posted: Saturday 11 August 2018 19:07
by EdddieN
I think you may need to use some script for it... have you tried to trigger your event with a timer instead with a device? That way as far as the switch is ON it will keep resetting 10 minutes?
Re: Blockly examples
Posted: Saturday 11 August 2018 19:08
by EdddieN
Is it possible to trigger a shell script after X seconds via blockly?
Re: Blockly examples
Posted: Friday 24 August 2018 22:16
by corederoma82
This is my blocky:
if time it's more than 21 and my playstation 4 is on, it active a scene that switch off all lights in the home and switch on the light near tv.
- Immagine.png (7.56 KiB) Viewed 5013 times
But now I have a question; I see the log and this blocky runs every 2 minutes more or less, so there is no risk of ruining the light bulbs that receive continuous commands?
Thanks
Re: Blockly examples
Posted: Friday 24 August 2018 22:26
by EdddieN
You could add a variable to let
Know Domoticz that event has run and no need to keep issuing commands to the lights.
A bit like: if PS4 and >21 and userVar = 0 then
Switch on light and set userVar=1
Just make sure to reset userVar to zero when no longer the event applies.
Hope it helps
Re: Blockly examples
Posted: Friday 24 August 2018 22:30
by corederoma82
How is possible to reset var to 0?
Re: Blockly examples
Posted: Friday 24 August 2018 22:35
by corederoma82
corederoma82 wrote: ↑Friday 24 August 2018 22:30
How is possible to reset var to 0? Oh and what is Uservar?
Re: Blockly examples
Posted: Friday 24 August 2018 22:41
by EdddieN
A bit like: if PS4 and >21 and userVar = 0 then
Switch on light and set userVar=1
Else if PS4=off and/or.... (whatever) and userVar=1 then
Whatever you want to do and see userVar=0
Re: Blockly examples
Posted: Friday 24 August 2018 22:42
by EdddieN
UserVar is a user variable, look under setup menu, there’s an option under more options
Re: Blockly examples
Posted: Friday 24 August 2018 23:03
by corederoma82
EdddieN wrote: ↑Friday 24 August 2018 22:42
UserVar is a user variable, look under setup menu, there’s an option under more options
Done, but script says : Error: EventSystem: Lua script error (Blockly), Name: Playstation_Accesa_1 => [string "result = 0; weekday = os.date('*t')['wday']; ..."]:1: ')' expected near 'comparevariable'
- Immagine.png (13.59 KiB) Viewed 5004 times
Re: Blockly examples
Posted: Friday 24 August 2018 23:04
by corederoma82
- Immagine.png (14.48 KiB) Viewed 5003 times
Re: Blockly examples
Posted: Friday 24 August 2018 23:11
by gijsje
You can also do in the first line IF tv=off and time........................
Then it will not start it again because the tv is already on
Re: Blockly examples
Posted: Friday 24 August 2018 23:18
by corederoma82
gijsje wrote: ↑Friday 24 August 2018 23:11
You can also do in the first line IF tv=off and time........................
Then it will not start it again because the tv is already on
???
Re: Blockly examples
Posted: Friday 24 August 2018 23:19
by corederoma82
What I wrong?
Re: Blockly examples
Posted: Friday 24 August 2018 23:25
by jvdz
You cannot do a SET Salone = Off And ...
This needs to be 2 separate set rows, one for the Swich and one for the variable.
Jos
Re: Blockly examples
Posted: Friday 24 August 2018 23:30
by corederoma82
How is possible create 2 separate set rows?
Re: Blockly examples
Posted: Friday 24 August 2018 23:41
by jvdz
Just drag and drop 2 separate set command.... as simple as that!.
Re: Blockly examples
Posted: Friday 24 August 2018 23:54
by corederoma82
Done!!!!! It seems to work properly.
Thanks very much guys
- Immagine.png (22.65 KiB) Viewed 4988 times
Re: Blockly examples
Posted: Wednesday 12 September 2018 22:47
by AllardSchaap
Hi,
Just new Here. Allard is my name.
I try to make this work;
But it is not working, nothing happens.
Activating buttons in the switch window will work Well and the PIR also shown active with any movement.
In Domoticz setup the events button is active.
Any idears?
Thanks, Allard
Verzonden vanaf mijn iPad met Tapatalk