Page 1 of 1

My first blockly script

Posted: Tuesday 03 November 2020 17:40
by ElMyggo
Hi, i am complety novise on this script thing and i have start to setup Domoticz on a Raspberry with some switches and have try this scripts and its seems to work but is it correct?

First i found this example and i created a virtual switch if its night or not
natt.JPG
natt.JPG (20.4 KiB) Viewed 587 times
Then i want to start lightgroup at time 05:05 but only if there is night, then i want to switch of at 05:35 so i create this:
belysning.JPG
belysning.JPG (25.45 KiB) Viewed 587 times
Is this correct way to do this?

Re: My first blockly script

Posted: Tuesday 03 November 2020 20:15
by AllesVanZelf
What also is possible is switching 'Natt' with a timer in the switch itself. I found out that this is working more reliable.

Re: My first blockly script

Posted: Wednesday 04 November 2020 11:18
by Treve
I think this will do the job after making a variabele called 'Natt'

Belysning.jpg
Belysning.jpg (41.8 KiB) Viewed 562 times

Re: My first blockly script

Posted: Wednesday 04 November 2020 15:35
by ElMyggo
Ok i do a test whitout the virtual switch and use variable instead, thanks for help so far :-)

My first blockly script

Posted: Wednesday 04 November 2020 16:44
by Treve
With use of a variable you can’t accidentally press the button.
There will be only a problem when Sunrise time is between 05:05 and 05:35. But you have a few months to find a solution for that.
For example: if Time is > 05:05 and < 05:35