Im trying to update my configuration and implementing some dsensores for an ESPHome project. https://community.home-assistant.io/t/use-esphome-with-e-ink-displays-to-blend-in-with-your-home-decor/
Have orderd the components and started working on my sensors in HA, but I’m struggeling to validate my configuration.
In configuration.yaml i got: sensor: !include_dir_list sensors/
and in folder sensors i got: Weatherman_motion.yaml
The content of the file is:
platform: template
sensors:
binary_sensor:
name: "Weatherman Motion Detected"
unique_id: "dfa78de7-d761-425f-9731-86f1af332eac"
device_class: "occupancy"
delay_off: 1min
state: >-
{% if states('binary_sensor.motion_sensor_home_security_motion_detection_3') == 'on' or states('binary_sensor.lumi_lumi_sensor_magnet_73cfb702_on_off') == 'on' %}
on
{% else -%}
off
{% endif -%}
And i have this file Weatherman_trigger.yaml
with content:
platform: template
sensors:
trigger:
weather_condition_now: >
{% set cond_now = states('weather.ring') %}
{% if states('sun.sun') == 'below_horizon' %}
{% if cond_now == 'sunny' %} night {% elif cond_now == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond_now }} {% endif %}
{% else %}
{{ cond_now }}
{% endif %}
weather_condition_0: >
{% set cond0 = state_attr('weather.ring_hourly', 'forecast')[0].condition %}
{% set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %}
{% set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %}
{% set cond0_time = as_timestamp(state_attr('weather.ring_hourly', 'forecast')[0].datetime) %}
{% if cond0_time < next_rising and next_rising < next_setting %}
{% if cond0 == 'sunny' %} night {% elif cond0 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond0 }} {% endif %}
{% else %}
{{ cond0 }}
{% endif %}
weather_temperature_0: >
{{ state_attr('weather.ring_hourly', 'forecast')[0].temperature | round }}'
'
weather_timestamp_0: >
{{ as_timestamp(state_attr('weather.ring_hourly', 'forecast')[0].datetime) | timestamp_custom('%I') | int }} {{ as_timestamp(state_attr('weather.ring_hourly', 'forecast')[0].datetime) | timestamp_custom('%p') }}
weather_condition_1: >
{% set cond1 = state_attr('weather.ring_hourly', 'forecast')[1].condition %}
{% set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %}
{% set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %}
{% set cond1_time = as_timestamp(state_attr('weather.ring_hourly', 'forecast')[1].datetime) %}
{% if cond1_time < next_rising and next_rising < next_setting %}
{% if cond1 == 'sunny' %} night {% elif cond1 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond1 }} {% endif %}
{% else %}
{{ cond1 }}
{% endif %}
weather_temperature_1: >
{{ state_attr('weather.ring_hourly', 'forecast')[1].temperature | round }}
weather_timestamp_1: >
{{ as_timestamp(state_attr('weather.ring_hourly', 'forecast')[1].datetime) | timestamp_custom('%I') | int }} {{ as_timestamp(state_attr('weather.ring_hourly', 'forecast')[1].datetime) | timestamp_custom('%p') }}
weather_condition_2: >
{% set cond2 = state_attr('weather.ring_hourly', 'forecast')[2].condition %}
{% set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %}
{% set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %}
{% set cond2_time = as_timestamp(state_attr('weather.ringv_hourly', 'forecast')[2].datetime) %}
{% if cond2_time < next_rising and next_rising < next_setting %}
{% if cond2 == 'sunny' %} night {% elif cond2 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond2 }} {% endif %}
{% else %}
{{ cond2 }}
{% endif %}
weather_temperature_2: >
{{ state_attr('weather.ring_hourly', 'forecast')[2].temperature | round }}
weather_timestamp_2: >
{{ as_timestamp(state_attr('weather.ring_hourly', 'forecast')[2].datetime) | timestamp_custom('%I') | int }} {{ as_timestamp(state_attr('weather.ring_hourly', 'forecast')[2].datetime) | timestamp_custom('%p') }}
weather_condition_3: >
{% set cond3 = state_attr('weather.ring_hourly', 'forecast')[3].condition %}
{% set next_setting = as_timestamp(state_attr('sun.sun', 'next_setting')) %}
{% set next_rising = as_timestamp(state_attr('sun.sun', 'next_rising')) %}
{% set cond3_time = as_timestamp(state_attr('weather.ringv_hourly', 'forecast')[3].datetime) %}
{% if cond3_time < next_rising and next_rising < next_setting %}
{% if cond3 == 'sunny' %} night {% elif cond3 == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond3 }} {% endif %}
{% else %}
{{ cond3 }}
{% endif %}
weather_temperature_3: >
{{ state_attr('weather.ring_hourly', 'forecast')[3].temperature | round }}
weather_timestamp_3: >
{{ as_timestamp(state_attr('weather.ring_hourly', 'forecast')[3].datetime) | timestamp_custom('%I') | int }} {{ as_timestamp(state_attr('weather.ring_hourly', 'forecast')[3].datetime) | timestamp_custom('%p') }}
The templates is working, but something is wrong in my format?
When i push test configuration it just keep spinning forever…
Kind of frustrating that i cannot figure out the error…