KartoffelToby / better_thermostat

This custom component for Home Assistant will add crucial features to your climate-controlling TRV (Thermostatic Radiator Valves) to save you the work of creating automations to make it smart. It combines a room-temperature sensor, window/door sensors, weather forecasts, or an ambient temperature probe to decide when it should call for heat and automatically calibrate your TRVs to fix the imprecise measurements taken in the radiator's vicinity.
https://better-thermostat.org
GNU Affero General Public License v3.0
736 stars 123 forks source link

Beta-45: some TRV go to maximum heat #670

Closed bsafh closed 1 year ago

bsafh commented 1 year ago

Prerequisites

[climate.trv_ai_schlafzimmer_1] hvac_modes:

{
  "home_assistant": {
    "installation_type": "Home Assistant Supervised",
    "version": "2022.11.4",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.7",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Berlin",
    "os_name": "Linux",
    "os_version": "5.10.0-19-amd64",
    "supervisor": "2022.10.2",
    "host_os": "Debian GNU/Linux 11 (bullseye)",
    "docker_version": "20.10.21",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "hacs": {
      "version": "1.28.3",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    },
    "openweathermap_all": {
      "version": "0.0.1",
      "requirements": [
        "owm2json==0.1.89"
      ]
    },
    "climate_group": {
      "version": "0.4.2",
      "requirements": []
    },
    "holidays": {
      "version": "1.8.0",
      "requirements": [
        "python-dateutil>=2.8.2",
        "holidays>=0.14.2"
      ]
    },
    "openwrt": {
      "version": "0.0.1",
      "requirements": []
    },
    "homematicip_local": {
      "version": "1.21.3",
      "requirements": [
        "hahomematic==2022.11.2"
      ]
    },
    "kodi_media_sensors": {
      "version": "3.8.0",
      "requirements": []
    },
    "truenas": {
      "version": "0.0.0",
      "requirements": []
    },
    "tvh_rec": {
      "version": "0.0.1",
      "requirements": []
    },
    "nodered": {
      "version": "1.1.2",
      "requirements": []
    },
    "browser_mod": {
      "version": "2.1.2",
      "requirements": []
    },
    "kodi_recently_added": {
      "version": "2.0.3",
      "requirements": []
    },
    "better_thermostat": {
      "version": "1.0.0-beta45",
      "requirements": []
    },
    "ferienapidotde": {
      "version": "0.3.0",
      "requirements": [
        "ferien-api==0.3.7"
      ]
    },
    "climate_scheduler": {
      "version": "0.1.0",
      "requirements": []
    },
    "webrtc": {
      "version": "v2.3.1",
      "requirements": []
    },
    "gismeteo": {
      "version": "2.5.0",
      "requirements": []
    },
    "frigate": {
      "version": "3.0.0",
      "requirements": []
    },
    "zha_toolkit": {
      "version": "v0.8.24",
      "requirements": [
        "packaging>=20.8"
      ]
    },
    "reversotts": {
      "version": "1.0.2",
      "requirements": [
        "pyttsreverso==0.4"
      ]
    },
    "tapo_control": {
      "version": "4.1.3",
      "requirements": [
        "pytapo==2.5",
        "onvif-zeep-async==1.2.0"
      ]
    },
    "picotts_remote": {
      "version": "1.0.1",
      "requirements": []
    },
    "smart_thermostat": {
      "version": "2021.11.1",
      "requirements": []
    },
    "scheduler": {
      "version": "v0.0.0",
      "requirements": []
    },
    "dwd_weather": {
      "version": "1.2.24",
      "requirements": [
        "simple_dwd_weatherforecast==1.1.5",
        "markdownify==0.6.5"
      ]
    },
    "shelly": {
      "version": "1.0.2",
      "requirements": [
        "pyShelly==1.0.2",
        "paho-mqtt==1.6.1",
        "websocket-client"
      ]
    },
    "opnsense": {
      "version": "0.1.0",
      "requirements": [
        "mac-vendor-lookup>=0.1.11"
      ]
    },
    "mass": {
      "version": "2022.11.0",
      "requirements": [
        "music-assistant==1.8.7",
        "git+https://github.com/music-assistant/databases@fix-breaking-sqlalchemy-cursor-changes#databases==0.6.2"
      ]
    },
    "dwains_dashboard": {
      "version": "3.3.0",
      "requirements": []
    }
  },
  "integration_manifest": {
    "domain": "better_thermostat",
    "name": "Better Thermostat",
    "documentation": "https://github.com/KartoffelToby/better_thermostat",
    "issue_tracker": "https://github.com/KartoffelToby/better_thermostat/issues",
    "iot_class": "local_push",
    "version": "1.0.0-beta45",
    "config_flow": true,
    "dependencies": [
      "climate",
      "recorder"
    ],
    "after_dependencies": [
      "climate"
    ],
    "codeowners": [
      "@kartoffeltoby",
      "@RubenKelevra"
    ],
    "requirements": [],
    "is_built_in": false
  },
  "data": {
    "info": {
      "name": "TRV_AI_Schlafzimmer_1",
      "temperature_sensor": "sensor.temp_hum_schlafzimmer_3_temperature",
      "window_off_delay": 30,
      "off_temperature": 20,
      "humidity_sensor": "sensor.temp_hum_schlafzimmer_3_humidity",
      "outdoor_sensor": "sensor.temp_hum_terrase_3_temperature",
      "window_sensors": "binary_sensor.fenster_tur_schlafzimmer",
      "weather": "weather.openweathermap",
      "model": "eTRV0100"
    },
    "thermostat": {
      "climate.trv_dannfoss_schlafzimmer_tur_thermostat": {
        "name": "TRV_Dannfoss_Schlafzimmer_T\u00fcr Thermostat",
        "state": "heat",
        "attributes": {
          "hvac_modes": [
            "off",
            "heat"
          ],
          "min_temp": 5.0,
          "max_temp": 35.0,
          "current_temperature": 21.7,
          "temperature": 35.0,
          "hvac_action": "heating",
          "system_mode": "[<SystemMode.Heat: 4>]/heat",
          "occupied_heating_setpoint": 3500,
          "pi_heating_demand": 100,
          "friendly_name": "TRV_Dannfoss_Schlafzimmer_T\u00fcr Thermostat",
          "supported_features": 1,
          "target_temp_step": 0.5
        },
        "bt_config": {
          "calibration": "target_temp_based",
          "heat_auto_swapped": false,
          "fix_calibration": true,
          "calibration_round": false,
          "child_lock": false,
          "homaticip": false
        },
        "bt_adapter": "zha",
        "bt_integration": "zha",
        "model": "eTRV0100"
      }
    },
    "external_temperature_sensor": {
      "entity_id": "sensor.temp_hum_schlafzimmer_3_temperature",
      "state": "19.8",
      "attributes": {
        "state_class": "measurement",
        "unit_of_measurement": "\u00b0C",
        "device_class": "temperature",
        "friendly_name": "Temp_Hum_Schlafzimmer_3 Temperature"
      },
      "last_changed": "2022-11-21T13:17:18.604645+00:00",
      "last_updated": "2022-11-21T13:17:18.604645+00:00",
      "context": {
        "id": "01GJD5C0CCSAYHRC8385A4GB5J",
        "parent_id": null,
        "user_id": null
      }
    },
    "window_sensor": {
      "entity_id": "binary_sensor.fenster_tur_schlafzimmer",
      "state": "off",
      "attributes": {
        "entity_id": [
          "binary_sensor.fenster_tur_5_ias_zone",
          "binary_sensor.fenster_tur_6_ias_zone",
          "binary_sensor.fenster_tur_9_ias_zone"
        ],
        "device_class": "opening",
        "friendly_name": "Fenster T\u00fcr Schlafzimmer"
      },
      "last_changed": "2022-11-21T13:00:26.755324+00:00",
      "last_updated": "2022-11-21T13:00:26.755324+00:00",
      "context": {
        "id": "01GJD4D47X2QF2TX78RBN03M95",
        "parent_id": null,
        "user_id": null
      }
    }
  }
}

Description

Whatever target temperature I set on the BT UI card, the BT climate entity goes up to Maximum (35°C) within seconds.

Same happens when I set the target temp on the real TRV UI card

Steps to Reproduce

  1. set target temperature
  2. wait a few secongs
  3. see target temp on BT climate device an real TRV climate device jump to 35°C

Expected behavior:

target temperature stays on e.g. 19°C

Actual behavior:

TRV are opened to maximum heating and stay there forever

Versions

BT: Beat-45

HA: 2022.11.4

Additional Information

image

bsafh commented 1 year ago

image

(beta-45 installed at 11:20 am 21.11.2022 ...)

image

real TRV:

image

image

temperature near the door to the outside:

image

temperature in the middle of the room (yes, it's really different due to the geometry of that room)

image

daschmidt1994 commented 1 year ago

same problem here

pkalemba commented 1 year ago

i can confirm ,some of my TRV have this problem too

ovizii commented 1 year ago

Happens to me too and I still don't understand the logic behind it as the temperature I set as desired is the only value that should never be changed.

pbranly commented 1 year ago

I agree with you . I have the same issue that I have fixed as described her under . There is something in the code that makes the better thermostat slave or the TRV that should not be possible. There is surely a reason behind …..

my solution: My main master is a Nest thermostat. I have automation for each BT that copy the reference temperature of the Nest inside the better thermostat and copy again this temperature if it changes alone after 5 seconds . This works perfectly but this is really a work around that I am not satisfied for Phil

alias: Transfert consigne Nest vers vanne salon gauche description: "" trigger:

wtom commented 1 year ago

Activate Child Lock or comment out the following lines in the code, fixes the problem. https://github.com/KartoffelToby/better_thermostat/blob/master/custom_components/better_thermostat/events/trv.py#L148:L152

wtom commented 1 year ago

Can someone try, if this fixes the problem? I'm currently not at home and can't test myself. https://github.com/wtom/better_thermostat/commit/9c0d8b12b1cb83f712802bb258165748dcd4e7b2

mahe4 commented 1 year ago

I have the same Problem. This needs to be fixed asap, since it pretty much renders the whole thing unusable. For me it took more than an hour before the temparature was set behind my back. grafik red dot is my manual change. next spike is the automatic change.

RosyRL commented 1 year ago

I had the same problem with my Nedis Thermostats (generic via ZHA). First "workaround" was to set up an automation wich sets the BT Adapter back to my originally set temperature in case it automatically changes. Somehow like pbranly did in a post above ... But: Activating "Child lock" did fix the problem finally. (no need for the automation anymore)

pbranly commented 1 year ago

Happy that you tried my pseudo solution ! Child lock is really a way to prevent that issue . Nevertheless I still can't understand why BT is changed by native TRV. TRV should always be a slave from the BT Child lock is a short term work around .... I hope Phil

RosyRL commented 1 year ago

Yes, directly in the UI. Theres an option called "Ignoriere alle manuellen einstellungen am realen Thermostat (Kindersicherung)" (German) should be something like "ignore all settings on the real TRV (child lock)" in english versions.

mahe4 commented 1 year ago

Yes, directly in the UI. Theres an option called "Ignoriere alle manuellen einstellungen am realen Thermostat (Kindersicherung)" (German) should be something like "ignore all settings on the real TRV (child lock)" in english versions.

yeah i found it since i wrote my comment, thats why i deleted it ^^°

RosyRL commented 1 year ago

Happy that you tried my pseudo solution ! Child lock is really a way to prevent that issue . Nevertheless I still can't understand why BT is changed by native TRV. TRV should always be a slave from the BT Child lock is a short term work around .... I hope Phil

On the other hand: Theres absolutely no need to set the temp at the real TRV when using BT in my opinion. But you are right.

wtom commented 1 year ago

The feature behind that is actually, that you can set the BT target temperature via the real TRV. That's why the child lock prevents this bug to happen.

Somewhere on the if condition is a mistake and that's why the BT target temperature is changed after the TRV target temp is changed by BT. And then the loop begins.

I will try to find the bug tonight.

RosyRL commented 1 year ago

The feature behind that is actually, that you can set the BT target temperature via the real TRV. That's why the child lock prevents this bug to happen.

Somewhere on the if condition is a mistake and that's why the BT target temperature is changed after the TRV target temp is changed by BT. And then the loop begins.

I will try to find the bug tonight.

Didn't know that.. cool feature! will this also work with BT Groups? Using this for my living room with 3 TRV's in one BT

wtom commented 1 year ago

The feature behind that is actually, that you can set the BT target temperature via the real TRV. That's why the child lock prevents this bug to happen.

Somewhere on the if condition is a mistake and that's why the BT target temperature is changed after the TRV target temp is changed by BT. And then the loop begins.

I will try to find the bug tonight.

Didn't know that.. cool feature! will this also work with BT Groups? Using this for my living room with 3 TRV's in one BT

Yes it should also work with groups.

wtom commented 1 year ago

So yes, this seems to fix it for me. Maybe someone else could test it.

682

The problem was, the new setpoint sometimes as a weird float value something like 20.00000023939 but the TRV just reports back then 20.00 and then there is a difference and BT thought, that the TRV was manually changed.

wtom commented 1 year ago

Did someone else test the fix?