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
753 stars 123 forks source link

BT sometimes calculates wrong set point, which is way out of range (x10), and sets BT to max of TRV #760

Closed ismileatyou closed 1 year ago

ismileatyou commented 1 year ago

Prerequisites

{
 {
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.11.4",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.7",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/Riga",
    "os_name": "Linux",
    "os_version": "5.15.61-v8",
    "supervisor": "2022.11.2",
    "host_os": "Home Assistant OS 9.0",
    "docker_version": "20.10.17",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "spotcast": {
      "version": "v3.6.30",
      "requirements": [
        "spotify_token==1.0.0"
      ]
    },
    "nordpool": {
      "version": "0.0.9",
      "requirements": [
        "nordpool>=0.2"
      ]
    },
    "hacs": {
      "version": "1.28.4",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    },
    "better_thermostat": {
      "version": "1.0.0-beta51",
      "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-beta51",
    "config_flow": true,
    "dependencies": [
      "climate",
      "recorder"
    ],
    "after_dependencies": [
      "climate"
    ],
    "codeowners": [
      "@kartoffeltoby",
      "@RubenKelevra"
    ],
    "requirements": [],
    "is_built_in": false
  },
  "data": {
    "info": {
      "name": "Gu\u013camistabas Radiators V2",
      "temperature_sensor": "sensor.guamistabas_t_m_temperature",
      "off_temperature": 20,
      "humidity_sensor": "sensor.guamistabas_t_m_humidity",
      "weather": "weather.home",
      "window_sensors": null,
      "outdoor_sensor": null,
      "window_off_delay": 0,
      "model": "LC-13"
    },
    "thermostat": {
      "climate.living_connect_z_thermostat_heating_3": {
        "name": "Radiator Bed",
        "state": "heat",
        "attributes": {
          "hvac_modes": [
            "heat"
          ],
          "min_temp": 4,
          "max_temp": 28,
          "current_temperature": 22.13,
          "temperature": 20,
          "friendly_name": "Radiator Bed",
          "supported_features": 1
        },
        "bt_config": {
          "calibration": "target_temp_based",
          "calibration_mode": "fix_calibration",
          "calibration_round": true,
          "no_off_system_mode": true,
          "heat_auto_swapped": false,
          "child_lock": false,
          "homaticip": false
        },
        "bt_adapter": "zwave_js",
        "bt_integration": "zwave_js",
        "model": "LC-13"
      }
    },
    "external_temperature_sensor": {
      "entity_id": "sensor.guamistabas_t_m_temperature",
      "state": "22.13",
      "attributes": {
        "state_class": "measurement",
        "unit_of_measurement": "\u00b0C",
        "device_class": "temperature",
        "friendly_name": "Gu\u013camistabas T/M Temperature"
      },
      "last_changed": "2022-12-14T11:40:47.678228+00:00",
      "last_updated": "2022-12-14T11:40:47.678228+00:00",
      "context": {
        "id": "01GM86ZT5Y97NBKW34106MAJC9",
        "parent_id": null,
        "user_id": null
      }
    },
    "window_sensor": "-"
  }
}
}

Description

Sometimes BT sets TRV to 28 (which is max supported on this model), from logs looks like it tried to set it to 2000.0 instead of 20.0

2022-12-14 12:32:29.911 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Ofisa Radiators v2: trigger_trv_change / _old_heating_setpoint: 20.0 - _new_heating_setpoint: 20.0 - _last_temperature: 20.0 2022-12-14 12:32:32.357 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Guļamistabas Radiators V2: trigger_trv_change / _old_heating_setpoint: 20.0 - _new_heating_setpoint: 2000.0 - _last_temperature: 20.0 2022-12-14 12:32:32.357 WARNING (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Guļamistabas Radiators V2: New TRV climate.living_connect_z_thermostat_heating_3 setpoint outside of range, overwriting it 2022-12-14 12:32:32.366 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Guļamistabas Radiators V2: TRV climate.living_connect_z_thermostat_heating_3 decoded TRV target temp changed from 20.0 to 28 2022-12-14 12:32:32.617 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Dzīvojamās Istabas Radiators V2: trigger_trv_change / _old_heating_setpoint: 20.0 - _new_heating_setpoint: 20.0 - _last_temperature: 20.0

Steps to Reproduce

unknown

Expected behavior:

Actual behavior:

Versions

HA: 2022.11.4 BT: Beta 51

Additional Information

wtom commented 1 year ago

It's not BT. Your TRV sends back 2000.0

trigger_trv_change / _old_heating_setpoint: 20.0 - _new_heating_setpoint: 2000.0 - _last_temperature: 20.0

This is the event when the TRV reports a change.

Why it's sending the value 100 times higher, we need to find out.

wtom commented 1 year ago

Anything new on this?

ismileatyou commented 1 year ago

Hi, I still see this issue, now on different TRV:

2023-01-16 16:50:39.689 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat Dzīvojamās Istabas Radiators V2: climate.living_connect_z_thermostat_heating_2 / check_target_temp / _last: 21.5 - _current: 22.0 2023-01-16 16:50:39.753 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Ofisa Radiators v2: trigger_trv_change / _old_heating_setpoint: 23.5 - _new_heating_setpoint: 2350.0 - _last_temperature: 23.5 2023-01-16 16:50:39.753 WARNING (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Ofisa Radiators v2: New TRV climate.living_connect_z_thermostat_heating setpoint outside of range, overwriting it 2023-01-16 16:50:39.768 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Ofisa Radiators v2: TRV climate.living_connect_z_thermostat_heating decoded TRV target temp changed from 23.5 to 28 2023-01-16 16:50:40.691 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat Dzīvojamās Istabas Radiators V2: climate.living_connect_z_thermostat_heating_2 / check_target_temp / _last: 21.5 - _current: 22.0 2023-01-16 16:50:41.693 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat Dzīvojamās Istabas Radiators V2: climate.living_connect_z_thermostat_heating_2 / check_target_temp / _last: 21.5 - _current: 22.0

TRV that I use is Danfoss LC-13. This TRV does not expose it's temperature sensor (current temperature). To make it work with this integration, I am using automation, which on each external temperature sensor change, calls python script: https://github.com/bieniu/ha-thermostat-update/blob/08d0fc6359a80c86c00642889726132b8c538320/python_scripts/thermostat_update.py

This updates real TRV in Home Assistant with value from external sensor. Maybe this is causing this?

KartoffelToby commented 1 year ago

Think this is the issue