Open Achronite opened 6 months ago
Curious to which sensors you are thinking of?
Assume you mean adding "stat_cla": "measurement",
to some sensors?
I am testing this already by adding "stat_cla": "measurement",
to some sensors, such as the Smart Plug+
{
"mdl": "Smart Plug+",
"mdlpn": "MIHO005",
"parameters": [
{
"id": "switch",
"component": "switch",
"stat_t": "~@/state",
"cmd_t": "~@/command",
"config": {
"dev_cla": "outlet",
"icon": "mdi:power-socket-uk",
"opt": false
}
},
{
"id": "REAL_POWER",
"component": "sensor",
"stat_t": "~@/state",
"config": {
"stat_cla": "measurement",
"dev_cla": "power",
"unit_of_meas": "W"
}
},
{
"id": "REACTIVE_POWER",
"component": "sensor",
"stat_t": "~@/state",
"config": {
"stat_cla": "measurement",
"dev_cla": "reactive_power",
"unit_of_meas": "var"
}
},
{
"id": "FREQUENCY",
"component": "sensor",
"stat_t": "~@/state",
"config": {
"stat_cla": "measurement",
"val_tpl": "{{ value|round(2) }}",
"dev_cla": "frequency",
"unit_of_meas": "Hz",
"en": "false"
}
},
{
"id": "VOLTAGE",
"component": "sensor",
"stat_t": "~@/state",
"config": {
"stat_cla": "measurement",
"dev_cla": "voltage",
"unit_of_meas": "V",
"en": "false"
}
}
]
}
I have been trying it with eTRV temperatures, by creating a separate sensor for the Room Temperature
{
"id": "Room_Temperature",
"component": "sensor",
"stat_t": "~TEMPERATURE/state",
"config": {
"stat_cla": "measurement",
"dev_cla": "temperature",
"unit_of_meas": "°C"
}
}
Curious to which sensors you are thinking of?
The Current Temperature and Humidity.
I have been trying it with eTRV temperatures, by creating a separate sensor for the Room Temperature
@genestealer Did you try adding them to the Climate entity? Or does it need to be kept separate?
@Achronite The issue is, that Climate entity is not a "sensor" as such, so has no option to enable it's state_class to measurement
enabling its long-term statistics.
The only option at present is to create standalone sensors for Current Temperature and Humidity, with the state_class
of measurement
.
@Achronite are you planning to add Room Temperature to the eTRV for long-term statistics?
{
"id": "Room_Temperature",
"component": "sensor",
"stat_t": "~TEMPERATURE/state",
"config": {
"stat_cla": "measurement",
"dev_cla": "temperature",
"unit_of_meas": "°C"
}
}
Modify the MQTT discovery sections of the devices to capture long-term statistics in HA.
This will allow the entities to capture usage data over time within HA.