Added support to report back to HA via MQTT when a Scene is executed, so that following device_automations gets executed.

This will make Plejd Scene execution behave the same from Plejd App, Plejd Hardware and Home Assistant Scene triggered - in the eyes of Home Assistant
This commit is contained in:
faanskit 2021-05-20 13:49:44 +02:00
parent 9cf3b3bdd6
commit 93eca16639

View file

@ -76,6 +76,15 @@ class PlejdAddon extends EventEmitter {
// we're triggering a scene, lets do that and jump out.
// since scenes aren't "real" devices.
this.sceneManager.executeScene(uniqueId);
// since the scene doesn't get any updates on whether it's executed or not,
// we fake this by directly send the sceneTriggered back to HA in order for
// it continue to acto on the scene (for non-plejd devices).
try {
this.mqttClient.sceneTriggered(uniqueId);
} catch (err) {
logger.error('Error in PlejdService.sceneTriggered callback', err);
}
return;
}