mirror of
https://github.com/CeeWeasel/fresh-home.git
synced 2026-08-10 02:50:12 -04:00
nursery to girls room... finally
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
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
|
||||
{% else %}
|
||||
mdi:weather-night
|
||||
{% endif %}
|
||||
state: '{{ state_attr("sun.sun", "elevation") }}'
|
||||
name: sun_elevation
|
||||
|
||||
- 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 %}
|
||||
Dawn
|
||||
{% elif (states.sun.sun.attributes.elevation) < -4 %}
|
||||
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