Sunset/sunrise blockly Topic is solved

Moderator: leecollings

Post Reply
maceddy
Posts: 13
Joined: Saturday 13 January 2018 21:07
Target OS: Raspberry Pi / ODroid
Domoticz version: 12723
Location: Hoogeveen
Contact:

Sunset/sunrise blockly

Post by maceddy »

I want my garden lights to go on or off only at certain times.
For example: if sunset is before 22:00 turn on the lights at sunset.

I wrote some blockly for this, but my garden lights are not being turned on.. I can not figure out what I am doing wrong...
sunsetblockly.png
sunsetblockly.png (15.21 KiB) Viewed 5164 times
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Sunset/sunrise blockly

Post by tozzke »

First of all... if you're only using one statement, you'll have to pick the other if-block without the blue gear icon on the top left.

Secondly you can't compare 'Sunset' directly to a specific time

this'll work better I guess:
Image
maceddy
Posts: 13
Joined: Saturday 13 January 2018 21:07
Target OS: Raspberry Pi / ODroid
Domoticz version: 12723
Location: Hoogeveen
Contact:

Re: Sunset/sunrise blockly

Post by maceddy »

I can see the logic in that. I am gonna try that! Thanks.
Plantje
Posts: 451
Joined: Friday 16 October 2015 7:58
Target OS: Windows
Domoticz version:
Contact:

Re: Sunset/sunrise blockly

Post by Plantje »

Until what time does "> sunset" apply? I mean: at about 22.00 it is past sunset. But at 3 in the night it is also past sunset. However, after 9.00 in the morning, it is also past sunset....past sunrise as well.

I am asking this, because I'd like my bathroom lights to switch on to 100% when it is daytime and to 10% when it is nighttime.

Is it also possible to check if it is 2 hours past sunset? Or do I just have to make sure the action set will happen "after x minutes"?
User avatar
Treve
Posts: 107
Joined: Thursday 05 November 2015 10:37
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.11474
Location: Rotterdam, NL
Contact:

Re: Sunset/sunrise blockly

Post by Treve »

Plantje wrote: Friday 31 July 2020 22:59 Until what time does "> sunset" apply? I mean: at about 22.00 it is past sunset. But at 3 in the night it is also past sunset. However, after 9.00 in the morning, it is also past sunset....past sunrise as well.

I am asking this, because I'd like my bathroom lights to switch on to 100% when it is daytime and to 10% when it is nighttime.

Is it also possible to check if it is 2 hours past sunset? Or do I just have to make sure the action set will happen "after x minutes"?
You can make use of a "dummy switch" and set timers in this switch, for instance A daytime block, after Sunrise - set on, after Sunset - set off.
Now you will have a switch wich is on during Sunrise and Sunset.

For a Nighttime block, set ,after Sunset on, after Sunrise set off.
Now you will have a switch wich is on during Sunset and Sunrise.

With this switch you can finish the block with other blockly components.
- 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
Plantje
Posts: 451
Joined: Friday 16 October 2015 7:58
Target OS: Windows
Domoticz version:
Contact:

Re: Sunset/sunrise blockly

Post by Plantje »

Quite weird to have a virtual switch to control an actual switch.

Anyway, thanks for the response, but I solved it by checking the LUX.
Aantekening 2020-08-01 105046.png
Aantekening 2020-08-01 105046.png (80.86 KiB) Viewed 4060 times
User avatar
Treve
Posts: 107
Joined: Thursday 05 November 2015 10:37
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.11474
Location: Rotterdam, NL
Contact:

Re: Sunset/sunrise blockly

Post by Treve »

Because there is no linear connection from Lux to Sunset/Sunrise. Lots of people struggle with time calculations and use of a dummy makes the blockly quite easy.
- 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
Plantje
Posts: 451
Joined: Friday 16 October 2015 7:58
Target OS: Windows
Domoticz version:
Contact:

Re: Sunset/sunrise blockly

Post by Plantje »

I know time calculation is always a pain :( I am in BI en proper reporting against time is always challenging!

However, in this case if I were to switch a light based on if it is after sunset or not then I fail to see why I would first switch a dummy switch based on if it is after sunset and then based on the dummy switch, switch the actual switch. It seems redundant.
User avatar
Treve
Posts: 107
Joined: Thursday 05 November 2015 10:37
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.11474
Location: Rotterdam, NL
Contact:

Re: Sunset/sunrise blockly

Post by Treve »

There are several roads that lead to Rome, I just try to make another way clear and not to offer a solution. In retrospect, my comment applies more to the "maceddy" problem. My point is that time-related problems can be (temporarily) solved and tested with dummies and variables. Then you can make an attempt to solve this neatly without the dummy(s) and variables.
- 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
Plantje
Posts: 451
Joined: Friday 16 October 2015 7:58
Target OS: Windows
Domoticz version:
Contact:

Re: Sunset/sunrise blockly

Post by Plantje »

Agreed.... let's not hijack this topic any further :)
phpieter
Posts: 1
Joined: Wednesday 22 December 2021 11:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Sunset/sunrise blockly

Post by phpieter »

When one has setup a blockly like: time > sunset OR time < sunrise —> activate device.

You now wonder why its not working. And it looks like sunrise and sunset are being ignored. There is a good change you did not setup your location in the settings page of domoticz.

Longitude and Latitude are required for sunrise/sunset to work in blockly.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest