mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-28 05:24:29 +00:00
Add support for Home Assistant energy statistics (#8187)
* Add support for Home Assistant energy statistics * Correct timestamp * darn quotes
This commit is contained in:
@@ -458,7 +458,12 @@ class HomeAssistant extends Extension {
|
||||
voltage_phase_c: {
|
||||
device_class: 'voltage', enabled_by_default: false, state_class: 'measurement',
|
||||
},
|
||||
energy: {device_class: 'energy'},
|
||||
energy: {
|
||||
device_class: 'energy',
|
||||
state_class: 'measurement',
|
||||
last_reset_topic: true,
|
||||
last_reset_value_template: '1970-01-01T00:00:00+00:00',
|
||||
},
|
||||
smoke_density: {icon: 'mdi:google-circles-communities', state_class: 'measurement'},
|
||||
gas_density: {icon: 'mdi:google-circles-communities', state_class: 'measurement'},
|
||||
pm25: {icon: 'mdi:air-filter', state_class: 'measurement'},
|
||||
@@ -821,6 +826,10 @@ class HomeAssistant extends Extension {
|
||||
}
|
||||
}
|
||||
|
||||
if (payload.last_reset_topic) {
|
||||
payload.last_reset_topic = stateTopic;
|
||||
}
|
||||
|
||||
if (payload.position_topic) {
|
||||
payload.position_topic = stateTopic;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user