This object is in archive! 

Tutorial: Virtual Night Sensor

Olivier Legros shared this idea 8 years ago
Under Consideration

Something simple yet practical: a virtual night sensor that is automatically changing state at sunrise/sunset time.


I created a virtual sensor, that I update with two rules, one that is triggered at sunset and another one at sunrise.

Each rule is calling the HTTP request to change state to 1 and 0 respectively.

In order to be able to trigger the rule at sunset/sunrise, you need to

- add a virtual weather station.


- once this is done, the when trigger can be based on astro schedule that are the sunset/sunrise time respectively.


This is very practical, it enables you to create rules based on night/day. Until then, all I could do was either have a static time (8AM-8PM).

Replies (3)

photo
3

I use for this a simple virtual switch. It is called "daylight". At sunrise it is set to on and at sunset to off. Ready.

photo
1

I haven't played with switches yet. Thanks for comment. I see it's easier to program the rule with a switch. Its a matter of taste, but I like the idea of a sensor (a non-virtual device would be a sensor). Though maybe associations can benefit of a switch.

photo
3

A switch is allways also a sensor.....


you can use it in rules as sensors

Leave a Comment
 
Attach a file