In configuration.yaml I have defined:
homeassistant:
customize: !include customize.yaml
packages:
eh800: !include eh800.yaml
In eh800.yaml I have defined my command line sensors like this:
command_line:
- sensor:
name: Ouman EH800 - Delayed room temp measurement
command: 'curl "http://192.168.1.8/request?S_262_85" | cut -d ''='' -f 2 | cut -d '';'' -f 1'
unit_of_measurement: "°C"
unique_id: sensor.ouman_eh800_delayed_room_temp_measurement
state_class: measurement
device_class: temperature
Because state_class is defined, sensor can now be recognized e.g. by statistc graph card.
However, it only keeps history of 10 days.
I then tried to define the sensor as this in eh800.yaml:
command_line:
- sensor:
name: Ouman EH800 - Delayed room temp measurement
command: 'curl "http://192.168.1.8/request?S_262_85" | cut -d ''='' -f 2 | cut -d '';'' -f 1'
unit_of_measurement: "°C"
unique_id: sensor.ouman_eh800_delayed_room_temp_measurement
…leaving the rest to be defined in customize.yaml (documentation tells to use that for customizations)
sensor.ouman_eh800_delayed_room_temp_measurement:
state_class: measurement
device_class: temperature
…with no avail. Still the history is only 10 days.
How to change this behaviour? I need to log these values basically for years
Hmmm. When taking a look on my other sensors, they all seem to be having all their history stored - whether they are temperature, humidity, pressure, ESP sensors, or anything, EXECPT these command line sensors.
I have 2 separate Rasp Pi4:s running their own systems, and basically they behave the same.
Both are using mariadb as a recorder, the other one:
recorder:
db_url: !secret maria_access
and the other:
recorder:
db_url: !secret maria_access_h
purge_keep_days: 35
…still the history is stored basically forever in both of these…
Both systems also have influxdb configured like this example:
influxdb:
host: !secret influxdb_host
port: !secret influxdb_port
database: !secret influxdb_database
username: !secret influxdb_username
password: !secret influxdb_password
max_retries: 3
default_measurement: state
…pretty confused…
Any idea:
- why my other sensors are stored forever, as according to instructions they should be purged after 10 days? (I’m not complaining, that’s OK)
- why the command line sensors are not stored over 10 days?
- how can is make my command line sensors to be stored forever
Surely someone knows this stuff?
EDIT: What comes to other sensors showing all the history, I checked these, and they do have state_class
defined, which should be enough to make them LTS.
However, the problem to get my command line sensor defined as LTS still stays… Even though they also get state_class
defined, they seem not to collect LTS data
EDIT2: This might be a bug and has been reported: command line sensors with state_class set do not collect LTS · Issue #100498 · home-assistant/core · GitHub
Thanks for advice @123