Closed mStirner closed 1 month ago
In the endpoint item construction (class.endpoint.js), add a .emit(...) inside the state update callback: https://github.com/OpenHausIO/backend/blob/dbf499ec68eb4ab7d4204ab21efea51133fe824c/components/endpoints/class.endpoint.js#L66-L83
.emit(...)
to
// see 407 & 420 this.states = obj.states.map((item) => { return new State(item, () => { try { // feedback scope.logger.verbose(`Value in endpoint ("${obj._id}") state ("${item._id}") changed: ${item.alias}=${item.value}`); // notify listener event changed scope.emit("state", item); // update item in database //await scope.update(this._id, this); updater(); } catch (err) { scope.logger.warn(err, `Could not update item (${obj._id}) state ("${item._id}") in database: ${item.alias}=${item.value}`); } }); });
In the endpoint item construction (class.endpoint.js), add a
.emit(...)
inside the state update callback: https://github.com/OpenHausIO/backend/blob/dbf499ec68eb4ab7d4204ab21efea51133fe824c/components/endpoints/class.endpoint.js#L66-L83to