I have been moving my template sensors from the yaml files into the Helpers versions. I am having problems with the History_stats in Helpers. The ‘state’ field will only accept ‘unavailable’ or ‘unknown.’ If I type in a valid state for the entity, it doesn’t stick. Examining the entity in Developer Tools shows the correct state and of course the original yaml sensor has always worked.
Show the YAML.
# Today's heat pump heating on time.
- platform: history_stats
name: BH_HP_Heating
entity_id: sensor.bh_hp_hvac_action
state: "heating"
type: duration
unique_id: bh_hp_heating
start: "{{ now().replace(hour=0, minute=0, second=0) }}"
end: "{{ now() }}"