Attempt to fix Home Assistant error when running_state is unknown. https://github.com/Koenkk/zigbee2mqtt/issues/9219

This commit is contained in:
Koen Kanters
2021-10-19 16:56:31 +02:00
parent 158341a9ff
commit ca7bb0cd4d
+2 -1
View File
@@ -216,9 +216,10 @@ export default class HomeAssistant extends Extension {
const state = firstExpose.features.find((f) => f.name === 'running_state');
if (state) {
discoveryEntry.mockProperties.push(state.property);
discoveryEntry.discovery_payload.action_topic = true;
discoveryEntry.discovery_payload.action_template = `{% set values = ` +
`{'idle':'off','heat':'heating','cool':'cooling','fan only':'fan'}` +
`{None:None,'idle':'off','heat':'heating','cool':'cooling','fan only':'fan'}` +
` %}{{ values[value_json.${state.property}] }}`;
}