Sunrise and Sunset Topic is solved

Moderator: leecollings

Post Reply
ChrisVH1982
Posts: 23
Joined: Friday 16 November 2018 17:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Sunrise and Sunset

Post by ChrisVH1982 »

Hello,

I want to switch on the light for one minute using a PIR but only after sunset and before sunrise. How can I acconplish that?
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: Sunrise and Sunset

Post by Treve »

ChrisVH1982 wrote:Hello,

I want to switch on the light for one minute using a PIR but only after sunset and before sunrise. How can I acconplish that?
It’s quite simple to do with a blockly.

- make a variable ‘nighttime’
- make a blockly
“if time is sunset” “set Nighttime =on” and “if time is sunrise” “set Nightime =off”
If Pir is on and Nighttime is on set light=on for 1 minute

That’s all.
- 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
AllesVanZelf
Posts: 265
Joined: Monday 05 February 2018 8:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 12467
Location: Netherlands, near Haarlem
Contact:

Re: Sunrise and Sunset

Post by AllesVanZelf »

If [Time > Sunset] or [Time < Sunrise] and [Light = Off] and [PIR = On]
Set [Light = On for [1] minutes.

I used a dummy switch instead of a variable as Treve wrote. This Dummy switch was switched by timer. But this is not necessary for what you want to accomplish now.
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
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: Sunrise and Sunset

Post by Treve »

AllesVanZelf wrote:If [Time > Sunset] or [Time < Sunrise] and [Light = Off] and [PIR = On]
As far i know there are Time complications with calculations before 00:00 and after 00:00.
That’s the reason I made use of a variable.
- 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
AllesVanZelf
Posts: 265
Joined: Monday 05 February 2018 8:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 12467
Location: Netherlands, near Haarlem
Contact:

Re: Sunrise and Sunset

Post by AllesVanZelf »

The complication you refer to is: If [Time > Sunset] and [Time < Sunrise]
That will never happen. That is why I used OR.
If [Time > Sunset] or [Time < Sunrise]
Then it is working.
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
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: Sunrise and Sunset

Post by Treve »

AllesVanZelf wrote:If [Time > Sunset] or [Time < Sunrise] and [Light = Off] and [PIR = On]
Set [Light = On for [1] minutes.
Produce this solution every minute a ‘on’ signal?
- 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest