Hi @ all,
I am pretty new to homeassistant and I was able to set up all I want to do - except one little thing.
I need an automation which is carried out cyclically between sunset and 11 pm as soon as nobody is at home.
A helper switch is activated as soon as everyone has left the house and this state lasts longer than 15 minutes.
I used the following time sensor for my EPaper display and I actually wanted to adopt this sensor for my automation. (at least that was the idea)
sensor:
- platform: template
sensors:
epaper_sunset:
friendly_name: "Sonnenuntergang"
value_template: "{{ as_timestamp(strptime(states('sensor.sun_next_setting'), '%Y-%m-%dT%H:%M:%S%z')) | timestamp_custom('%H:%M') }}"
The correct result of this template sensor looks like that:
Problem:
If I want to create the automation in the graphical automation builder, I cannot select the sensor “epaper_sunset”.
Only sensors that belong to the device_class: timestamp are displayed here.
Now I changed the template configuration and I added the device class:
sensor:
- platform: template
sensors:
epaper_sunset:
device_class: timestamp
friendly_name: "Sonnenuntergang"
value_template: "{{ as_timestamp(strptime(states('sensor.sun_next_setting'), '%Y-%m-%dT%H:%M:%S%z')) | timestamp_custom('%H:%M') }}"
Now the sensor is selectable in the dropdown menu of the grafical automation builder, but if I look at the state of the sensor it shows the state unkown:
Unkown state
Screenshot of the automation
I am not able to solve this problem.
Maybe somebody can help me or can suggest a completely different approach.
Many thanks in advanced
Nicole