Blockly examples

Moderator: leecollings

henk99
Posts: 28
Joined: Thursday 02 March 2017 11:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by henk99 »

Thanks for your quick response, will try this!
burton666
Posts: 85
Joined: Monday 17 August 2015 21:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post 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.
User avatar
EdddieN
Posts: 510
Joined: Wednesday 16 November 2016 11:31
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: Scotland
Contact:

Re: Blockly examples

Post 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?
11101101 - www.machinon.com
User avatar
EdddieN
Posts: 510
Joined: Wednesday 16 November 2016 11:31
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: Scotland
Contact:

Re: Blockly examples

Post by EdddieN »

Is it possible to trigger a shell script after X seconds via blockly?
11101101 - www.machinon.com
corederoma82
Posts: 85
Joined: Saturday 14 January 2017 21:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post 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
Immagine.png (7.56 KiB) Viewed 5018 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
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826, Controlicz, Kodi
User avatar
EdddieN
Posts: 510
Joined: Wednesday 16 November 2016 11:31
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: Scotland
Contact:

Re: Blockly examples

Post 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
11101101 - www.machinon.com
corederoma82
Posts: 85
Joined: Saturday 14 January 2017 21:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by corederoma82 »

How is possible to reset var to 0?
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826, Controlicz, Kodi
corederoma82
Posts: 85
Joined: Saturday 14 January 2017 21:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by corederoma82 »

corederoma82 wrote: Friday 24 August 2018 22:30 How is possible to reset var to 0? Oh and what is Uservar?
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826, Controlicz, Kodi
User avatar
EdddieN
Posts: 510
Joined: Wednesday 16 November 2016 11:31
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: Scotland
Contact:

Re: Blockly examples

Post 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
11101101 - www.machinon.com
User avatar
EdddieN
Posts: 510
Joined: Wednesday 16 November 2016 11:31
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: Scotland
Contact:

Re: Blockly examples

Post by EdddieN »

UserVar is a user variable, look under setup menu, there’s an option under more options
11101101 - www.machinon.com
corederoma82
Posts: 85
Joined: Saturday 14 January 2017 21:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post 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
Immagine.png (13.59 KiB) Viewed 5009 times
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826, Controlicz, Kodi
corederoma82
Posts: 85
Joined: Saturday 14 January 2017 21:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by corederoma82 »

Immagine.png
Immagine.png (14.48 KiB) Viewed 5008 times
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826, Controlicz, Kodi
User avatar
gijsje
Posts: 132
Joined: Saturday 19 August 2017 14:28
Target OS: NAS (Synology & others)
Domoticz version: Stable
Location: Berkel Enschot, NL
Contact:

Re: Blockly examples

Post 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
Synology DS218+ - RFXtrx433 - Aeotec Z-Stick Gen5 - Toon Thermostat - Neo CoolCam plug - Neo CoolCam PIR - FIBARO PIR - Heiman Smart Smoke Senso - Neo CoolCam Leakage Detector - BeNext Tag Reader - P1 and S0 USB - many Mi-Light lights - KAKU switches
corederoma82
Posts: 85
Joined: Saturday 14 January 2017 21:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post 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
???
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826, Controlicz, Kodi
corederoma82
Posts: 85
Joined: Saturday 14 January 2017 21:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by corederoma82 »

What I wrong?
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826, Controlicz, Kodi
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Blockly examples

Post 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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
corederoma82
Posts: 85
Joined: Saturday 14 January 2017 21:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by corederoma82 »

How is possible create 2 separate set rows?
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826, Controlicz, Kodi
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Blockly examples

Post by jvdz »

Just drag and drop 2 separate set command.... as simple as that!.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
corederoma82
Posts: 85
Joined: Saturday 14 January 2017 21:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by corederoma82 »

Done!!!!! It seems to work properly.
Thanks very much guys
Immagine.png
Immagine.png (22.65 KiB) Viewed 4993 times
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826, Controlicz, Kodi
AllardSchaap
Posts: 1
Joined: Wednesday 12 September 2018 22:30
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Post by AllardSchaap »

Hi,

Just new Here. Allard is my name.

I try to make this work;

Image

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
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests