This commit is contained in:
Koen Kanters
2019-09-29 14:35:05 +02:00
parent 7507ad6dcb
commit c8eb503ae7
10 changed files with 59 additions and 81 deletions
+2 -2
View File
@@ -239,7 +239,7 @@ class Controller {
this.callExtensionMethod('onMQTTMessage', [topic, message]);
}
async publishEntityState(IDorName, payload) {
async publishEntityState(IDorName, payload, stateChangeReason=null) {
const entity = this.zigbee.resolveEntity(IDorName);
if (!entity || !entity.settings) {
logger.error(`'${IDorName}' does not exist, skipping publish`);
@@ -251,7 +251,7 @@ class Controller {
const newState = objectAssignDeep.noMutate(currentState, payload);
// Update state cache with new state.
this.state.set(entity.settings.ID, newState);
this.state.set(entity.settings.ID, newState, stateChangeReason);
if (settings.get().advanced.cache_state) {
// Add cached state to payload