Home Assistant: fix device_automation not published when homeassistant is in device options. https://github.com/Koenkk/zigbee2mqtt/issues/7074

This commit is contained in:
Koen Kanters 2021-04-14 20:22:26 +02:00
parent a1fc606d99
commit dff4af94f5

View File

@ -905,8 +905,9 @@ class HomeAssistant extends Extension {
}
async publishDeviceTriggerDiscover(entity, key, value, force=false) {
if (entity.settings.hasOwnProperty('homeassistant') &&
(entity.settings.homeassistant == null || entity.settings.homeassistant.device_automation == null)) {
const haConfig = entity.settings.homeassistant;
if (entity.settings.hasOwnProperty('homeassistant') && (haConfig == null ||
(haConfig.hasOwnProperty('device_automation') && haConfig.device_automation == null))) {
return;
}