🐜 Bug description
When creating a Sensor, we set a number of properties. Here’s a good example from the docs
const power = synapse.sensor({
context,
name: "Living Room Power",
device_class: "power",
unit_of_measurement: "W",
state: 120.5,
state_class: "measurement"
});
state_class is important to Home Assistant. I believe this value is needed so a sensor can be added to long term statistics tables. Without it, sensor values are lost depending on the value of purge in config.yaml.
📠 Reproduction steps
Running the above code does indeed produce a sensor in HA. But looking in Developer Tools, States, allows us to see the properties of it. state_class is not listed there.
🎙️ Additional details
May be useful. Sensor.service.mts doesn’t seem to be including state_class.
const generate = synapse.generator.create<Generic, SensorEvents>({
context,
domain: "sensor",
load_config_keys: [
"device_class",
"state",
"unit_of_measurement",
// conditional
"last_reset",
"suggested_display_precision",
"suggested_unit_of_measurement",
]
🐜 Bug description
When creating a Sensor, we set a number of properties. Here’s a good example from the docs
state_class is important to Home Assistant. I believe this value is needed so a sensor can be added to long term statistics tables. Without it, sensor values are lost depending on the value of purge in config.yaml.
📠 Reproduction steps
Running the above code does indeed produce a sensor in HA. But looking in Developer Tools, States, allows us to see the properties of it. state_class is not listed there.
🎙️ Additional details
May be useful. Sensor.service.mts doesn’t seem to be including state_class.
const generate = synapse.generator.create<Generic, SensorEvents>({
context,
domain: "sensor",
load_config_keys: [
"device_class",
"state",
"unit_of_measurement",
// conditional
"last_reset",
"suggested_display_precision",
"suggested_unit_of_measurement",
]