Hello,
i tried the condition (after sunrise and before sunset). This works perfectly. But all my tries for before sunrise and after sunset don*t work.
Can you give me an hint why?
Thanks a lot.
Hello,
i tried the condition (after sunrise and before sunset). This works perfectly. But all my tries for before sunrise and after sunset don*t work.
Can you give me an hint why?
Thanks a lot.
You must add a “or” condition :
Before sunrise or after sunset
I think you have run into a typical problem with the sun sensor, where it switches at midnight, so yesterdays sunset is not what is stored in the sensor.
You can use Sun2 integration instead, which provide more values.
And how to this with yaml?
condition: sun
before: sunrise
after: sunset
I will try this. Thanks!
condition:
- condition: or
conditions:
- condition: sun
before: sunrise
- condition: sun
after: sunset
I have a problem with the installation. The Sensor “Sun2” is not visible at the entities as “Sun”. I copied the files in the /config share on the home assistant ODROID.
That seems not to work. As with my setting first only the sunrise time ist checked.
The condition in your screenshot is faulty and isn’t what piitaya suggested.
Piitaya’s example is also shown in the documentation for Sunrise/Sunset Condition.
Thanks! Now it works!
you have to put something like this in the configuration.yaml file.
Once you restart then you will find two sensors for Place1, called sensor.place1_sunrise and sensor.place1_sunset, and also two sensors for Place2.
You should change PlaceX to your location name and also change the latitude and longitude. Use Google Maps.
Likewise time_zone should be changed to you timezone.
Elavation is the height over sea level. I am not sure how to get that for other places than Denmark, but there should be ways.
sensor sun2:
- platform: sun2
entity_namespace: Place1
latitude: 55.663
longitude: 12.553
time_zone: Europe/Copenhagen
elevation: 3
monitored_conditions:
- sunrise
- sunset
- dawn
- dusk
- platform: sun2
entity_namespace: Place2
latitude: 55.837
longitude: 12.414
time_zone: Europe/Copenhagen
elevation: 53
monitored_conditions:
- sunrise
- sunset
- dawn
- dusk