To start with I’m running the versions listed below (might be relevant in the future when this shows up in searches) :
Home Assistant 2023.5.3
Supervisor 2023.04.1
Operating System 10.1
Frontend 20230503.3 - latest
The issue I have is that when I have an analog sensor I can get the values in a history graph, but when I look at a binary sensor all I get is “No state history found.”
Both are defined in the same file in the “templates” directory.
So this definition gives me a nice little history graph:
- sensor:
- name: "Price for current hour"
unique_id: price_for_current_hour
unit_of_measurement: "Öre"
state: >
{% set allPrices = state_attr('sensor.all_average_today','hours') %}
{% set currentPrice = ( allPrices[now().hour].1 ) %}
{{ currentPrice }}
However this definition don’t give me any history graph (OK, it would just be on/off, but whatever)
- binary_sensor:
- name: "Price below set limit heater"
unique_id: price_below_set_limit_heater
state: >
{% set currPrice = states('sensor.price_for_current_hour') | float %}
{% set limitPrice = states('input_number.fripris_elpatron') | float %}
{% set freePrice = ( currPrice <= limitPrice ) | bool %}
{{ freePrice }}
Any ideas what’s up, or am I trying to do something that won’t work?