Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 107296

Sunset Automations with Template

$
0
0

Hi,

As you can see here, I am trying to fix an automation that is suppose to function as follows:

Next sunset - 15 minutes, > 9/1 and daylight savings time is on OR
At Sunset

Is this the correct way to go about it? I noticed if I remove the == states(‘sensor.time’), then it would be true which is how it was prior and I had mixed results.

Thanks!

    - platform: template
      value_template: >-
        {{ ((as_timestamp(states.sun.sun.attributes.next_setting) - 15*60) |float| timestamp_custom('%H:%M') == states('sensor.time') and (now().month, now().day) >= (9,1) and is_state('binary_sensor.daylight_savings_time', 'on')) or
        ((as_timestamp(states.sun.sun.attributes.next_setting)) |float| timestamp_custom('%H:%M') == states('sensor.time')) }}

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 107296

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>