mirror of
https://github.com/CeeWeasel/fresh-home.git
synced 2026-08-10 02:50:12 -04:00
why keep track any more?
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
platform: template
|
||||
sensors:
|
||||
sun_elevation:
|
||||
unique_id: templatesensor.sun_elevation
|
||||
value_template: "{{ state_attr('sun.sun', 'elevation') }}"
|
||||
unit_of_measurement: "degrees"
|
||||
icon_template: >
|
||||
template:
|
||||
- sensor:
|
||||
- unique_id: templatesensor.sun_elevation
|
||||
unit_of_measurement: degrees
|
||||
default_entity_id: sensor.sun_elevation
|
||||
icon: >
|
||||
{% set elevation = state_attr('sun.sun', 'elevation')|default(0) %}
|
||||
{% if elevation > 0 %}
|
||||
mdi:weather-sunny
|
||||
mdi:weather-sunny
|
||||
{% else %}
|
||||
mdi:weather-night
|
||||
{% endif %}
|
||||
state: '{{ state_attr("sun.sun", "elevation") }}'
|
||||
name: sun_elevation
|
||||
|
||||
period_of_day:
|
||||
unique_id: templatesensor.period_of_day
|
||||
friendly_name: Period of the Day
|
||||
value_template: >-
|
||||
- unique_id: templatesensor.period_of_day
|
||||
default_entity_id: sensor.period_of_day
|
||||
name: Period of the Day
|
||||
state: >-
|
||||
{% if (as_timestamp(states.sun.sun.attributes.next_dusk)) - (as_timestamp(states.sun.sun.attributes.next_setting)) < 0 %}
|
||||
Dusk
|
||||
{% elif (as_timestamp(states.sun.sun.attributes.next_rising)) - (as_timestamp(states.sun.sun.attributes.next_dawn)) < 0 %}
|
||||
@@ -24,4 +25,14 @@ sensors:
|
||||
Night
|
||||
{% else %}
|
||||
Day
|
||||
{% endif %}
|
||||
icon: >
|
||||
{% if is_state("sensor.period_of_day", "Dawn") %}
|
||||
mdi:weather-sunset-up
|
||||
{% elif is_state("sensor.period_of_day", "Dusk") %}
|
||||
mdi:weather-sunset-down
|
||||
{% elif is_state("sensor.period_of_day", "Night") %}
|
||||
mdi:moon-waxing-crescent
|
||||
{% elif is_state("sensor.period_of_day", "Day") %}
|
||||
mdi:weather-sunny
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user