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
750 stars 122 forks source link

TRV is not heating any more - TuYa TS0601 #716

Closed jgronowski closed 1 year ago

jgronowski commented 1 year ago

Prerequisites

_TZE200_cwnjrr72

Valve original one,

hvac_modes: heat, auto, off
min_temp: 5
max_temp: 35
target_temp_step: 0.5
preset_modes: none, schedule, manual, boost, complex, comfort, eco
current_temperature: 22.5
temperature: 25.5
preset_mode: complex
friendly_name: gabinet
supported_features: 17
auto_lock: MANUAL
away_mode: OFF
away_preset_days: 1
away_preset_temperature: 18
battery_low: false
boost_time: 300
child_lock: LOCK
comfort_temperature: 21
current_heating_setpoint: 25.5
device: 
applicationVersion: 85
dateCode: ''
friendlyName: gabinet
hardwareVersion: 1
ieeeAddr: '0x9035eafffe2d66af'
manufacturerID: 4098
manufacturerName: _TZE200_cwnjrr72
model: TS0601_thermostat
networkAddress: 45861
powerSource: Battery
stackVersion: 0
type: EndDevice
zclVersion: 3

eco_temperature: 15
force: close
holidays: 
- hour: 6
  minute: 0
  temperature: 21
- hour: 23
  minute: 0
  temperature: 19
- hour: 23
  minute: 2
  temperature: 19
- hour: 23
  minute: 3
  temperature: 19
- hour: 23
  minute: 4
  temperature: 19
- hour: 23
  minute: 5
  temperature: 19

holidays_schedule: 06:00/21°C 23:00/19°C 23:02/19°C 23:03/19°C 23:04/19°C 23:05/19°C
linkquality: 33
local_temperature: 22.5
local_temperature_calibration: 2
max_temperature: 35
min_temperature: 15
position: 0
preset: complex
running_state: idle
system_mode: off
update: 
state: idle

update_available: false
week: 7
window_detection: OFF
window_detection_params: 
minutes: 10
temperature: 5

window_open: false
workdays: 
- hour: 6
  minute: 0
  temperature: 21
- hour: 23
  minute: 0
  temperature: 19
- hour: 23
  minute: 2
  temperature: 19
- hour: 23
  minute: 3
  temperature: 19
- hour: 23
  minute: 4
  temperature: 19
- hour: 23
  minute: 5
  temperature: 19

workdays_schedule: 06:00/21°C 23:00/19°C 23:02/19°C 23:03/19°C 23:04/19°C 23:05/19°C
hvac_action: off
hvac_modes: heat, off
min_temp: 5
max_temp: 35
target_temp_step: 0.5
friendly_name: Smart Gabinet
supported_features: 1
current_temperature: 21
temperature: 22
hvac_action: off
window_open: false
call_for_heat: false
last_change: 2022-11-30T09:23:54.563619
humidity: 46.2
main_mode: off
{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.9.1",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.5",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Warsaw",
    "os_name": "Linux",
    "os_version": "5.15.60",
    "supervisor": "2022.11.2",
    "host_os": "Home Assistant OS 8.5",
    "docker_version": "20.10.14",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "hacs": {
      "version": "1.27.2",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    },
    "solaredge_modbus": {
      "version": "1.4.0",
      "requirements": [
        "pymodbus==1.5.2"
      ]
    },
    "midea_ac": {
      "version": "0.2.3",
      "requirements": [
        "msmart==0.2.3",
        "pycryptodome",
        "pycryptodomex",
        "click"
      ]
    },
    "holidays": {
      "version": "1.8.0",
      "requirements": [
        "python-dateutil>=2.8.2",
        "holidays>=0.14.2"
      ]
    },
    "xiaomi_miio_airpurifier": {
      "version": "2022.8.0.0",
      "requirements": [
        "construct==2.10.56",
        "python-miio>=0.5.12"
      ]
    },
    "fontawesome": {
      "version": "2.1.5",
      "requirements": []
    },
    "irrigation_unlimited": {
      "version": "2022.11.0",
      "requirements": []
    },
    "better_thermostat": {
      "version": "1.0.0-dev",
      "requirements": []
    },
    "ai_thermostat": {
      "version": "0.9.3",
      "requirements": []
    },
    "average": {
      "version": "2.3.0",
      "requirements": []
    },
    "garbage_collection": {
      "version": "4.9.0",
      "requirements": [
        "python-dateutil>=2.8.2"
      ]
    }
  },
  "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-dev",
    "config_flow": true,
    "dependencies": [
      "climate",
      "recorder"
    ],
    "after_dependencies": [
      "climate"
    ],
    "codeowners": [
      "@kartoffeltoby",
      "@RubenKelevra"
    ],
    "requirements": [],
    "is_built_in": false
  },
  "data": {
    "info": {
      "name": "Smart Gabinet",
      "temperature_sensor": "sensor.temp_gabinet_temperature",
      "window_off_delay": 0,
      "off_temperature": 20,
      "humidity_sensor": "sensor.temp_gabinet_humidity",
      "outdoor_sensor": "sensor.temp_zewnetrzny_temperature",
      "window_sensors": "binary_sensor.kontaktron_gabinet_contact",
      "weather": null,
      "model": "TS0601_thermostat"
    },
    "thermostat": {
      "climate.gabinet": {
        "name": "gabinet",
        "state": "off",
        "attributes": {
          "hvac_modes": [
            "heat",
            "auto",
            "off"
          ],
          "min_temp": 5.0,
          "max_temp": 35.0,
          "target_temp_step": 0.5,
          "preset_modes": [
            "none",
            "schedule",
            "manual",
            "boost",
            "complex",
            "comfort",
            "eco"
          ],
          "current_temperature": 22.5,
          "temperature": 25.5,
          "hvac_action": "off",
          "preset_mode": "complex",
          "auto_lock": "MANUAL",
          "away_mode": "OFF",
          "away_preset_days": 1,
          "away_preset_temperature": 18,
          "battery_low": false,
          "boost_time": 300,
          "child_lock": "LOCK",
          "comfort_temperature": 21,
          "current_heating_setpoint": 25.5,
          "device": {
            "applicationVersion": 85,
            "dateCode": "",
            "friendlyName": "gabinet",
            "hardwareVersion": 1,
            "ieeeAddr": "0x9035eafffe2d66af",
            "manufacturerID": 4098,
            "manufacturerName": "_TZE200_cwnjrr72",
            "model": "TS0601_thermostat",
            "networkAddress": 45861,
            "powerSource": "Battery",
            "stackVersion": 0,
            "type": "EndDevice",
            "zclVersion": 3
          },
          "eco_temperature": 15,
          "force": "close",
          "holidays": [
            {
              "hour": 6,
              "minute": 0,
              "temperature": 21
            },
            {
              "hour": 23,
              "minute": 0,
              "temperature": 19
            },
            {
              "hour": 23,
              "minute": 2,
              "temperature": 19
            },
            {
              "hour": 23,
              "minute": 3,
              "temperature": 19
            },
            {
              "hour": 23,
              "minute": 4,
              "temperature": 19
            },
            {
              "hour": 23,
              "minute": 5,
              "temperature": 19
            }
          ],
          "holidays_schedule": "06:00/21\u00b0C 23:00/19\u00b0C 23:02/19\u00b0C 23:03/19\u00b0C 23:04/19\u00b0C 23:05/19\u00b0C",
          "linkquality": 33,
          "local_temperature": 22.5,
          "local_temperature_calibration": 2,
          "max_temperature": 35,
          "min_temperature": 15,
          "position": 0,
          "preset": "complex",
          "running_state": "idle",
          "system_mode": "off",
          "update": {
            "state": "idle"
          },
          "update_available": false,
          "valve_detection": null,
          "week": "7",
          "window_detection": "OFF",
          "window_detection_params": {
            "minutes": 10,
            "temperature": 5
          },
          "window_open": false,
          "workdays": [
            {
              "hour": 6,
              "minute": 0,
              "temperature": 21
            },
            {
              "hour": 23,
              "minute": 0,
              "temperature": 19
            },
            {
              "hour": 23,
              "minute": 2,
              "temperature": 19
            },
            {
              "hour": 23,
              "minute": 3,
              "temperature": 19
            },
            {
              "hour": 23,
              "minute": 4,
              "temperature": 19
            },
            {
              "hour": 23,
              "minute": 5,
              "temperature": 19
            }
          ],
          "workdays_schedule": "06:00/21\u00b0C 23:00/19\u00b0C 23:02/19\u00b0C 23:03/19\u00b0C 23:04/19\u00b0C 23:05/19\u00b0C",
          "friendly_name": "gabinet",
          "supported_features": 17
        },
        "bt_config": {
          "calibration": "local_calibration_based",
          "heat_auto_swapped": false,
          "fix_calibration": true,
          "calibration_round": true,
          "valve_maintenance": false,
          "child_lock": false,
          "homaticip": false
        },
        "bt_adapter": "mqtt",
        "bt_integration": "mqtt",
        "model": "TS0601_thermostat"
      }
    },
    "external_temperature_sensor": {
      "entity_id": "sensor.temp_gabinet_temperature",
      "state": "21.02",
      "attributes": {
        "state_class": "measurement",
        "battery": 81.5,
        "device": {
          "applicationVersion": 5,
          "dateCode": "20201026",
          "friendlyName": "temp_gabinet",
          "hardwareVersion": 1,
          "ieeeAddr": "0x00124b00226b1f9b",
          "manufacturerID": 0,
          "manufacturerName": "eWeLink",
          "model": "SNZB-02",
          "networkAddress": 60343,
          "powerSource": "Battery",
          "type": "EndDevice",
          "zclVersion": 1
        },
        "humidity": 45.05,
        "linkquality": 69,
        "temperature": 21.02,
        "voltage": 2900,
        "unit_of_measurement": "\u00b0C",
        "device_class": "temperature",
        "friendly_name": "temp_gabinet_temperature"
      },
      "last_changed": "2022-11-30T10:25:27.742575+00:00",
      "last_updated": "2022-11-30T10:25:27.742575+00:00",
      "context": {
        "id": "01GK413T5Y1A2B1SHCWBWGTAJA",
        "parent_id": null,
        "user_id": null
      }
    },
    "window_sensor": {
      "entity_id": "binary_sensor.kontaktron_gabinet_contact",
      "state": "off",
      "attributes": {
        "battery": 100,
        "contact": true,
        "device": {
          "applicationVersion": 3,
          "dateCode": "20161128",
          "friendlyName": "kontaktron_gabinet",
          "hardwareVersion": 2,
          "ieeeAddr": "0x00158d0007e0d147",
          "manufacturerID": 4151,
          "manufacturerName": "LUMI",
          "model": "MCCGQ11LM",
          "networkAddress": 43393,
          "powerSource": "Battery",
          "softwareBuildID": "3000-0001",
          "stackVersion": 2,
          "type": "EndDevice",
          "zclVersion": 1
        },
        "device_temperature": 21,
        "linkquality": 81,
        "power_outage_count": 18,
        "temperature": 23,
        "voltage": 3005,
        "device_class": "door",
        "friendly_name": "kontaktron_gabinet_contact"
      },
      "last_changed": "2022-11-30T10:25:29.533566+00:00",
      "last_updated": "2022-11-30T10:25:29.533566+00:00",
      "context": {
        "id": "01GK413VXXTHQ38NRA6MKT5D71",
        "parent_id": null,
        "user_id": null
      }
    }
  }
}

Description

It's not working for quite long period of time already. Even if the temperature is set for a highest, the % of the valve opening is constantly reporting 0%. Even if i will set heat, it is automatically going to OFF state.

wtom commented 1 year ago

you are using the -dev version? can you use beta49?

also what does this sensor send "outdoor_sensor": "sensor.temp_zewnetrzny_temperature"?

jgronowski commented 1 year ago

no i`m not using -dev version i have beta49. outdoor_sensor is a tuya temperature sensor.

state_class: measurement
battery: 83
device: 
applicationVersion: 5
dateCode: '20191205'
friendlyName: temp_zewnetrzny
hardwareVersion: 30
ieeeAddr: '0x00158d0006696d3d'
manufacturerID: 4151
manufacturerName: LUMI
model: WSDCGQ11LM
networkAddress: 38897
powerSource: Battery
softwareBuildID: 3000-0001
stackVersion: 2
type: EndDevice
zclVersion: 1

humidity: 81.17
linkquality: 69
power_outage_count: 142
pressure: 1032.3
temperature: 1.72
voltage: 2975
unit_of_measurement: °C
device_class: temperature
friendly_name: temp_zewnetrzny_temperature
wtom commented 1 year ago

As a quick fix for you, change this to True: https://github.com/KartoffelToby/better_thermostat/blob/master/custom_components/better_thermostat/utils/weather.py#L41

Then we need to find out, what's the problem here.

wtom commented 1 year ago

Can you also post the your logs from the startup?

pbranly commented 1 year ago

hi Not necessary as this is the same issue as https://github.com/KartoffelToby/better_thermostat/issues/712

The quick fix fixed the issue as well on my side Phil

jgronowski commented 1 year ago

As a quick fix for you, change this to True: https://github.com/KartoffelToby/better_thermostat/blob/master/custom_components/better_thermostat/utils/weather.py#L41

Then we need to find out, what's the problem here.

Yes i did and it started to work.

Can you also post the your logs from the startup?

If still need then i will upload today evening.

hi Not necessary as this is the same issue as #712

The quick fix fixed the issue as well on my side Phil

Thanks Phil, it looks like this is a known bug already. Shall we mark this as a duplicate ?

wtom commented 1 year ago

I found it on my system as well. I can reproduce it and i will create a fix. sensor.heizung_aussen has no historic data.

jgronowski commented 1 year ago

The issue can be solved as well by providing instead of external sensor, external weather provider.

wtom commented 1 year ago

I've created a fix. And yes, providing the weather provider would fix it as well. But i also fixed the outdoor sensor code.