Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add-On Restarts or otherwise reverts to temperature of 18 °C #1441

Open
1 task done
dirrgang opened this issue Nov 4, 2024 · 10 comments
Open
1 task done

Add-On Restarts or otherwise reverts to temperature of 18 °C #1441

dirrgang opened this issue Nov 4, 2024 · 10 comments
Assignees
Labels
new bug incoming bug issue

Comments

@dirrgang
Copy link

dirrgang commented Nov 4, 2024

Prerequisites

  • Model name of your Devices

Zigbee-Modell
RBSH-TRV0-ZB-EU
Zigbee-Hersteller
BOSCH
Beschreibung
Radiator thermostat II
Unterstützungsstatus
Unterstützt
IEEE-Addresse
0x18fc2600000c7cf8
Netzwerk-Adresse
0xB9F2 / 47602
Firmware-Datum
20220627
Firmware-Version
3.02.05
Hersteller
Bosch
Modell
BTH-RA

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2024.10.4",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.12.4",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Berlin",
    "os_name": "Linux",
    "os_version": "6.6.54-haos",
    "supervisor": "2024.10.3",
    "host_os": "Home Assistant OS 13.2",
    "docker_version": "27.2.0",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "hacs": {
      "documentation": "https://hacs.xyz/docs/configuration/start",
      "version": "2.0.1",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "battery_notes": {
      "documentation": "https://andrew-codechimp.github.io/HA-Battery-Notes/",
      "version": "2.5.4",
      "requirements": []
    },
    "better_thermostat": {
      "documentation": "https://github.com/KartoffelToby/better_thermostat",
      "version": "1.6.1",
      "requirements": []
    }
  },
  "integration_manifest": {
    "domain": "mqtt",
    "name": "MQTT",
    "codeowners": [
      "emontnemery",
      "jbouwh",
      "bdraco"
    ],
    "config_flow": true,
    "dependencies": [
      "file_upload",
      "http"
    ],
    "documentation": "https://www.home-assistant.io/integrations/mqtt",
    "iot_class": "local_push",
    "quality_scale": "platinum",
    "requirements": [
      "paho-mqtt==1.6.1"
    ],
    "is_built_in": true
  },
  "setup_times": {
    "null": {
      "setup": 1.5740981325507164e-05
    },
    "507735d44302723d0d76268418b845a2": {
      "wait_import_packages": -1.236915681976825,
      "wait_import_platforms": -0.35411177086643875,
      "config_entry_setup": 1.6155338000971824
    }
  },
  "data": {
    "connected": true,
    "mqtt_config": {
      "broker": "core-mosquitto",
      "port": 1883,
      "username": "**REDACTED**",
      "password": "**REDACTED**",
      "discovery": true
    },
}

Description

The set temperature of the climate entity is randomly set to 18 °C. Logs suggest a bug of sorts that restarts the entity or add-on, which is set to 18 °C by default.

Steps to Reproduce

  1. Set temperature other than 18 °C
  2. Wait
  3. Set Temperature changes back to 18 °C

Expected behavior:
Temperature stays at set temperature.

Actual behavior:

Temperature is changed to 18 °C

Versions

"version": "2024.10.4"
BT: 1.6.1

Additional Information

@dirrgang dirrgang added the new bug incoming bug issue label Nov 4, 2024
@cygnusb
Copy link
Contributor

cygnusb commented Nov 8, 2024

Can you please provide:

  • the logs in question
  • Output of State Tab in Z2M of the device
  • MQTT Discovery data of climate device MQTT Info (Payload below climate.yourdevicename)

@auanasgheps
Copy link

I'm facing a different but related issue in #1464

BT does not change the temp in the UI, but the logs show it randomly reads the target temp as 18°C.

@Asakash
Copy link

Asakash commented Nov 18, 2024

I'm facing a similar issue. BT randomly switches target temperature to 5°c. This is also reflected in the UI. But there are no indications that the integration restarted.
It started November 6th out of nowhere. I did not change anything with my setup. I used to have a scheduler running but deactivated it to exclude it as the problem source.

The trigger for the first event that shows the new target temperature seems to be: "trigger_trv_change test".

I have attached a log of the latest occurrence.

2024-11-17 15:02:00.826 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat None: TRV climate.shellytrv_14b457e5bbbe sends new internal temperature from 22.5 to 22.7
2024-11-17 15:02:00.827 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat None: trigger_trv_change test / _old_heating_setpoint: 31.0 - _new_heating_setpoint: 31.0 - _last_temperature: 31.0
2024-11-17 15:02:00.831 DEBUG (MainThread) [custom_components.better_thermostat.utils.helpers] better_thermostat None: climate.shellytrv_14b457e5cbd8 / heating_power_valve_position - temp diff: 2.2 - heating power: 0.0076 - expected valve position: 100%
2024-11-17 15:02:00.831 DEBUG (MainThread) [custom_components.better_thermostat.calibration] better_thermostat None: climate.shellytrv_14b457e5cbd8 - new setpoint calibration: 31.0 | external_temp: 18.8, target_temp: 21.0, trv_temp: 23.2
2024-11-17 15:02:03.836 DEBUG (MainThread) [custom_components.better_thermostat.utils.helpers] better_thermostat None: climate.shellytrv_14b457e5bfc8 / heating_power_valve_position - temp diff: 2.2 - heating power: 0.0076 - expected valve position: 100%
2024-11-17 15:02:03.836 DEBUG (MainThread) [custom_components.better_thermostat.calibration] better_thermostat None: climate.shellytrv_14b457e5bfc8 - new setpoint calibration: 31.0 | external_temp: 18.8, target_temp: 21.0, trv_temp: 23.9
2024-11-17 15:02:06.841 DEBUG (MainThread) [custom_components.better_thermostat.utils.helpers] better_thermostat None: climate.shellytrv_14b457194d9a / heating_power_valve_position - temp diff: 2.2 - heating power: 0.0076 - expected valve position: 100%
2024-11-17 15:02:06.842 DEBUG (MainThread) [custom_components.better_thermostat.calibration] better_thermostat None: climate.shellytrv_14b457194d9a - new setpoint calibration: 31.0 | external_temp: 18.8, target_temp: 21.0, trv_temp: 24.7
2024-11-17 15:02:09.846 DEBUG (MainThread) [custom_components.better_thermostat.utils.helpers] better_thermostat None: climate.shellytrv_14b457e5bbbe / heating_power_valve_position - temp diff: 2.2 - heating power: 0.0076 - expected valve position: 100%
2024-11-17 15:02:09.847 DEBUG (MainThread) [custom_components.better_thermostat.calibration] better_thermostat None: climate.shellytrv_14b457e5bbbe - new setpoint calibration: 31.0 | external_temp: 18.8, target_temp: 21.0, trv_temp: 22.7
2024-11-17 15:02:36.656 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat None: TRV climate.shellytrv_14b457e5cbd8 sends new internal temperature from 23.2 to 23.4
2024-11-17 15:02:36.657 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat None: trigger_trv_change test / _old_heating_setpoint: 31.0 - _new_heating_setpoint: 5.0 - _last_temperature: 31.0
2024-11-17 15:02:36.657 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat None: TRV climate.shellytrv_14b457e5cbd8 decoded TRV target temp changed from 21.0 to 5.0
2024-11-17 15:02:36.669 DEBUG (MainThread) [custom_components.better_thermostat.calibration] better_thermostat None: climate.shellytrv_14b457e5cbd8 - new setpoint calibration: 9.5 | external_temp: 18.8, target_temp: 5.0, trv_temp: 23.4
2024-11-17 15:02:36.670 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat None: TO TRV set_temperature: climate.shellytrv_14b457e5cbd8 from: 31.0 to: 9.5
2024-11-17 15:02:37.024 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat None: climate.shellytrv_14b457e5cbd8 / check_target_temp / _last: 9.5 - _current: 5.0
2024-11-17 15:02:40.028 DEBUG (MainThread) [custom_components.better_thermostat.calibration] better_thermostat None: climate.shellytrv_14b457e5bfc8 - new setpoint calibration: 10.5 | external_temp: 18.8, target_temp: 5.0, trv_temp: 23.9
2024-11-17 15:02:40.029 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat None: TO TRV set_temperature: climate.shellytrv_14b457e5bfc8 from: 31.0 to: 10.5
2024-11-17 15:02:40.702 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat None: climate.shellytrv_14b457e5bfc8 / check_target_temp / _last: 10.5 - _current: 31.0
2024-11-17 15:02:43.707 DEBUG (MainThread) [custom_components.better_thermostat.calibration] better_thermostat None: climate.shellytrv_14b457194d9a - new setpoint calibration: 10.5 | external_temp: 18.8, target_temp: 5.0, trv_temp: 24.7
2024-11-17 15:02:43.708 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat None: TO TRV set_temperature: climate.shellytrv_14b457194d9a from: 31.0 to: 10.5
2024-11-17 15:02:43.873 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat None: climate.shellytrv_14b457194d9a / check_target_temp / _last: 10.5 - _current: 31.0
2024-11-17 15:02:46.876 DEBUG (MainThread) [custom_components.better_thermostat.calibration] better_thermostat None: climate.shellytrv_14b457e5bbbe - new setpoint calibration: 8.5 | external_temp: 18.8, target_temp: 5.0, trv_temp: 22.7
2024-11-17 15:02:46.877 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat None: TO TRV set_temperature: climate.shellytrv_14b457e5bbbe from: 31.0 to: 8.5
2024-11-17 15:02:47.932 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat None: climate.shellytrv_14b457e5bbbe / check_target_temp / _last: 8.5 - _current: 31.0
2024-11-17 15:03:00.197 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat None: TRV climate.shellytrv_14b457e5bfc8 sends new internal temperature from 23.9 to 24.1
2024-11-17 15:03:00.197 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat None: trigger_trv_change test / _old_heating_setpoint: 10.5 - _new_heating_setpoint: 10.5 - _last_temperature: 10.5
2024-11-17 15:03:00.205 DEBUG (MainThread) [custom_components.better_thermostat.calibration] better_thermostat None: climate.shellytrv_14b457e5cbd8 - new setpoint calibration: 9.5 | external_temp: 18.8, target_temp: 5.0, trv_temp: 23.4
2024-11-17 15:03:03.209 DEBUG (MainThread) [custom_components.better_thermostat.calibration] better_thermostat None: climate.shellytrv_14b457e5bfc8 - new setpoint calibration: 10.0 | external_temp: 18.8, target_temp: 5.0, trv_temp: 24.1
2024-11-17 15:03:03.210 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat None: TO TRV set_temperature: climate.shellytrv_14b457e5bfc8 from: 10.5 to: 10.0
2024-11-17 15:03:03.663 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat None: climate.shellytrv_14b457e5bfc8 / check_target_temp / _last: 10.0 - _current: 10.5
2024-11-17 15:03:06.666 DEBUG (MainThread) [custom_components.better_thermostat.calibration] better_thermostat None: climate.shellytrv_14b457194d9a - new setpoint calibration: 10.5 | external_temp: 18.8, target_temp: 5.0, trv_temp: 24.7
2024-11-17 15:03:09.670 DEBUG (MainThread) [custom_components.better_thermostat.calibration] better_thermostat None: climate.shellytrv_14b457e5bbbe - new setpoint calibration: 8.5 | external_temp: 18.8, target_temp: 5.0, trv_temp: 22.7

@antstorm
Copy link

This looks like an issue similar to #1387. The logs show the same trigger_trv_change test as the trigger for the undesired temperature change

@Asakash
Copy link

Asakash commented Nov 20, 2024

That could be the case. I think the two issues are somewhat related but I'm still trying to figure out the root for the problem.
The mentioned event trigger_trv_change test seems to be just a debug log that is always logged when the setpoint of a TRV is changed as it resides in the function trigger_trv_change which happens a lot as the TRVs setpoints are changed frequently to reach the overall target temperature. So it obviously is also logged after the overall target temperature is changed to 5°c (in my case).
I just assumed the problem was a restart of the integration as the default target temperature in the init() function was set to 5°c, but after changing that value to 21°c the random switch to 5°c still happens.
I will just try to debug the root couse a little, which is a bit cumbersome as the problem seems to occure randomly and I cannot reproduce it.

@antstorm
Copy link

@Asakash yeah, I also had a brief look at the source (obviously need to spend more time on it), but from what I can see — the trigger_trv_change test log line appears just before the decoded TRV target temp changed, which suggests that the event was interpreted by BT as an instruction to change the target temperature and it does self.bt_target_temp = _new_heating_setpoint.

So I guess the issue is one of two:

  1. The event is interpreted incorrectly and the target temperature should not have changed
  2. The event is interpreted correctly, but should not have been triggered in the first place

Will also dig a bit more

@Asakash
Copy link

Asakash commented Nov 20, 2024

@antstorm I totally did not see that it overwrites self.bt_target_temp which of course explains why in my case also the UI reflects the change. I really do not yet understand that part as the new_heating_setpoint is taken from the new_state which is the state of one of the real TRVs. So if I understand that correctly it overwrites the overall BT target temperature with the temperature from the current state of one of the TRVs. And if that one for some reason has bogus data, it could explain the behaviour.
I assume that this function is meant to overwrite the overall target temperature, when someone manually changes the temperature at one of the TRVs, as it only triggers when the current temperature of the TRV is not the same as the temperature the same TRV had when it was last updated by BT. If my assumption is correct my problem should be fixable by activating child lock for all TRVs in BT, as the if clause looks for child_lock.

I will add some more debug logs and wait for the next occurence.

@antstorm
Copy link

@Asakash yes, I'm also now trying the child lock via BT. I had previously configured the child lock on my TRVs via their native software (Tado in my case), however that didn't help. Hopefully setting it in BT should prevent the change of the target temperature 🤞

@Asakash
Copy link

Asakash commented Nov 21, 2024

@antstorm I just had the "error" happening again. I added some more logs. One in the function _trigger_trv_change in climate.py which as far as I understand fires the actual event which is then cought in events/trv.py I then print the states in the trv.py.

2024-11-21 19:40:56.359 INFO (MainThread) [custom_components.better_thermostat.climate] triggering trv change with target temp 22.0
2024-11-21 19:40:56.360 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] -------------old state------------
2024-11-21 19:40:56.360 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] <state climate.shellytrv_14b457194d9a=heat; hvac_modes=[<HVACMode.OFF: 'off'>, <HVACMode.HEAT: 'heat'>], min_temp=4, max_temp=31, target_temp_step=0.5, preset_modes=['none', 'Livingroom', 'Livingroom 1', 'Bedroom', 'Bedroom 1', 'Holiday'], current_temperature=26.2, temperature=31.0, hvac_action=heating, preset_mode=none, icon=mdi:radiator, friendly_name=Heizkörper Sofa Groß, supported_features=401 @ 2024-11-20T23:05:48.669418+01:00>
2024-11-21 19:40:56.361 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] -------------new state------------
2024-11-21 19:40:56.361 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] <state climate.shellytrv_14b457194d9a=heat; hvac_modes=[<HVACMode.OFF: 'off'>, <HVACMode.HEAT: 'heat'>], min_temp=4, max_temp=31, target_temp_step=0.5, preset_modes=['none', 'Livingroom', 'Livingroom 1', 'Bedroom', 'Bedroom 1', 'Holiday'], current_temperature=26.1, temperature=5.0, hvac_action=heating, preset_mode=none, icon=mdi:radiator, friendly_name=Heizkörper Sofa Groß, supported_features=401 @ 2024-11-20T23:05:48.669418+01:00>
2024-11-21 19:40:56.362 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] trigger trv change: TRV climate.shellytrv_14b457194d9a: old temp: 31.0, new temp 5.0
2024-11-21 19:40:56.365 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat None: TRV climate.shellytrv_14b457194d9a sends new internal temperature from 26.2 to 26.1
2024-11-21 19:40:56.366 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] TRV climate.shellytrv_14b457194d9a, Old heating setpoint: 31.0
2024-11-21 19:40:56.366 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] TRV climate.shellytrv_14b457194d9a, New heating setpoint: 5.0

As the log shows, the 5.0°c originates in the new state of one of the TRVs. No idea where it comes from. Maybe some sort of overheat protection (as BT sets it to 31°c for a while as my radiators are a bit undersized at the moment). There is no option for something like this in the shelly TRVs but that could be the problem. But he rest is more or less as we suspected.

Switching on child lock in the TRV software will not help as the only reason setting it in BT for the TRVs might solve our/my problem is, that the function to change BT target temp will not fire if child_lock is True as it is part of the if clause.

@antstorm
Copy link

@Asakash yes, it does seem like the issue is originating from a TRV itself (or something else upstream of the BT) without the manual input. Assuming there's no way to distinguish between someone manually turning the TRV and TRVs firmware sending weird data, the only way to fix this is to ignore these inputs altogether. And that's what setting the child_lock in BT seems to do.

I've got child lock set in both TRVs and BT and it seem to be behaving as expected so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new bug incoming bug issue
Projects
None yet
Development

No branches or pull requests

6 participants