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

Offset with Sunset in a template

$
0
0

Just looking for a code check here. Trying to make a binary sensor that turns on as follows:

30 min from sunset & > 30% cloudy
or
sun elevation = -5

Does this look right?

- platform: template
  sensors:
    time_logic:
      value_template: >-
        "{{ states('sensor.owm_cloud_coverage')| float >= 30
                                  and states('sensor.time') == as_timestamp(state_attr('sun.sun', 'next_setting')) | timestamp_custom('%R')
                                  or  state_attr('sun.sun', 'elevation') | float <=-5}}"

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 105842

Trending Articles



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