Blockly using Kaku Dusk Sensor
Moderator: leecollings
-
- Posts: 17
- Joined: Thursday 05 July 2018 19:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10717
- Contact:
Blockly using Kaku Dusk Sensor
Hi all,
Recently I Installed a KaKu Dusk sensor which I want to use between a specific time so I thought by using a Blocky script this could easily be fixed. (Unfortunately I have no knowledge of using the other scripting possiblities).
Basically I try to achieve that between 9:00 AM and 18:00 PM If the KaKu sensor is switched on then my light should be turned on for 5 minutes.
Next if the Kaku switch is off then the lights should be turned off.
But after the Sensor is activated nothing happens, I only see some error messages in the log which I can't explain, perhaps one of you can tell me what is wrong with the used script.
Many thanks for your help in advance.
Recently I Installed a KaKu Dusk sensor which I want to use between a specific time so I thought by using a Blocky script this could easily be fixed. (Unfortunately I have no knowledge of using the other scripting possiblities).
Basically I try to achieve that between 9:00 AM and 18:00 PM If the KaKu sensor is switched on then my light should be turned on for 5 minutes.
Next if the Kaku switch is off then the lights should be turned off.
But after the Sensor is activated nothing happens, I only see some error messages in the log which I can't explain, perhaps one of you can tell me what is wrong with the used script.
Many thanks for your help in advance.
- Attachments
-
- Blockly script.jpg (98.86 KiB) Viewed 3652 times
-
- Blockly error.jpg (232.31 KiB) Viewed 3652 times
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Blockly using Kaku Dusk Sensor
You put the condition checks for state of Schemerschakelaar in the wrong blocks.schijndela wrote: ↑Sunday 12 July 2020 10:24 But after the Sensor is activated nothing happens, I only see some error messages in the log which I can't explain, perhaps one of you can tell me what is wrong with the used script.
I also think the explicit switching Off is not needed as the light will already be switched Off after 5 minutes.
Try first using
and if that works try again without the elseif part.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 17
- Joined: Thursday 05 July 2018 19:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10717
- Contact:
Re: Blockly using Kaku Dusk Sensor
Hi Waaren,
Thanks for your reply, you mention that I put the check for the schemerschakelaar in the wrong Blocks, could you please explain what you mean.
Did you meant that I first need begin with time in the If statement and than end it with the Schemerschakelaar?
I modified the switching off as you suggested, so now the Blocky looks like this.
Thanks for your reply, you mention that I put the check for the schemerschakelaar in the wrong Blocks, could you please explain what you mean.
Did you meant that I first need begin with time in the If statement and than end it with the Schemerschakelaar?
I modified the switching off as you suggested, so now the Blocky looks like this.
- Attachments
-
- Blockly script v2.jpg (54.26 KiB) Viewed 3643 times
-
- Posts: 17
- Joined: Thursday 05 July 2018 19:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10717
- Contact:
Re: Blockly using Kaku Dusk Sensor
I think I found the solution.
After modifying the Blockly Script and setting the time for just 1 minute for testing it worked.
After modifying the Blockly Script and setting the time for just 1 minute for testing it worked.
- Attachments
-
- Blockly script v3.jpg (48.63 KiB) Viewed 3643 times
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Blockly using Kaku Dusk Sensor
You coded 'Schemerschakelaar = ' as one block and ' "On" and "time > 09:00 and time < 18:00" ' as another block
It should be
' Schemerschakelaar = "On" ' as one block and 'time > 09:00 and time < 18:00' as the other block
Also there are a lot of posts on this forum warning against using nested if else in Blockly.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 265
- Joined: Monday 05 February 2018 8:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 12467
- Location: Netherlands, near Haarlem
- Contact:
Re: Blockly using Kaku Dusk Sensor
Are your sure this is going to work?
If (schemerschakelaar = 'On') and (Time > 9 and Time < 18)
Do schemerschakelaar = 'On' for X minutes.
When sunset is before 18 the light goes On, then it goes Off after X minutes, but will go On at the same time because schemerschakelaar is still Off.
Or am I wrong here?
If (schemerschakelaar = 'On') and (Time > 9 and Time < 18)
Do schemerschakelaar = 'On' for X minutes.
When sunset is before 18 the light goes On, then it goes Off after X minutes, but will go On at the same time because schemerschakelaar is still Off.
Or am I wrong here?
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
-
- Posts: 17
- Joined: Thursday 05 July 2018 19:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10717
- Contact:
Re: Blockly using Kaku Dusk Sensor
Hi Waaren,
For some reason it isn't working, the lights go on even when the schemerschakelaar is off!?
No idea how this is possible if I take a look at the log file from the schemerschakelaar it doesn't mention an entry for switching on.
Apparently there are more reason why it don't work as I hoped
For my lights I'm using a Timer which switches the lights on after sunset, My goal was to use the sunset and sunrise option in Blockly so that's why i'm using the time > 09:11 and < 18:00 option in my test.
For some reason it isn't working, the lights go on even when the schemerschakelaar is off!?
No idea how this is possible if I take a look at the log file from the schemerschakelaar it doesn't mention an entry for switching on.
Apparently there are more reason why it don't work as I hoped
For my lights I'm using a Timer which switches the lights on after sunset, My goal was to use the sunset and sunrise option in Blockly so that's why i'm using the time > 09:11 and < 18:00 option in my test.
- Attachments
-
- Switches.jpg (162.16 KiB) Viewed 3587 times
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Blockly using Kaku Dusk Sensor
I don't know how your current Blockly looks like so kind of hard to comment or adviseschijndela wrote: ↑Tuesday 14 July 2020 19:36 For some reason it isn't working, the lights go on even when the schemerschakelaar is off!?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 17
- Joined: Thursday 05 July 2018 19:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10717
- Contact:
Re: Blockly using Kaku Dusk Sensor
This is how my currently Blockly looks like.
But randomly the lights go on for a minute while the switch "Schemerschakelaar" is off.
But randomly the lights go on for a minute while the switch "Schemerschakelaar" is off.
- Attachments
-
- Kaku Dusk Sunrise - Sunset .jpg (48.77 KiB) Viewed 3562 times
-
- Posts: 17
- Joined: Thursday 05 July 2018 19:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10717
- Contact:
Re: Blockly using Kaku Dusk Sensor
I modified the If statement and replaced "and" with "or" sunrise and sunset can't be a the same time.
So, with the modified statement the lights go on for one minute and than go off for one minute..
So, with the modified statement the lights go on for one minute and than go off for one minute..
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Blockly using Kaku Dusk Sensor
Nested if (else) blocks are not supported in domoticz Blocklyschijndela wrote: ↑Friday 17 July 2020 19:15 This is how my currently Blockly looks like.
But randomly the lights go on for a minute while the switch "Schemerschakelaar" is off.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- Treve
- Posts: 107
- Joined: Thursday 05 November 2015 10:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v4.11474
- Location: Rotterdam, NL
- Contact:
Re: Blockly using Kaku Dusk Sensor
Try “If time>sunrise or time<sunset and schemerschakelaar=on”
Set enz.
Set enz.
- RFXtrx433E,
- AEON Labs ZW090 Z-Stick Gen5 EU
- Hue v2.1
- Raspberry Pi 3 Model B, Raspbian Stretch Full on USB-Stick.
- Domoticz 4.11474
Devices: KaKu, Z-Wave, Hue.
for testing:
Raspberry 4, 2GB, SSD
Domoticz 2022.1
Ikea Hub, Fyrtur curtain
- AEON Labs ZW090 Z-Stick Gen5 EU
- Hue v2.1
- Raspberry Pi 3 Model B, Raspbian Stretch Full on USB-Stick.
- Domoticz 4.11474
Devices: KaKu, Z-Wave, Hue.
for testing:
Raspberry 4, 2GB, SSD
Domoticz 2022.1
Ikea Hub, Fyrtur curtain
-
- Posts: 17
- Joined: Thursday 05 July 2018 19:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10717
- Contact:
Re: Blockly using Kaku Dusk Sensor
You mean like this.
Unfortunately still the same. also with this setting one minute on one minute off.
Unfortunately still the same. also with this setting one minute on one minute off.
- Attachments
-
- Kaku Dusk Sunrise - Sunset v2 .jpg (55.01 KiB) Viewed 3558 times
- Treve
- Posts: 107
- Joined: Thursday 05 November 2015 10:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v4.11474
- Location: Rotterdam, NL
- Contact:
Re: Blockly using Kaku Dusk Sensor
you have PB
- RFXtrx433E,
- AEON Labs ZW090 Z-Stick Gen5 EU
- Hue v2.1
- Raspberry Pi 3 Model B, Raspbian Stretch Full on USB-Stick.
- Domoticz 4.11474
Devices: KaKu, Z-Wave, Hue.
for testing:
Raspberry 4, 2GB, SSD
Domoticz 2022.1
Ikea Hub, Fyrtur curtain
- AEON Labs ZW090 Z-Stick Gen5 EU
- Hue v2.1
- Raspberry Pi 3 Model B, Raspbian Stretch Full on USB-Stick.
- Domoticz 4.11474
Devices: KaKu, Z-Wave, Hue.
for testing:
Raspberry 4, 2GB, SSD
Domoticz 2022.1
Ikea Hub, Fyrtur curtain
-
- Posts: 17
- Joined: Thursday 05 July 2018 19:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10717
- Contact:
Re: Blockly using Kaku Dusk Sensor
Hi All,
All my thanks go to Treve (Evert) he helped me out greatly, apparently by creating an additional Dummy switch the problem can be solved in Blockly.
I will attach a screenshot of the Blockly script which now works for me.
Next step is to fine-tune it a bit further
All my thanks go to Treve (Evert) he helped me out greatly, apparently by creating an additional Dummy switch the problem can be solved in Blockly.
I will attach a screenshot of the Blockly script which now works for me.
Next step is to fine-tune it a bit further
- Attachments
-
- Blockly Dusk.jpg (42.69 KiB) Viewed 3513 times
Who is online
Users browsing this forum: No registered users and 0 guests