home-assistant-matter-hub: [Bug] 3.0.0-alpha.19 broke Thermostat

Climate thermostats commands are broken since 3.0.0-alpa.19

Here are the catched errors when trying to poweron or change a temperature from Google Home:

[ 2024-11-07T10:32:14.561Z ] [ ERROR ] [ matter.js / Transaction                            ]: Error post-commit of 8f7ba291df5149adb82cb5badf1bf9f6.aggregator.climate_jeedom_thermostat_salon_thermostat_salon.thermostat.state: Referencing 8f7ba291df5149adb82cb5badf1bf9f6.aggregator.climate_jeedom_thermostat_salon_thermostat_salon.homeAssistant.state: This value is no longer available because its context has exited (1)
  at get value [as value] (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/node/dist/esm/behavior/state/managed/Datasource.js:122:15)
  at descriptor.get [as entity] (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/node/dist/esm/behavior/state/managed/values/StructManager.js:150:49)
  at _HeatingThermostatServer.targetTemperatureChanged (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:2208:42)
  at emitNext (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/util/Observable.js:70:20)
  at BasicObservable.emit (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/util/Observable.js:109:12)
  at emitChanged (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/node/dist/esm/behavior/state/managed/Datasource.js:332:30)
  at Object.postCommit (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/node/dist/esm/behavior/state/managed/Datasource.js:338:12)
  at file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/node/dist/esm/behavior/state/transaction/Tx.js:465:39
  at MaybePromise.then (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/util/Promises.js:100:17)
  at postCommitNextParticipant (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/node/dist/esm/behavior/state/transaction/Tx.js:464:27)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 47 (41 by maintainers)

Commits related to this issue

Most upvoted comments

I have seen that bug with lights, but not with climates. Doesn’t really make sense, but anyway I am currently refactoring the thermostat server, which will lead to some more stability.

min/max setpoint still not working. ( Actual range displayed still -273, 327.5 ) I’m wondering why such extreme values.

-273 C = 0 K = absolute minimum

but of course it should be set instead of defaulting to the limits. Can you please create another issue for that including the attributes of the climate again to have all details for that in one place.

still no running state

I had a chat with one of the developers of matter.js and it doesn’t seem to be a bug on matter side, but on Google and Alexa side. It seems that we are doing the mapping of system mode, running mode and running state correctly, but they just don’t use it. One more question to that: does google home indicate the running mode correctly, when system mode is auto?

Perhaps those attributes are needed too:

AbsMinHeatSetpoinbtLimit AbsMaxHeatSEtpointLimit AbsMinCoolSetpointLimit AbsMaxCoolSetpointLimit

I’ve now added these, too.

Behaviors have errors
      at file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/node/dist/esm/endpoint/properties/Behaviors.js:128:21
      at all (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/util/Construction.js:375:17)
      at file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/util/Construction.js:365:11
      Cause #0: Error initializing 8f7ba291df5149adb82cb5badf1bf9f6.aggregator.climate_duux_threesixty_2.thermostat
        at crash (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/node/dist/esm/behavior/internal/BehaviorBacking.js:48:13)
      Caused by: Validating 8f7ba291df5149adb82cb5badf1bf9f6.aggregator.climate_duux_threesixty_2.thermostat.state: Conformance "HEAT": Matter requires you to set this attribute (128)
        at requireValue (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/node/dist/esm/behavior/state/validation/conformance-compiler.js:300:13)
        at file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/node/dist/esm/behavior/state/validation/conformance.js:13:15
        at file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/node/dist/esm/behavior/state/managed/values/StructManager.js:135:13
        at Object.change (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/node/dist/esm/behavior/state/managed/Datasource.js:155:7)
        at Thermostat$State.set [as occupiedHeatingSetpoint] (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/node/dist/esm/behavior/state/managed/values/StructManager.js:105:32)

For now i have added a fallback to occupied heating setpoint (20°C). Doesn’t really make sense, but let’s try it out. Could be a matter of milliseconds.

I’ve also added a “show details” checkbox in the UI when hovering values. Maybe this helps debugging.

grafik

Just found this in home assistant core code of the climate entity:

    def state(self) -> str | None:
        """Return the current state."""
        hvac_mode = self.hvac_mode
        if hvac_mode is None:
            return None
        # Support hvac_mode as string for custom integration backwards compatibility
        if not isinstance(hvac_mode, HVACMode):
            return HVACMode(hvac_mode).value  # type: ignore[unreachable]
        return hvac_mode.value

so seems to be the same

state possible values are the same as hvac_modes

no it should be ok as it won’t be used anyway… I’m testing now. Thanks

okay thank you. i already released it, can you please test 🙂

i’ll have a look at those three properties later. is it problem to set them like i did?

Maybe someone can explain climate devices to me again 😀

Having those attributes from Home Assistant:

hvac_modes:
  - "off"
  - heat
  - cool
  - heat_cool
  - dry
  - fan_only
min_temp: 16
max_temp: 30
target_temp_step: 1
fan_modes:
  - quiet
  - low
  - medium
  - high
  - turbo
  - auto
current_temperature: 20.1
temperature: 24
min_temp: 10
max_temp: 40
fan_mode: high
last_on_operation: fan_only
device_code: 1400
manufacturer: Samsung
supported_models:
  - Unknown
supported_controller: Broadlink
commands_encoding: Base64
icon: hass:air-conditioner
friendly_name: Family Room AC
supported_features: 393

In matter i have the following required properties:

  • For all climates
    • localTemperature (numeric)
    • systemMode (off, auto, cool, heat, emergency heat, precooling, fanonly, dry, sleep)
    • controlSequenceOfOperation (cooling only, cooling with reheat, heating only, heating with reheat, cooling and heating, cooling and heating with reheat)
  • If supports “Heat”
    • occupiedHeatingSetpoint (numeric)
    • minHeatSetpointLimit (numeric)
    • maxHeatSetpointLimit (numeric)
  • If supports “Cool”
    • occupiedCoolingSetpoint (numeric)
    • minCoolSetpointLimit (numeric)
    • maxHeatSetpointLimit (numeric)
  • If supports “Auto”
    • thermostatRunningMode (off, cool, heat) - to indicate the current mode when system mode is “auto”
    • minSetpointDeadBand (numeric)

Initially i thought i need to set min/max setpoint limits equally to min_temp and max_temp from HA. Now i found the following explanation for minSetpointDeadBand:

On devices which support the AUTO feature, this attribute shall indicate the minimum difference between the Heat Setpoint and the Cool Setpoint.

Refer to Setpoint Limits for constraints. If an attempt is made to set this attribute to a value which conflicts with setpoint values then those setpoints shall be adjusted by the minimum amount to permit this attribute to be set to the desired value. If an attempt is made to set this attribute to a value which is not consistent with the constraints and cannot be resolved by modifying setpoints then a response with the status code CONSTRAINT_ERROR shall be returned.

Can someone please explain in detail HOW the HA attributes shall be mapped to the named matter properties?

As a quick fix i’ll try to set the minSetpointDeadBand to 0, but i assume that’s not right.

i’ll have a look