From ca7bb0cd4d734c4a9c2f9e80f5f00eb3820c0cee Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Tue, 19 Oct 2021 16:56:31 +0200 Subject: [PATCH] Attempt to fix Home Assistant error when running_state is unknown. https://github.com/Koenkk/zigbee2mqtt/issues/9219 --- lib/extension/homeassistant.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/extension/homeassistant.ts b/lib/extension/homeassistant.ts index 2a33d770..592a7b3c 100644 --- a/lib/extension/homeassistant.ts +++ b/lib/extension/homeassistant.ts @@ -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}] }}`; }