@riddix/hamh 2.1.0-alpha.522 → 2.1.0-alpha.523

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -168119,12 +168119,13 @@ var OnOffServerBase = class extends OnOffServer {
168119
168119
  return;
168120
168120
  }
168121
168121
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
168122
- const action = turnOn?.(void 0, this.agent) ?? {
168123
- action: "homeassistant.turn_on"
168124
- };
168122
+ const action = turnOn ? turnOn(void 0, this.agent) : { action: "homeassistant.turn_on" };
168123
+ applyPatchState(this.state, { onOff: true });
168124
+ if (!action) {
168125
+ return;
168126
+ }
168125
168127
  logger167.info(`[${homeAssistant.entityId}] Turning ON -> ${action.action}`);
168126
168128
  notifyLightTurnedOn(homeAssistant.entityId);
168127
- applyPatchState(this.state, { onOff: true });
168128
168129
  optimisticOnOffState.set(homeAssistant.entityId, {
168129
168130
  expectedOnOff: true,
168130
168131
  timestamp: Date.now()
@@ -168141,11 +168142,12 @@ var OnOffServerBase = class extends OnOffServer {
168141
168142
  return;
168142
168143
  }
168143
168144
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
168144
- const action = turnOff?.(void 0, this.agent) ?? {
168145
- action: "homeassistant.turn_off"
168146
- };
168147
- logger167.info(`[${homeAssistant.entityId}] Turning OFF -> ${action.action}`);
168145
+ const action = turnOff ? turnOff(void 0, this.agent) : { action: "homeassistant.turn_off" };
168148
168146
  applyPatchState(this.state, { onOff: false });
168147
+ if (!action) {
168148
+ return;
168149
+ }
168150
+ logger167.info(`[${homeAssistant.entityId}] Turning OFF -> ${action.action}`);
168149
168151
  optimisticOnOffState.set(homeAssistant.entityId, {
168150
168152
  expectedOnOff: false,
168151
168153
  timestamp: Date.now()
@@ -170014,8 +170016,15 @@ var humidityConfig3 = {
170014
170016
  var ClimateHumidityMeasurementServer = HumidityMeasurementServer(humidityConfig3);
170015
170017
 
170016
170018
  // src/matter/endpoints/legacy/climate/behaviors/climate-on-off-server.ts
170019
+ init_home_assistant_entity_behavior();
170017
170020
  var ClimateOnOffServer = OnOffServer2({
170018
- turnOn: () => ({ action: "climate.turn_on" }),
170021
+ turnOn: (_value, agent) => {
170022
+ const entity = agent.get(HomeAssistantEntityBehavior).entity;
170023
+ if (entity.state.state !== "off") {
170024
+ return void 0;
170025
+ }
170026
+ return { action: "climate.turn_on" };
170027
+ },
170019
170028
  turnOff: () => ({ action: "climate.turn_off" })
170020
170029
  }).with("Lighting");
170021
170030