Blockly examples

henk99
Posts: 22
Joined: Thursday 02 March 2017 12:36
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by henk99 » Monday 06 August 2018 16:00

Thanks for your quick response, will try this!

burton666
Posts: 107
Joined: Monday 17 August 2015 21:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by burton666 » Monday 06 August 2018 19:28

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: 543
Joined: Wednesday 16 November 2016 12:31
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Scotland
Contact:

Re: Blockly examples

Post by EdddieN » Saturday 11 August 2018 19:07

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: 543
Joined: Wednesday 16 November 2016 12:31
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Scotland
Contact:

Re: Blockly examples

Post by EdddieN » Saturday 11 August 2018 19:08

Is it possible to trigger a shell script after X seconds via blockly?
11101101 - www.machinon.com

corederoma82
Posts: 79
Joined: Saturday 14 January 2017 22:34
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by corederoma82 » Friday 24 August 2018 22:16

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 1242 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

User avatar
EdddieN
Posts: 543
Joined: Wednesday 16 November 2016 12:31
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Scotland
Contact:

Re: Blockly examples

Post by EdddieN » Friday 24 August 2018 22:26

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: 79
Joined: Saturday 14 January 2017 22:34
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by corederoma82 » Friday 24 August 2018 22:30

How is possible to reset var to 0?
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826

corederoma82
Posts: 79
Joined: Saturday 14 January 2017 22:34
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by corederoma82 » Friday 24 August 2018 22:35

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

User avatar
EdddieN
Posts: 543
Joined: Wednesday 16 November 2016 12:31
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Scotland
Contact:

Re: Blockly examples

Post by EdddieN » Friday 24 August 2018 22:41



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: 543
Joined: Wednesday 16 November 2016 12:31
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Scotland
Contact:

Re: Blockly examples

Post by EdddieN » Friday 24 August 2018 22:42

UserVar is a user variable, look under setup menu, there’s an option under more options
11101101 - www.machinon.com

corederoma82
Posts: 79
Joined: Saturday 14 January 2017 22:34
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by corederoma82 » Friday 24 August 2018 23:03

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 1234 times
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826

corederoma82
Posts: 79
Joined: Saturday 14 January 2017 22:34
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by corederoma82 » Friday 24 August 2018 23:04

Immagine.png
Immagine.png (14.48 KiB) Viewed 1233 times
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826

User avatar
gijsje
Posts: 160
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 » 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
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: 79
Joined: Saturday 14 January 2017 22:34
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by corederoma82 » Friday 24 August 2018 23:18

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

corederoma82
Posts: 79
Joined: Saturday 14 January 2017 22:34
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by corederoma82 » Friday 24 August 2018 23:19

What I wrong?
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826

User avatar
jvdz
Posts: 1443
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: Blockly examples

Post by jvdz » Friday 24 August 2018 23:25

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

corederoma82
Posts: 79
Joined: Saturday 14 January 2017 22:34
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by corederoma82 » Friday 24 August 2018 23:30

How is possible create 2 separate set rows?
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826

User avatar
jvdz
Posts: 1443
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: Blockly examples

Post by jvdz » Friday 24 August 2018 23:41

Just drag and drop 2 separate set command.... as simple as that!.

corederoma82
Posts: 79
Joined: Saturday 14 January 2017 22:34
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by corederoma82 » Friday 24 August 2018 23:54

Done!!!!! It seems to work properly.
Thanks very much guys
Immagine.png
Immagine.png (22.65 KiB) Viewed 1218 times
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826

AllardSchaap
Posts: 1
Joined: Wednesday 12 September 2018 22:30
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Post by AllardSchaap » Wednesday 12 September 2018 22:47

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: Jubbes and 4 guests