t0bst4r / home-assistant-matter-hub

Publish your Home-Assistant Instance using Matter.
Apache License 2.0
146 stars 8 forks source link

[Bug] climate shouldn't set temperature when added #169

Closed librehat closed 42 minutes ago

librehat commented 3 days ago

I have Wiser (Schneider rebranded as Wiser in the UK) thermostats and they're connected to Home Assistant. I noticed that when I add climate.wiser_* devices to the bridge, the rooms that are "off" would be switched on, which is really unexpected.

Debug-level logs:

[ 2024-11-18T16:41:48.014Z ] [ DEBUG ] [ climate.wiser_study / device                       ]: Initializing climate.wiser_study with state:
{
  "entity_id": "climate.wiser_study",
  "state": "off",
  "attributes": {
    "hvac_modes": [
      "auto",
      "heat",
      "off"
    ],
    "min_temp": 5,
    "max_temp": 30,
    "target_temp_step": 0.5,
    "preset_modes": [
      "Advance Schedule",
      "Cancel Overrides",
      "Boost 30m",
      "Boost 1h",
      "Boost 2h",
      "Boost 3h"
    ],
    "current_temperature": 19,
    "temperature": null,
    "current_humidity": 60,
    "hvac_action": "idle",
    "preset_mode": "",
    "name": "Study",
    "window_state": "Unknown",
    "window_detection_active": false,
    "away_mode_supressed": false,
    "heating_type": "HydronicRadiator",
    "number_of_heating_actuators": 0,
    "demand_type": "Modulating",
    "target_temperature_origin": "FromManualMode",
    "is_boosted": false,
    "is_override": false,
    "is_heating": false,
    "is_passive": false,
    "control_output_state": "Off",
    "heating_rate": 1200,
    "boost_time_remaining": 0,
    "percentage_demand": 0,
    "comfort_mode_score": 0,
    "control_direction": "Heat",
    "displayed_setpoint": -20,
    "schedule_id": 5,
    "schedule_name": "Guest Bedroom",
    "current_schedule_temp": 15,
    "next_day_change": "Monday",
    "next_schedule_change": "17:30:00",
    "next_schedule_datetime": "2024-11-18 17:30:00",
    "next_schedule_temp": 21,
    "number_of_trvs": 0,
    "number_of_trvs_locked": 0,
    "is_roomstat_locked": false,
    "icon": "mdi:radiator-off",
    "friendly_name": "Small Bedroom",
    "supported_features": 401
  },
  "last_changed": "2024-11-18T10:18:00.009061+00:00",
  "last_reported": "2024-11-18T16:39:46.145125+00:00",
  "last_updated": "2024-11-18T16:39:46.145125+00:00",
  "context": {
    "id": "01JD029Z714M6QRZ1ZZMTF4S0F",
    "parent_id": null,
    "user_id": null
  }
}
[ 2024-11-18T16:41:48.024Z ] [ DEBUG ] [ matter.js / Transaction                            ]: Transaction initialize<e3570612ab524248a16f2f8988b950de.aggregator.climate_wiser_study>#289 locked e3570612ab524248a16f2f8988b950de.aggregator.climate_wiser_study.identify.state
[ 2024-11-18T16:41:48.043Z ] [ DEBUG ] [ matter.js / Transaction                            ]: Transaction initialize<e3570612ab524248a16f2f8988b950de.aggregator.climate_wiser_study>#289 locked e3570612ab524248a16f2f8988b950de.aggregator.climate_wiser_study.descriptor.state
[ 2024-11-18T16:41:48.049Z ] [ DEBUG ] [ matter.js / Transaction                            ]: Transaction initialize<e3570612ab524248a16f2f8988b950de.aggregator.climate_wiser_study>#289 locked e3570612ab524248a16f2f8988b950de.aggregator.climate_wiser_study.relativeHumidityMeasurement.state
[ 2024-11-18T16:41:48.052Z ] [ DEBUG ] [ matter.js / Transaction                            ]: Transaction initialize<e3570612ab524248a16f2f8988b950de.aggregator.climate_wiser_study>#289 locked e3570612ab524248a16f2f8988b950de.aggregator.climate_wiser_study.thermostat.state
[ 2024-11-18T16:41:48.055Z ] [ DEBUG ] [ matter.js / Transaction                            ]: Transaction reactor<e3570612ab524248a16f2f8988b950de.descriptor.#updatePartsList>#28c locked e3570612ab524248a16f2f8988b950de.descriptor.state
[ 2024-11-18T16:41:48.056Z ] [ DEBUG ] [ matter.js / Transaction                            ]: Transaction reactor<e3570612ab524248a16f2f8988b950de.aggregator.descriptor.#updatePartsList>#28d locked e3570612ab524248a16f2f8988b950de.aggregator.descriptor.state
[ 2024-11-18T16:41:48.067Z ] [ DEBUG ] [ matter.js / Transaction                            ]: Transaction reactor<e3570612ab524248a16f2f8988b950de.descriptor.#updatePartsList>#28c committed and unlocked 1 resource
[ 2024-11-18T16:41:48.069Z ] [ DEBUG ] [ matter.js / Transaction                            ]: Transaction reactor<e3570612ab524248a16f2f8988b950de.aggregator.descriptor.#updatePartsList>#28d committed and unlocked 1 resource
[ 2024-11-18T16:41:48.075Z ] [ DEBUG ] [ matter.js / Transaction                            ]: Transaction initialize<e3570612ab524248a16f2f8988b950de.aggregator.climate_wiser_study>#289 locked e3570612ab524248a16f2f8988b950de.aggregator.climate_wiser_study.bridgedDeviceBasicInformation.state
[ 2024-11-18T16:41:48.091Z ] [ DEBUG ] [ matter.js / Transaction                            ]: Transaction initialize<e3570612ab524248a16f2f8988b950de.aggregator.climate_wiser_study>#289 committed and unlocked 5 resources
[ 2024-11-18T16:41:48.096Z ] [ DEBUG ] [ HomeAssistantClient                                ]: Calling action 'climate.set_temperature' for target {"entity_id":"climate.wiser_study"} with data {"temperature":20}
[ 2024-11-18T16:41:50.055Z ] [ INFO  ] [ matter.js / Endpoint                               ]: e3570612ab524248a16f2f8988b950de.aggregator.climate_wiser_study ready endpoint#: 7 type: Thermostat (0x301) behaviors: ✓identify ✓bridgedDeviceBasicInformation ✓homeAssistant ✓relativeHumidityMeasurement ✓thermostat ✓descriptor

You can see that the current state temperature is null, and state is off, but later on the logs show the bridge is calling an action climate.set_temperature that seems to be what's causing this unexpected behaviour

t0bst4r commented 22 hours ago

Unfortunately Matter forces me to set a target temperature. If this is null, it is autoamtically defaulted to 20 °C. I'll add a another check to not allow changing the target temperature if the device is off. At least this is what Alexa is doing, too.

Can you please validate if your controller (e.g. Goggle Home or Apple Home) has a similar behavior? Can you set temperature when the device is off?

librehat commented 16 hours ago

My controller is SmartThings, and yes I can confirm that it does let me set the heating temperature when it's off.

Another issue that I noticed is that I see both settings for heating and cooling, which seems wrong as there is no cooling capability in this thermostat.

t0bst4r commented 1 hour ago

Can you please post the debug logs when the device is off and you change the temperature. I need to know if its first turned on and then the temperature is set, or if only the "set temperature" command is called.

Regarding the wrong "cooling" capability: this is related to "auto" mode. in matter "auto" requires both "cooling" and "heating". i still need to figure out, what to do.