I’ve created a sensor in yaml using template integration, with a state_class and unit_of_measurement. However the data does not go into long-term-storage. Data from other sensors, like a Zigbee temperature sensor, do go into LTS, so I do not think it is a problem with the record/history integration itself.
What change do I need to make to have my sensor data go into LTS?
Below I’ve attached my configuration.
heatpump_package.yaml:
template:
- sensor:
name: "Ecodan Daily COP"
unique_id: "ecodan_dailycop"
state: "{{ ((state_attr('sensor.ecodan', 'DailyHeatingEnergyProduced')|float) / (state_attr('sensor.ecodan', 'DailyHeatingEnergyConsumed')|float)) | round(2) }}"
availability: "{{ (state_attr('sensor.ecodan', 'DailyHeatingEnergyProduced')|is_number) and (state_attr('sensor.ecodan', 'DailyHeatingEnergyConsumed')|is_number) }}"
unit_of_measurement: "x"
state_class: measurement
configuration.yaml:
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
# Text to speech
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
homeassistant:
packages:
melcloud_package: !include melcloud_package.yaml
heatpump_package: !include heatpump_package.yaml
History: LTS works for some sensors, but not the template sensor
I’m on the latest version of HomeAssistant:
- Core 2025.3.1
- Supervisor 2025.03.2
- Operating System 14.2
- Frontend 20250306.0
3 posts - 1 participant