Git Product home page Git Product logo

kartoffeltoby / better_thermostat Goto Github PK

View Code? Open in Web Editor NEW
696.0 27.0 122.0 1.7 MB

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.

Home Page: https://better-thermostat.org

License: GNU Affero General Public License v3.0

Python 97.07% SCSS 2.30% Shell 0.63%
sensor climate home-assistant thermostat hacs zigbee2mqtt zigbee smarthome spzb0001 ts0601

better_thermostat's Introduction

Active installations GitHub issues Version - 1.5.1 Discord hacs_badge

Better Thermostat

For more info visit: https://better-thermostat.org/

Requirements

  • Minimum required Home Assistant version: 2022.8.0 (Latest tested version: 2024.1.0)

Companion UI

We've created a companion UI element which can display more information than the default thermostat element in Home Assistant. Check it out via HACS: better-thermostat-ui-card

  • If you have a question or need help please create a new discussion or check if your question is already answered
  • If you have a suggestion, found a bug, or want to add a new device or function create a new issue
  • If you want to contribute to this project create a new pull request

Features

This integration brings some smartness to your connected radiator thermostats setup:

  • Uses a temperature sensor far away from the radiators to measure the real room temperature
  • Makes your TRVs fully compatible with Google Home
  • Let your windows disable your heating (avoid programming this via an automation)
  • Your weather forecast provider will turn your heat on/off
  • Or an outside air temperature sensor can do this as well
  • Does some valve maintenance automatically, to avoid them getting stuck closed over the summer
  • Group multiple TRVs to one (e.g. for a room with multiple radiators)
  • Enhance the default TRV Algorithm with some smartness to reduce energy consumption

Which hardware do we support?

We support all thermostats which are compatible with Home Assistant as long as they are shown up as a climate entity

Integrations that are tested

  • Zigbee2Mqtt
  • Deconz
  • Tado
  • generic_thermostat

How to setup

Install this integration via HACS or copy the files from the latest release

Configuration details can be found in the documentation or on our website: better-thermostat.org

Some nice-to-know config tips for the configuration.yaml

Example Window/Door - Sensor config

group:
  livingroom_windows:
    name: Livingroom Windows
    icon: mdi:window-open-variant
    all: false
    entities:
      - binary_sensor.openclose_1
      - binary_sensor.openclose_2
      - binary_sensor.openclose_3

Combine multiple TRV to one (Group)

No worry, Better Thermostat supports grouping out of the box


Contributing?

checkout the CONTRIBUTING.md file

☕ Support

If you want to support this project, you can ☕ buy a coffee here.

better_thermostat's People

Contributors

arough007 avatar bruvv avatar bueeler avatar cycor avatar dasadi avatar erichouet avatar felixhaeberle avatar fettlaus avatar iamkotu avatar jirifurda avatar kartoffeltoby avatar koseduhemak avatar leocal avatar michaelmior avatar misa1515 avatar moohan avatar nikdevx avatar nindtendo avatar nliaudat avatar oliverbutler avatar pablocamp0s avatar rubenkelevra avatar steipel avatar techhummel avatar thoemy avatar tomcat86878 avatar ukeha avatar virtualm2000 avatar wtom avatar xx7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

better_thermostat's Issues

Thermostat doesn't turn to 'heating' after closing the window.

TS0601

Thermostat goes to 'off' after the window is opened but doesn't turn back to 'heating' after closing the window.

EDIT: It does turn the heating on when I close the window before the valve closes completely but when the window is opened for a longer period it stays in 'off' setting after closing it.

my config:

  - platform: ai_thermostat
    name: sypialnia
    thermostat: climate.kaloryfer_sypialnia
    temperature_sensor: sensor.ble_temperature_sypialnia
    window_sensors: binary_sensor.okno_sypialnia
    weather: weather.home #if this is set, the outdoor_sensor is ignored, remove the outdoor_sensor config!
#    outdoor_sensor: sensor.outdoor_temperature #if you want to use it, remove the weather config!
    off_temperature: 20
    window_off_delay: 0
    valve_maintenance: true

Use an outside air temperature sensor instead of weather

I like to use a real sensor instead of a calculated forecast value for the outside temperature... is it possible to implement that as an optional way additionally to the weather entity?

It would also allow the system to know the outside temperature even if the internet connection fails, which is kind of important if you think about power/telephone line/internet outages in storms.

Would the custom component work even if the weather entity is malfunctioning?

flickering of target temperature

I'm seeing a lot of up/down/up/down several degrees on the target temperature set in ai thermostat - while I haven't changed it more than say 3-4 times in the last 24 hours.

So something in ai thermostat itself is causing a lot of changes and then changes back onto to real set temperature.

These are sent to the real thermostat as well, which is probably the reason one of my thermostats crashed again.

real thermostat

air temperature

ai_thermostat

Stopped working after last update

Prerequisites

  • [ Eurotronic SPZB0001 ] Model name of your Devices from Zigbee2Mqtt
  • Output from Home Assistent Developer Tools state e.g.
hvac_modes: off, auto, heat
min_temp: 5
max_temp: 30
target_temp_step: 0.5
current_temperature: 24.5
temperature: 5
hvac_action: heating
battery: 75
battery_low: false
boost: false
child_protection: false
current_heating_setpoint: 5
device: 
applicationVersion: 22
dateCode: '20191014'
friendlyName: Thermo_Hall
hardwareVersion: 35
ieeeAddr: '0x00158d0003c46f75'
manufacturerID: 4151
manufacturerName: Eurotronic
model: SPZB0001
networkAddress: 34283
powerSource: Battery
softwareBuildID: '22190930'
stackVersion: 5
type: EndDevice
zclVersion: 2

error_status: 0
eurotronic_error_status: 0
eurotronic_host_flags: 
boost: false
child_protection: false
mirror_display: false
window_open: true

eurotronic_system_mode: 17
eurotronic_trv_mode: 2
linkquality: 63
local_temperature: 24.5
local_temperature_calibration: 2
mirror_display: false
occupied_heating_setpoint: 5
pi_heating_demand: 0
running_state: heat
system_mode: off
trv_mode: null
unoccupied_heating_setpoint: 16
update: 
state: idle

update_available: false
valve_position: null
window_open: false
friendly_name: Thermo_Hall
supported_features: 1

Description

Can't set mode and adjust the temperature. In debug log I see a lot of:

2021-12-07 10:45:11 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat entity not ready or device is currently not supported
2021-12-07 10:45:11 DEBUG (MainThread) [custom_components.ai_thermostat.climate] fatal math.ceil() takes exactly one argument (2 given)
2021-12-07 10:45:11 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat entity not ready or device is currently not supported
2021-12-07 10:45:11 DEBUG (MainThread) [custom_components.ai_thermostat.climate] fatal math.ceil() takes exactly one argument (2 given)
2021-12-07 10:45:17 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat entity not ready or device is currently not supported
2021-12-07 10:45:17 DEBUG (MainThread) [custom_components.ai_thermostat.climate] fatal math.ceil() takes exactly one argument (2 given)
2021-12-07 10:45:17 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat entity not ready or device is currently not supported
2021-12-07 10:45:17 DEBUG (MainThread) [custom_components.ai_thermostat.climate] fatal math.ceil() takes exactly one argument (2 given)
2021-12-07 10:46:45 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat entity not ready or device is currently not supported
2021-12-07 10:46:45 DEBUG (MainThread) [custom_components.ai_thermostat.climate] fatal math.ceil() takes exactly one argument (2 given)
2021-12-07 10:46:47 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat entity not ready or device is currently not supported
2021-12-07 10:46:47 DEBUG (MainThread) [custom_components.ai_thermostat.climate] fatal math.ceil() takes exactly one argument (2 given)
2021-12-07 10:46:52 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat entity not ready or device is currently not supported
2021-12-07 10:46:52 DEBUG (MainThread) [custom_components.ai_thermostat.climate] fatal math.ceil() takes exactly one argument (2 given)

Options "include_device_information" and "legacy" are enabled.
Everything worked fine until the last update.

Steps to Reproduce

Just update component to the latest 0.7.9 version.

Expected behavior:

To make everything work properly.

Actual behavior:

Can't manage my TRVs.

Versions

HA: 2021.11.5
Z2M: 1.22.1-1

Additional Information

add support for offlabel Moes thermostats

Hey Toby,

this thermostat works exactly like the Moes you already support (with the weird heat/auto hack to get a forced open thermostat). So your custom component currently does not apply the "patch" necessary, which means turning the heat on will lead to a forced open thermostat.

Here's the Zigbee device info:

    "device": {
        "applicationVersion": 85,
        "dateCode": "",
        "hardwareVersion": 1,
        "manufacturerID": 4098,
        "manufacturerName": "_TZE200_cwnjrr72",
        "model": "TS0601_thermostat",
        "networkAddress": 58962,
        "powerSource": "Battery",
        "stackVersion": 0,
        "type": "EndDevice",
        "zclVersion": 3
    },

And it is reporting via MQTT to HA as the following device:

device:
  identifiers:
    - zigbee2mqtt_0x1234567....
  manufacturer: TuYa
  model: Radiator valve with thermostat (TS0601_thermostat)

For this info you don't need to activate the device info flag in Zigbee2MQTT :)

Bind two thermostats

I would like to specify two thermostats for one entity of this custom component. I think that's currently not possible, right?

Window sensor should be optional

I feel like window sensor should be optional - people without window sensors should still be able to use this.

Also the readme indicates that a group is required - I guess a single binarity sensor should suffice as well, correct? If so, I would propose to change the description accordingly

friendlyName vs friendly_name

In the source you are using friendly_name for the mqtt identifier, but I renamed all my radiators in HA, so they don't match, causing an error in z2m

  zigbee2mqtt/Veranda Radiator 1/set/current_heating_setpoint>12.5
  zigbee2mqtt/bridge/log>{"message":{"friendly_name":"Veranda Radiator 1"},"type":"entity_not_found"}
  zigbee2mqtt/bridge/logging>{"level":"error","message":"Entity 'Veranda Radiator 1' is unknown"} 

Looking at the attributes there is another attribute that matches the z2m name: friendlyName, maybe that one is the correct one?


hvac_modes: heat, auto, off
min_temp: 5
max_temp: 35
target_temp_step: 0.5
preset_modes: none, away, schedule, manual, boost, complex, comfort, eco
current_temperature: 15.5
temperature: 12
preset_mode: manual
auto_lock: MANUAL
away_mode: OFF
away_preset_days: 1
away_preset_temperature: 15
battery_low: false
boost_time: 300
child_lock: UNLOCK
comfort_temperature: 20
current_heating_setpoint: 12
device:
applicationVersion: 85
dateCode: ''
friendlyName: Veranda Radiator
hardwareVersion: 1
ieeeAddr: '0x804b50fffe219220'
manufacturerID: 4098
manufacturerName: _TZE200_cwnjrr72
model: TS0601_thermostat
networkAddress: 1462
powerSource: Battery
stackVersion: 0
type: EndDevice
zclVersion: 3

eco_temperature: 15
force: close
holidays:

  • hour: 6
    minute: 0
    temperature: 20
  • hour: 8
    minute: 0
    temperature: 15
  • hour: 11
    minute: 30
    temperature: 15
  • hour: 12
    minute: 30
    temperature: 15
  • hour: 17
    minute: 30
    temperature: 20
  • hour: 22
    minute: 0
    temperature: 15

linkquality: 39
local_temperature: 15.5
local_temperature_calibration: 0
max_temperature: 35
min_temperature: 5
position: 0
preset: manual
system_mode: off
update_available: null
valve_detection: null
week: 5+2
window_detection: OFF
window_detection_params:
minutes: 10
temperature: 5

workdays:

  • hour: 6
    minute: 0
    temperature: 20
  • hour: 8
    minute: 0
    temperature: 15
  • hour: 11
    minute: 30
    temperature: 15
  • hour: 12
    minute: 30
    temperature: 15
  • hour: 17
    minute: 30
    temperature: 20
  • hour: 22
    minute: 0
    temperature: 15

friendly_name: Veranda Radiator 1
supported_features: 17

TS0601 - NoneType object has no attribute 'system_mode'

TS0601

I saw this one before, but now I have "include_device_information: true" included in z2m config in supervisor.

Ten błąd pochodzi z niestandardowej integracji.

Logger: custom_components.ai_thermostat.models.models
Source: /config/custom_components/ai_thermostat/models/models.py:18 
Integration: ai_thermostat (documentation, issues) 
First occurred: 20:20:55 (1 occurrences) 
Last logged: 20:20:55

ai_thermostat: can't read the device model of TVR, Enable include_device_information in z2m or checkout issue #1
NoneType: None

And the second one:

Ten błąd pochodzi z niestandardowej integracji.

Logger: homeassistant
Source: custom_components/ai_thermostat/climate.py:484 
Integration: ai_thermostat (documentation, issues) 
First occurred: 20:20:55 (1 occurrences) 
Last logged: 20:20:55

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/ai_thermostat/climate.py", line 484, in _async_tvr_changed
    self._hvac_mode  = remappedstate.system_mode
AttributeError: 'NoneType' object has no attribute 'system_mode'

Can't find entitiy still retry log messages

Continuing the problem: #1
p.s. I wrote in a closed issue because I thought that it would be more correct to lead one problem in one issue. I'm sorry.

hvac_modes:
  - auto
  - 'off'
  - cool
  - heat
  - dry
  - fan_only
min_temp: 5
max_temp: 35
target_temp_step: 0.5
preset_modes:
  - none
  - programming
  - manual
  - temporary_manual
  - holiday
current_temperature: 35.5
temperature: 35
preset_mode: manual
battery: 83
boost_heating: 'OFF'
boost_heating_countdown: 0
boost_heating_countdown_time_set: 300
child_lock: LOCK
current_heating_setpoint: 35
device:
  applicationVersion: 64
  dateCode: ''
  friendlyName: trv_children
  hardwareVersion: 1
  ieeeAddr: '0x84fd27fffea664aa'
  manufacturerID: 4098
  manufacturerName: _TZE200_b6wax7g0
  model: BRT-100-TRV
  networkAddress: 7544
  powerSource: Battery
  stackVersion: 0
  type: EndDevice
  zclVersion: 3
eco_mode: 'OFF'
eco_temperature: 20
last_seen: '2021-11-26T07:19:05.657Z'
linkquality: 123
local_temperature: 35.5
local_temperature_calibration: 0
max_temperature: 45
min_temperature: 5
position: 0
preset: manual
program_saturday:
  saturday: '6h:0m 24°C,  12h:0m 23°C,   14h:30m 22°C,  17h:30m 21°C '
program_sunday:
  sunday: '  6h:0m 19°C,  12h:30m 20°C,  14h:30m 21°C,  18h:30m 20°C '
program_weekday:
  weekday: ' 6h:0m 20°C,  11h:30m 21°C,  13h:30m 22°C,  17h:30m 23°C '
update_available: null
window: CLOSED
window_detection: 'OFF'
friendly_name: trv_children
supported_features: 17
hvac_modes:
  - auto
  - 'off'
  - cool
  - heat
  - dry
  - fan_only
min_temp: 5
max_temp: 35
target_temp_step: 0.5
preset_modes:
  - none
  - programming
  - manual
  - temporary_manual
  - holiday
current_temperature: 32
temperature: 29
preset_mode: manual
battery: 100
boost_heating: 'OFF'
boost_heating_countdown: 0
boost_heating_countdown_time_set: 300
child_lock: LOCK
current_heating_setpoint: 29
device:
  applicationVersion: 64
  dateCode: ''
  friendlyName: trv_cabinet
  hardwareVersion: 1
  ieeeAddr: '0xcc86ecfffeb800b8'
  manufacturerID: 4098
  manufacturerName: _TZE200_b6wax7g0
  model: BRT-100-TRV
  networkAddress: 664
  powerSource: Battery
  stackVersion: 0
  type: EndDevice
  zclVersion: 3
eco_mode: 'OFF'
eco_temperature: 20
last_seen: '2021-11-26T07:34:52.636Z'
linkquality: 33
local_temperature: 32
local_temperature_calibration: 0
max_temperature: 45
min_temperature: 5
position: 25
preset: manual
program_saturday:
  saturday: '6h:0m 24°C,  12h:0m 23°C,   14h:30m 22°C,  17h:30m 21°C '
program_sunday:
  sunday: '  6h:0m 19°C,  12h:30m 20°C,  14h:30m 21°C,  18h:30m 20°C '
program_weekday:
  weekday: ' 6h:0m 20°C,  11h:30m 21°C,  13h:30m 22°C,  17h:30m 23°C '
update_available: null
window: CLOSED
window_detection: 'OFF'
friendly_name: trv_cabinet
supported_features: 17

My config is:

  - platform: ai_thermostat
    name: ai_children
    thermostat: climate.trv_children
    temperature_sensor: sensor.temperature_humidity_hall_temperature
    window_sensors: group.fake_windows
    outdoor_sensor: sensor.temperature_humidity_outdoors_temperature
    off_temperature: 15
    window_off_delay: 20
    valve_maintenance: false

  - platform: ai_thermostat
    name: ai_cabinet
    thermostat: climate.trv_cabinet
    temperature_sensor: sensor.temperature_humidity_cabinet_temperature
    window_sensors: group.fake_windows
    outdoor_sensor: sensor.temperature_humidity_outdoors_temperature
    off_temperature: 15
    window_off_delay: 20
    valve_maintenance: false

Description

Bought two more BRT-100-TRV, connected to z2m and on HA reboot errors (HA startup time: 30-45 seconds):

Logger: custom_components.ai_thermostat.models.models
Source: /config/custom_components/ai_thermostat/models/models.py:17
Integration: ai_thermostat (documentation, issues)
First occurred: 10:14:09 (1 occurrences)
Last logged: 10:14:09
ai_thermostat: can't read the device model of TVR, Enable include_device_information in z2m or checkout issue #1
NoneType: None

Logger: custom_components.ai_thermostat.models.models
Source: /config/custom_components/ai_thermostat/models/models.py:42
Integration: ai_thermostat (documentation, issues)
First occurred: 10:14:10 (1 occurrences)
Last logged: 10:14:10
ai_thermostat: can't read the device model of TVR, Enable include_device_information in z2m or checkout issue #1
NoneType: None

Tried:

  1. Reinstall the integration.
  2. Reconnected BRT-100-TRV to z2m
  3. include_device_information = false -> Reboot HA -> true
  4. Rename TRV
  5. Connect one at a time

p.s. I have two more thermostats just like that, no problem with them. I don't see any difference between them. (config issues #25)

Versions

TRV Model: BRT-100-TRV
Z2M Version: 1.22.0-3
HA Version: 2021.11.5
ai_thermostat version: 0.6.0

GS361A-H04 New device

Prerequisites

hvac_modes:

  • 'off'
  • auto
  • heat
    min_temp: 15
    max_temp: 30
    target_temp_step: 1
    current_temperature: 27.6
    temperature: 28
    hvac_action: None
    away_mode: 'OFF'
    battery: 100
    child_lock: UNLOCK
    current_heating_setpoint: 28
    device:
    applicationVersion: 73
    dateCode: '20180727'
    friendlyName: XYZ
    hardwareVersion: 1
    ieeeAddr: '0x0000000000000'
    manufacturerID: 0
    manufacturerName: _TYST11_zivfvd7h
    model: GS361A-H04
    networkAddress: 61100
    powerSource: Battery
    stackVersion: 0
    type: EndDevice
    zclVersion: 3
    linkquality: 69
    local_temperature: 27.6
    position: null
    preset: manual
    running_state: null
    system_mode: heat
    valve_detection: 'OFF'
    window_detection: 'OFF'
    friendly_name: XYZ
    supported_features: 1

DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat entity not ready

Versions

HA: core-2021.11.5
Z2M: 1.22.0-3

TS0601 cannot activate heat mode or change temperature

I'm using the TuYa 0601.

My config looks like this:

  - platform: ai_thermostat
    name: "x's Room"
    thermostat: climate.heating_thermostat_x_s_room
    temperature_sensor: sensor.air_x_s_room_temperature
    window_sensors: group.xs_doors_and_windows
    window_off_delay: 15
    outdoor_sensor: sensor.air_outdoor_temperature
    off_temperature: 16
    valve_maintenance: false

When the valve is off and I tap on the heat button of AI Thermostat nothing happens.

If I activate manual+auto on the "real" thermostat in HA AI Thermostat will take the values and show the thermoset as heating.

If I change the target temperature in the AI Thermostat the real and the ai thermostat will be set to off.

I'm using version 0.6 of AI Thermostat.

Timer for window/door sensor

Hey,

Could you please add a timer option for the door/window sensor? And only if the timer expires force the valve to close.

Regards and thx for this Project

UX improvements

Hey Toby,

currently the "virtual" thermostat shows the lowest temperature possible on an overswing protection event:

IMG_20211129_113449.jpg

And off if a window / door gets opened:

IMG_20211129_113459.jpg

I would like to give an improvement idea:

While I don't want my radiators to heat while the window is open it is confusing to me that the virtual thermostat goes off if that happens.

I like them to show always my set temperature and my heat on/off status and maybe a message right next to it which tells me that it's not gonna heat right now since a window is open.

This way I can turn it on/off and directly see why it's off instead of clicking on heat and nothing happens, because the window is open.

Switch from changing local_temperature_calibration to just change the current_heating_setpoint

It's quite a while since I tinkered with the thermostats, but I think I tried setting the local_temperature_calibration instead of the setpoint for the thermostat.

IIRC the thermostat will basically reset its PID algorithm if you change the local_temperature_calibration. Resetting the PID algorithm will not work in our favor, as it basically eliminates any knowledge of the past.

I was just doing this calculation with the local temperature and the temperature the sensor in the room was providing:

round.ceil( (target_temperature - air_temperature + local_valve_temperature), 1)

So rounding up to 1 digit behind the dot. So for example 20.33333 will be 20.4 degrees.

TS0601 support: 'HVAC_MODE_OFF' is not defined

Version 0.5.1 throws this error if I try to do anything with this custom component with my TS0601 thermostats.


Logger: homeassistant
Source: custom_components/ai_thermostat/models/TS0601_thermostat/remap.py:14
Integration: ai_thermostat (documentation, issues)
First occurred: 21:01:58 (13 occurrences)
Last logged: 21:28:41

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/ai_thermostat/climate.py", line 388, in _async_tvr_changed
    remappedstate = convert_inbound_states(self,new_state.attributes)
  File "/config/custom_components/ai_thermostat/models/models.py", line 28, in convert_inbound_states
    return TS0601_thermostat_inbound(self,state)
  File "/config/custom_components/ai_thermostat/models/TS0601_thermostat/remap.py", line 14, in TS0601_thermostat_inbound
    return cleanState(state.get('current_heating_setpoint'),state.get('local_temperature'),state.get('local_temperature_calibration'),HVAC_MODE_OFF,True)
NameError: name 'HVAC_MODE_OFF' is not defined

TS0601 does not use normal calibration

Why is TS0601 not using normal calibration even though local_temperature_calibration is available?
Wouldn't that be better?

Prerequisites

hvac_modes:

  • heat
  • auto
  • 'off'
    min_temp: 15
    max_temp: 30
    target_temp_step: 0.5
    preset_modes:
  • none
  • away
  • schedule
  • manual
  • boost
  • complex
  • comfort
  • eco
    current_temperature: 24.5
    temperature: 25
    preset_mode: manual
    auto_lock: MANUAL
    away_mode: 'OFF'
    away_preset_days: 1
    away_preset_temperature: 16
    battery_low: false
    boost_time: 300
    child_lock: UNLOCK
    comfort_temperature: 24
    current_heating_setpoint: 25
    device:
    applicationVersion: 87
    dateCode: ''
    friendlyName: XYZ
    hardwareVersion: 1
    ieeeAddr: '0x000000000000000'
    manufacturerID: 4098
    manufacturerName: _TZE200_ckud7u2l
    model: TS0601_thermostat
    networkAddress: 54818
    powerSource: Battery
    stackVersion: 0
    type: EndDevice
    zclVersion: 3
    eco_temperature: 15
    force: normal
    holidays:
  • hour: 6
    minute: 0
    temperature: 20
  • hour: 8
    minute: 0
    temperature: 15
  • hour: 11
    minute: 29
    temperature: 15
  • hour: 12
    minute: 30
    temperature: 15
  • hour: 17
    minute: 29
    temperature: 20
  • hour: 22
    minute: 0
    temperature: 15
    linkquality: 150
    local_temperature: 24.5
    local_temperature_calibration: 0
    max_temperature: 30
    min_temperature: 15
    position: 0
    preset: manual
    system_mode: auto
    update:
    state: idle
    update_available: false
    valve_detection: null
    week: '7'
    window_detection: 'OFF'
    window_detection_params:
    minutes: 0
    temperature: 73
    workdays:
  • hour: 4
    minute: 0
    temperature: 27
  • hour: 20
    minute: 0
    temperature: 23
  • hour: 22
    minute: 1
    temperature: 22
  • hour: 23
    minute: 2
    temperature: 22
  • hour: 23
    minute: 3
    temperature: 22
  • hour: 23
    minute: 4
    temperature: 22
    friendly_name: XYZ
    supported_features: 17

Valve maintenance

If a valve is held shut for an extended period of time, it will get sticky. So if the thermostat opens it, it will eventually release with a "piling" noise - or not move at all.

I found a solution to fix this issue (if it's already occurring):

  • Open the valve fully
  • wait a minute
  • close it again
  • open the valve fully
  • wait a minute
  • close it again.

Repeat this once a day for two-three weeks and the sticky valve issue is fixed.

To keep this issue from happening again I automated this for doing it once a week at a random time.

I would like to see this feature added to this custom component. Basically, if you configure it, it will assume a sticky valve and do the daily cycle for three weeks and then reduce it to once a week at a random time.

On startup the heater target temperature is used without checking for calibration_type == 0

When I restart home assistant all the set temperatures are off because it takes the value from the real climate instance without checking for the calibration_type

self._target_temp = float(self.hass.states.get(self.heater_entity_id).attributes.get('current_heating_setpoint'))

--

in the same vein, could we get an option to disable _async_tvr_changed, I have no use for reverse syncing the valve states, it just causes weird issues.

Another thing, the window close 'converted_hvac_mode = self.beforeClosed' will be fired every time async_control_heating is called because beforeClosed is never reset to OFF

And a small request, can we get a is_device_active based on the valve position, it's nice to see idle/heating when it is actually doing something.
my tweak:

        valve = self.hass.states.get(self.heater_entity_id).attributes.get('position')
        if check_float(valve):
            valve = float(valve)
        else:
            valve = 101
...
        elif state_heat:
            return state_heat and (valve > 0)
        elif state_auto:
            return state_auto and (valve > 0)

ps. If you are really bored, can you add self._name to all log lines, I update those every update so I can debug easier.

Tuya Climate - not working at all

Prerequisites

Problem with sensors not working at all.

  - platform: ai_thermostat
    name: igorek
    thermostat: climate.0x5c0272fffedab233
    temperature_sensor: sensor.temp_sypialnia
{
    "auto_lock": "AUTO",
    "away_mode": "OFF",
    "away_preset_days": 1,
    "away_preset_temperature": 15,
    "battery_low": false,
    "boost_time": 300,
    "child_lock": "LOCK",
    "comfort_temperature": 22,
    "current_heating_setpoint": 22,
    "eco_temperature": 15,
    "force": "normal",
    "holidays": [
        {
            "hour": 6,
            "minute": 0,
            "temperature": 20
        },
        {
            "hour": 8,
            "minute": 0,
            "temperature": 15
        },
        {
            "hour": 11,
            "minute": 30,
            "temperature": 15
        },
        {
            "hour": 12,
            "minute": 30,
            "temperature": 15
        },
        {
            "hour": 17,
            "minute": 30,
            "temperature": 20
        },
        {
            "hour": 22,
            "minute": 0,
            "temperature": 15
        }
    ],
    "linkquality": 162,
    "local_temperature": 22.5,
    "local_temperature_calibration": 0.5,
    "max_temperature": 25,
    "min_temperature": 15,
    "position": 65,
    "preset": "schedule",
    "system_mode": "auto",
    "update": {
        "state": "idle"
    },
    "update_available": false,
    "week": "7",
    "window_detection": "ON",
    "window_detection_params": {
        "minutes": 37,
        "temperature": 12
    },
    "workdays": [
        {
            "hour": 6,
            "minute": 0,
            "temperature": 22
        },
        {
            "hour": 8,
            "minute": 0,
            "temperature": 22
        },
        {
            "hour": 11,
            "minute": 30,
            "temperature": 22
        },
        {
            "hour": 12,
            "minute": 30,
            "temperature": 22
        },
        {
            "hour": 17,
            "minute": 30,
            "temperature": 22
        },
        {
            "hour": 22,
            "minute": 0,
            "temperature": 21
        }
    ]
Zigbee2MQTT version
1.22.0 commit: unknown
Coordinator type
zStack3x0
Coordinator revision
20201026
Frontend version
0.6.30

Description

Problem with sensors not working at all.
I started from simple config, but termostat is in unknown state, even if receiving updates.
I tried to change entity from the temperature to put as a device name only but as well with temperature addition.
In both cases it's not working.
Specifiying settings not exist, im not able to push to the legacy mode

TS601 devices, SonOff SNZB-02

Actual behavior:

Not working at all, unknown state of the new climate sensor

Versions

Latest
CC2652.Slaeh
Home Assistant OS 6.6
supervisor-2021.10.8
core-2021.11.5

Arround 70 devices in the network

AI Thermostat is not changing the local_temperature_calibration

Prerequisites

  • Model name of your Devices from Zigbee2Mqtt
    Eurotronic SPZB0001 Version:
    Firmware Datum
    20191014
    Firmware Version
    22190930
  • Output from Home Assistent Developer Tools state e.g.
hvac_modes:
  - 'off'
  - auto
  - heat
min_temp: 5
max_temp: 30
target_temp_step: 0.5
current_temperature: 23
temperature: 23
hvac_action: 'off'
battery: 100
battery_low: false
current_heating_setpoint: 23
device:
  applicationVersion: 22
  dateCode: '20191014'
  friendlyName: Phil Zimmer
  hardwareVersion: 35
  ieeeAddr: '0x00158d00030ca874'
  manufacturerID: 4151
  manufacturerName: Eurotronic
  model: SPZB0001
  networkAddress: 65403
  powerSource: Battery
  softwareBuildID: '22190930'
  stackVersion: 5
  type: EndDevice
  zclVersion: 2
eurotronic_error_status: 0
eurotronic_host_flags:
  boost: false
  child_protection: false
  mirror_display: false
  window_open: false
eurotronic_system_mode: 1
last_seen: '2021-12-13T12:05:59.423Z'
linkquality: 54
local_temperature: 23
local_temperature_calibration: 0
occupied_heating_setpoint: 23
pi_heating_demand: 100
running_state: idle
system_mode: auto
trv_mode: null
unoccupied_heating_setpoint: 16
update:
  state: idle
update_available: false
valve_position: null
friendly_name: Phil Zimmer
supported_features: 1

Description

AI T. is never changing the local_temperature_calibration, even though I can change it manually with MQTT or through the z2m interface. It takes a few seconds to change, but it works.
The log:

`2021-12-13 08:40:22 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat: avg outdoor temp: 4

2021-12-13 08:40:22 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: False Mode: auto Setted: heat hasmode: True Calibration: -4.1 - send: True settemp: 22 curtemp: 19.4 Model: SPZB0001 Calibration type: 0 Winter: True TRV: Phil Zimmer

2021-12-13 08:42:22 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat: avg outdoor temp: 4

2021-12-13 08:42:22 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: False Mode: auto Setted: heat hasmode: True Calibration: -4.1 - send: True settemp: 22 curtemp: 19.4 Model: SPZB0001 Calibration type: 0 Winter: True TRV: Phil Zimmer

2021-12-13 08:43:22 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat: avg outdoor temp: 4

2021-12-13 08:43:22 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: False Mode: auto Setted: heat hasmode: True Calibration: -4.1 - send: True settemp: 22 curtemp: 19.4 Model: SPZB0001 Calibration type: 0 Winter: True TRV: Phil Zimmer

2021-12-13 08:44:22 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat: avg outdoor temp: 4

2021-12-13 08:44:22 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: False Mode: auto Setted: heat hasmode: True Calibration: -4.1 - send: True settemp: 22 curtemp: 19.4 Model: SPZB0001 Calibration type: 0 Winter: True TRV: Phil Zimmer

2021-12-13 08:45:22 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat: avg outdoor temp: 4

2021-12-13 08:45:22 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: False Mode: auto Setted: heat hasmode: True Calibration: -4.1 - send: True settemp: 22 curtemp: 19.4 Model: SPZB0001 Calibration type: 0 Winter: True TRV: Phil Zimmer

2021-12-13 08:48:22 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat: avg outdoor temp: 4

2021-12-13 08:48:22 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: False Mode: auto Setted: heat hasmode: True Calibration: -4.0 - send: True settemp: 22 curtemp: 19.5 Model: SPZB0001 Calibration type: 0 Winter: True TRV: Phil Zimmer

2021-12-13 08:50:22 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat: avg outdoor temp: 4

2021-12-13 08:50:22 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: False Mode: auto Setted: heat hasmode: True Calibration: -4.0 - send: True settemp: 22 curtemp: 19.5 Model: SPZB0001 Calibration type: 0 Winter: True TRV: Phil Zimmer`

In addition, with the climate entity AI T. is providing, I am able to control the TRV just fine. Just the setting of the local_temperature_calibration is not working as intended, and I don't have any idea why. It looks like the calculation of the offset value is working, but z2m is never reaching any instructions to send the offset to the TRV.

That is working:

service: mqtt.publish
data:
  topic: z2m/Phil Zimmer/set
  payload: |
    {
      "local_temperature_calibration":-2
    }

Versions

HA Version: 2021.12
Z2M Version: 1.22.1-1

Additional Information

Is it something obvious I am missing out? I have legacy support everywhere enabled.

If you know something what I could try, please let me know, and thanks in advance.

Possible issue with version number

HACS permanently shows an available update for AI Thermostat for Zigbee2MQTT. It states "You are running version v0.1.0-beta, version v0.1.0-beta is available" and updating doesn't clear the HACS update notification.

AttributeError: 'NoneType' object has no attribute 'state'

Continued - #43
Two TVRs work, two don't.
There is an error when starting HA:

2021-12-05 15:25:30 DEBUG (MainThread) [custom_components.ai_thermostat.climate] Undefined target temperature, falling back to 5.0
2021-12-05 15:25:40 INFO (MainThread) [custom_components.ai_thermostat.climate] Starting ai_thermostat for ai_bedroom with version: 0.7.8 waiting for entity to be ready...
2021-12-05 15:25:45 INFO (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat ai_bedroom still waiting for sensor.temperature_humidity_hall_temperature to be available
2021-12-05 15:25:45 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/ai_thermostat/climate.py", line 309, in startUp
if trv_state or trv_state.state in (
AttributeError: 'NoneType' object has no attribute 'state'
====== Restart AI THERMOSTAT ======
2021-12-05 15:26:54 INFO (MainThread) [custom_components.ai_thermostat.climate] Starting ai_thermostat for ai_bedroom with version: 0.7.8 waiting for entity to be ready...
2021-12-05 15:26:54 DEBUG (MainThread) [custom_components.ai_thermostat.climate] Undefined target temperature, falling back to 5.0
2021-12-05 15:26:59 INFO (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat ai_bedroom still waiting for sensor.temperature_humidity_hall_temperature to be available
2021-12-05 15:26:59 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/ai_thermostat/climate.py", line 309, in startUp
if trv_state or trv_state.state in (
AttributeError: 'NoneType' object has no attribute 'state'

It doesn't work:

hvac_modes:
  - auto
  - 'off'
  - cool
  - heat
  - dry
  - fan_only
min_temp: 5
max_temp: 35
target_temp_step: 0.5
preset_modes:
  - none
  - programming
  - manual
  - temporary_manual
  - holiday
current_temperature: 27
temperature: 22
preset_mode: manual
battery: 75
boost_heating: 'OFF'
boost_heating_countdown: 0
boost_heating_countdown_time_set: 100
child_lock: LOCK
current_heating_setpoint: 22
device:
  applicationVersion: 64
  dateCode: ''
  friendlyName: trv_bedroom
  hardwareVersion: 1
  ieeeAddr: '0x84fd27fffe8c3d13'
  manufacturerID: 4098
  manufacturerName: _TZE200_b6wax7g0
  model: BRT-100-TRV
  networkAddress: 35585
  powerSource: Battery
  stackVersion: 0
  type: EndDevice
  zclVersion: 3
eco_mode: 'OFF'
eco_temperature: 18
last_seen: '2021-12-05T14:23:23.281Z'
linkquality: 66
local_temperature: 27
local_temperature_calibration: 0
max_temperature: 35
min_temperature: 5
position: 0
preset: manual
program_saturday:
  saturday: '6h:0m 24°C,  12h:0m 23°C,   14h:30m 22°C,  17h:30m 21°C '
program_sunday:
  sunday: '  6h:0m 19°C,  12h:30m 20°C,  14h:30m 21°C,  18h:30m 20°C '
program_weekday:
  weekday: ' 6h:0m 20°C,  11h:30m 21°C,  13h:30m 22°C,  17h:30m 23°C '
programming_mode: >-
  06:00/20°C  11:30/21°C  13:30/22°C  17:30/23°C  06:00/24°C  12:00/23°C 
  14:30/22°C  17:30/21°C  06:00/19°C  12:30/20°C  14:30/21°C  18:30/20°C
update:
  state: idle
update_available: false
window: CLOSED
window_detection: 'OFF'
friendly_name: trv_bedroom
supported_features: 17
  - platform: ai_thermostat
    name: ai_bedroom
    thermostat: climate.tvr_bedroom
    temperature_sensor: sensor.temperature_humidity_hall_temperature

It works:

hvac_modes:
  - auto
  - 'off'
  - cool
  - heat
  - dry
  - fan_only
min_temp: 5
max_temp: 35
target_temp_step: 0.5
preset_modes:
  - none
  - programming
  - manual
  - temporary_manual
  - holiday
current_temperature: 38
temperature: 35
preset_mode: manual
battery: 86
boost_heating: 'OFF'
boost_heating_countdown: 0
boost_heating_countdown_time_set: 100
child_lock: LOCK
current_heating_setpoint: 35
device:
  applicationVersion: 64
  dateCode: ''
  friendlyName: trv_children
  hardwareVersion: 1
  ieeeAddr: '0x84fd27fffea664aa'
  manufacturerID: 4098
  manufacturerName: _TZE200_b6wax7g0
  model: BRT-100-TRV
  networkAddress: 56984
  powerSource: Battery
  stackVersion: 0
  type: EndDevice
  zclVersion: 3
eco_mode: 'OFF'
eco_temperature: 18
last_seen: '2021-12-05T14:16:00.082Z'
linkquality: 105
local_temperature: 38
local_temperature_calibration: 0
max_temperature: 35
min_temperature: 5
position: 0
preset: manual
program_saturday:
  saturday: '6h:0m 24°C,  12h:0m 23°C,   14h:30m 22°C,  17h:30m 21°C '
program_sunday:
  sunday: '  6h:0m 19°C,  12h:30m 20°C,  14h:30m 21°C,  18h:30m 20°C '
program_weekday:
  weekday: ' 6h:0m 20°C,  11h:30m 21°C,  13h:30m 22°C,  17h:30m 23°C '
programming_mode: >-
  06:00/20°C  11:30/21°C  13:30/22°C  17:30/23°C  06:00/24°C  12:00/23°C 
  14:30/22°C  17:30/21°C  06:00/19°C  12:30/20°C  14:30/21°C  18:30/20°C
update:
  state: idle
update_available: false
window: CLOSED
window_detection: 'OFF'
friendly_name: trv_children
supported_features: 17
  - platform: ai_thermostat
    name: ai_children
    thermostat: climate.trv_children
    temperature_sensor: sensor.temperature_humidity_hall_temperature

Additional Information

  1. Reset TRV
  2. Pairing again with z2m
  3. Reinstalled the integration

Versions

TRV Model: BRT-100-TRV
Z2M Version: 1.22.1-1
HA Version: 2021.11.5
ai_thermostat version: 0.7.8

Shows unavailable until the right modes are set after startup

The AI Thermostat will stay on the state "unavailable" after starting the hypervisor running zigbee2mqtt, the MQTT server and HA.

Only selecting manually "auto" system mode and "manual" preset on the real thermostat will make it available.

AI Thermostat should just send the set point temperature followed by a tiny delay of something like 10 seconds and then set the system modes correctly regardless what the valve is currently set at.

The delay is necessary (at least for my hardware) as the valves will otherwise only do one of the commands.

Link two thermostats if two rooms have the door open between them

I need to specify more combinations to fully replace my automations for heating:

In the bathroom I like to heat to a higher temperature than the hallway, but only if the door of the bathroom is closed. Else I like to fall back to whatever state is set in the hallway.

So basically that's a master/slave relation with the door as a binary switch to link them or not.

The hallway would be the master if the door is open, and whatever is set in the hallway would be set in the bathroom. If the door gets closed the bathroom will switch back to normal operation.

Night Mode problems

TS0601

My config:

  - platform: ai_thermostat
    name: sypialnia
    unique_id: 1637927441
    thermostat: climate.kaloryfer_sypialnia
    temperature_sensor: sensor.ble_temperature_sypialnia
    window_sensors: binary_sensor.okno_sypialnia
    weather: weather.home #if this is set, the outdoor_sensor is ignored, remove the outdoor_sensor config!
#    outdoor_sensor: sensor.outdoor_temperature #if you want to use it, remove the weather config!
    off_temperature: 20
    window_off_delay: 0
    valve_maintenance: true
    night_temp: 15
    night_start: '01:00'
    night_end: '05:00'

I've checked debug logs from the last night and the night mode kept turning on and off.

Here are some example log entries from the night:

2021-12-02 01:03:26 DEBUG (MainThread) [custom_components.ai_thermostat.climate] night mode active override with: 15.0
2021-12-02 01:03:26 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: True Mode: auto Setted: heat hasmode: True Calibration: 15 - send: False settemp: 15.0 curtemp: 21 Model: TS0601_thermostat Calibration type: 1 Winter: True TRV: kaloryfer_sypialnia
2021-12-02 01:03:26 DEBUG (MainThread) [custom_components.ai_thermostat.models.utils] Overswing detected
2021-12-02 01:07:28 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: False Mode: auto Setted: heat hasmode: True Calibration: 22 - send: False settemp: 22.0 curtemp: 21 Model: TS0601_thermostat Calibration type: 1 Winter: True TRV: kaloryfer_sypialnia
2021-12-02 01:11:29 DEBUG (MainThread) [custom_components.ai_thermostat.climate] night mode active override with: 15.0
2021-12-02 01:11:29 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: True Mode: auto Setted: heat hasmode: True Calibration: 15 - send: False settemp: 15.0 curtemp: 21 Model: TS0601_thermostat Calibration type: 1 Winter: True TRV: kaloryfer_sypialnia
2021-12-02 01:11:29 DEBUG (MainThread) [custom_components.ai_thermostat.models.utils] Overswing detected
2021-12-02 01:15:11 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: False Mode: auto Setted: heat hasmode: True Calibration: 22 - send: False settemp: 22.0 curtemp: 21 Model: TS0601_thermostat Calibration type: 1 Winter: True TRV: kaloryfer_sypialnia
2021-12-02 01:19:13 DEBUG (MainThread) [custom_components.ai_thermostat.climate] night mode active override with: 15.0
2021-12-02 01:19:13 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: True Mode: auto Setted: heat hasmode: True Calibration: 15 - send: False settemp: 15.0 curtemp: 21 Model: TS0601_thermostat Calibration type: 1 Winter: True TRV: kaloryfer_sypialnia
2021-12-02 01:19:13 DEBUG (MainThread) [custom_components.ai_thermostat.models.utils] Overswing detected
2021-12-02 01:22:55 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: False Mode: auto Setted: heat hasmode: True Calibration: 22 - send: False settemp: 22.0 curtemp: 21 Model: TS0601_thermostat Calibration type: 1 Winter: True TRV: kaloryfer_sypialnia
2021-12-02 01:26:58 DEBUG (MainThread) [custom_components.ai_thermostat.climate] night mode active override with: 15.0
2021-12-02 01:26:58 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: True Mode: auto Setted: heat hasmode: True Calibration: 15 - send: False settemp: 15.0 curtemp: 21 Model: TS0601_thermostat Calibration type: 1 Winter: True TRV: kaloryfer_sypialnia
2021-12-02 01:26:58 DEBUG (MainThread) [custom_components.ai_thermostat.models.utils] Overswing detected
2021-12-02 01:31:00 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: False Mode: auto Setted: heat hasmode: True Calibration: 22 - send: False settemp: 22.0 curtemp: 21 Model: TS0601_thermostat Calibration type: 1 Winter: True TRV: kaloryfer_sypialnia
2021-12-02 01:34:42 DEBUG (MainThread) [custom_components.ai_thermostat.climate] night mode active override with: 15.0
2021-12-02 01:34:42 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: True Mode: auto Setted: heat hasmode: True Calibration: 15 - send: False settemp: 15.0 curtemp: 21 Model: TS0601_thermostat Calibration type: 1 Winter: True TRV: kaloryfer_sypialnia
2021-12-02 01:34:42 DEBUG (MainThread) [custom_components.ai_thermostat.models.utils] Overswing detected
2021-12-02 01:38:44 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: False Mode: auto Setted: heat hasmode: True Calibration: 21 - send: False settemp: 22.0 curtemp: 22 Model: TS0601_thermostat Calibration type: 1 Winter: True TRV: kaloryfer_sypialnia
2021-12-02 01:38:44 DEBUG (MainThread) [custom_components.ai_thermostat.models.utils] Overswing detected
2021-12-02 01:42:25 DEBUG (MainThread) [custom_components.ai_thermostat.climate] night mode active override with: 15.0
2021-12-02 01:42:25 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: True Mode: auto Setted: heat hasmode: True Calibration: 14 - send: False settemp: 15.0 curtemp: 22 Model: TS0601_thermostat Calibration type: 1 Winter: True TRV: kaloryfer_sypialnia
2021-12-02 01:42:26 DEBUG (MainThread) [custom_components.ai_thermostat.models.utils] Overswing detected
2021-12-02 01:46:27 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: False Mode: auto Setted: heat hasmode: True Calibration: 22 - send: False settemp: 22.0 curtemp: 21 Model: TS0601_thermostat Calibration type: 1 Winter: True TRV: kaloryfer_sypialnia
2021-12-02 01:50:29 DEBUG (MainThread) [custom_components.ai_thermostat.climate] night mode active override with: 15.0
2021-12-02 01:50:29 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat triggerd States > Window open: False Night mode: True Mode: auto Setted: heat hasmode: True Calibration: 14 - send: False settemp: 15.0 curtemp: 22 Model: TS0601_thermostat Calibration type: 1 Winter: True TRV: kaloryfer_sypialnia
2021-12-02 01:50:29 DEBUG (MainThread) [custom_components.ai_thermostat.models.utils] Overswing detected

Group mode not working

TL:DR;

Grouping thermostats isn't working.

Prerequisites

  • Model name of your Devices from Zigbee2Mqtt: Tuya TS601
  • Output from Home Assistent Developer Tools state e.g.
  - heat
  - auto
  - 'off'
min_temp: 5
max_temp: 35
target_temp_step: 0.5
preset_modes:
  - none
  - away
  - schedule
  - manual
  - boost
  - complex
  - comfort
  - eco
current_temperature: 19
temperature: 7
preset_mode: manual
auto_lock: MANUAL
away_mode: 'OFF'
away_preset_days: 1
away_preset_temperature: 5
battery_low: false
boost_time: 300
child_lock: UNLOCK
comfort_temperature: 22
current_heating_setpoint: 7
device:
  applicationVersion: 85
  dateCode: ''
  friendlyName: '0x5c0272fffed9dcb0'
  hardwareVersion: 1
  ieeeAddr: '0x5c0272fffed9dcb0'
  manufacturerID: 4098
  manufacturerName: _TZE200_ckud7u2l
  model: TS0601_thermostat
  networkAddress: 35689
  powerSource: Battery
  stackVersion: 0
  type: EndDevice
  zclVersion: 3
eco_temperature: 20
force: close
holidays:
  - hour: 6
    minute: 0
    temperature: 20
  - hour: 8
    minute: 0
    temperature: 15
  - hour: 11
    minute: 30
    temperature: 15
  - hour: 12
    minute: 30
    temperature: 15
  - hour: 17
    minute: 30
    temperature: 20
  - hour: 22
    minute: 0
    temperature: 15
holidays_schedule: 06:00/20°C 08:00/15°C 11:30/15°C 12:30/15°C 17:30/20°C 22:00/15°C
linkquality: 66
local_temperature: 19
local_temperature_calibration: 0.5
max_temperature: 25
min_temperature: 5
position: 0
preset: manual
system_mode: 'off'
update:
  state: available
update_available: true
valve_detection: null
week: 5+2
window_detection: 'OFF'
window_detection_params:
  minutes: 0
  temperature: 109
workdays:
  - hour: 6
    minute: 0
    temperature: 20
  - hour: 8
    minute: 0
    temperature: 15
  - hour: 11
    minute: 30
    temperature: 15
  - hour: 12
    minute: 30
    temperature: 15
  - hour: 17
    minute: 30
    temperature: 20
  - hour: 22
    minute: 0
    temperature: 15
workdays_schedule: 06:00/20°C 08:00/15°C 11:30/15°C 12:30/15°C 17:30/20°C 22:00/15°C
friendly_name: badkamer_thermostaat
supported_features: 17

Description

I have multiple thermostats in my different rooms. Since I want to adjust 2 at the same time I use this addon: https://github.com/daenny/climate_group

I have setup groups us followed:

  - platform: climate_group
    name: 'Woonkamer Thermostaat AI'
    temperature_unit: C  # default to celsius, 'C' or 'F'
    entities:
    - climate.living_room_1_ai
    - climate.living_room_2_ai

And this is the ai setup:

  - platform: ai_thermostat
    name: "Living Room 1 AI"
    unique_id: 435345346 # Its important for Google Home
    thermostat: climate.woonkamer_thermo_1
    temperature_sensor: sensor.woonkamer_temp_temperature
    #window_sensors: group.office_windows #if this is not set, the window open detection is off
    weather: weather.openweathermap #if this is set, the outdoor_sensor is ignored, remove the outdoor_sensor config!
    #outdoor_sensor: sensor.outdoor_temperature #if you want to use it, remove the weather config!
    off_temperature: 18
    #window_off_delay: 0
    valve_maintenance: false
    night_temp: 5
    night_start: '21:30'
    night_end: '08:00'
  - platform: ai_thermostat
    name: "Living Room 2 AI"
    unique_id: 435345341 # Its important for Google Home
    thermostat: climate.woonkamer_thermo_2
    temperature_sensor: sensor.woonkamer_temp_temperature
    #window_sensors: group.office_windows #if this is not set, the window open detection is off
    weather: weather.openweathermap #if this is set, the outdoor_sensor is ignored, remove the outdoor_sensor config!
    #outdoor_sensor: sensor.outdoor_temperature #if you want to use it, remove the weather config!
    off_temperature: 18
    #window_off_delay: 0
    valve_maintenance: false
    night_temp: 5
    night_start: '21:30'
    night_end: '08:00'

Now only the first one is being changed. Is there perhaps an option to use ai_thermostat to group different thermostats?

Steps to Reproduce

  1. Group different climate trvs
  2. Only 1 will change
  3. you will get cold

Expected behavior:

All of them change.

Actual behavior:

only 1 changes

Versions

Home Assistant: 2021.11.5
Zigbee2mqtt: 1.22.1-1

Add an overswing protection

Hey Toby,

I did tinker a lot with my thermostats to come up with some methods to avoid the overswing of the air temperature above the set point.

There are multiple measures in place in my automations:

Air temperature close to setpoint:

If

  • target_temp - 0.5) < air_temp is true
  • the valve position is above 30% open

Do

  • turn the valve forcefully off
  • wait until the valve reports closed (<1%).
  • Calculate the setpoint again with the current local thermostat temperature and air temperature
  • Send this to the valve
  • wait 10 seconds (if not the valve might open directly up to the previous state)
  • enable the valve by setting the heating again to auto

Let the thermostat run if the setpoint is reached

You currently turn off the heating if the setpoint in the air is reached. This is wrong, as the thermostat needs to hunt for the right setting to compensate for the heat loss of the room.

Turning the thermostat off and on again is only necessary if the thermostat doesn't react quickly enough, but the thermostat should just be "reset" by turning the valve off forcefully and turning it back on. Not keeping it off until the temperature has dropped.

Above I showed one measure which detects potential overswing, so the thermostat is reset if it opens more than 30% and is close to the setpoint.

Usually, 30% opening should be enough to keep the room temperature steady. If not the temperature would drop up to 0.5°C which is neglectable.

Too fast-rising temperature

A fast-rising air temperature is uncomfortable and will cause a major overswing, since the radiator is packed with hot water, so shutting the valve will not shut off the heating effect.

So we need a derivative sensor to monitor the situation:

This will filter the incoming sensor data and smooth it out over one minute:

sensor:
  - platform: filter
    name: "Kitchen filtered temperature"
    entity_id: sensor.temp_sensor_kitchen_temperature
    filters:
      - filter: time_simple_moving_average
        window_size: "00:01:00"
        precision: 2  

This will take the smoothed out sensor data and calculate a three-minute derivation:

sensor:
  - platform: derivative
    name: "Derivation filtered Temperature - Kitchen"
    source: sensor.kitchen_filtered_temperature
    time_window: "00:03:00"

We now check for the following condition for each air temperature change, if the valve position is steady for 30 seconds or if the setpoint of the is steady for 30 seconds.

If

  • The derivation is above 3
  • and
  • target_temp < air_temp + 2 is true

Do:

Shut the valve forcefully down for 15 minutes, since the radiator's stored energy is probably enough to keep heating the room.

temper the overswing

If the temperature is already higher than the set temperature this function goes crazy, it just keeps turning my valves on a off every 30 seconds
In my case the valve was also bugging out causing it to open and close every time but I assume that's just my valves (TS0601).

In the screenshot I enabled the function on 19:45, the room is heated by a wood fire so way warmer than set, purple is set temperature, blue is current.

image

Real Thermostat may stay on

I noticed that there's a chance that the real thermostat keeps being on while the AI Thermostat is turned off for no apparent reason.

IMG_20211206_013831.jpg

'AIThermostat' object has no attribute 'overswing'

TS0601

My config:

  - platform: ai_thermostat
    name: sypialnia
    unique_id: 1637927441
    thermostat: climate.kaloryfer_sypialnia
    temperature_sensor: sensor.ble_temperature_sypialnia
    window_sensors: binary_sensor.okno_sypialnia
    weather: weather.home #if this is set, the outdoor_sensor is ignored, remove the outdoor_sensor config!
#    outdoor_sensor: sensor.outdoor_temperature #if you want to use it, remove the weather config!
    off_temperature: 20
    window_off_delay: 0
    valve_maintenance: true
    night_temp: 20
    night_start: '00:00'
    night_end: '05:00'

After updating to 0.7.4 it stopped turning off after the window is opened. When trying to set target temperature I get:

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/ai_thermostat/models/utils.py:42 
Integration: Home Assistant WebSocket API (documentation, issues) 
First occurred: 09:12:23 (1 occurrences) 
Last logged: 09:12:23

[140625360594112] 'AIThermostat' object has no attribute 'overswing'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 667, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 863, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 704, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 586, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/config/custom_components/ai_thermostat/climate.py", line 398, in async_set_temperature
    await self._async_control_heating()
  File "/config/custom_components/ai_thermostat/climate.py", line 599, in _async_control_heating
    remappedstates = convert_outbound_states(self,converted_hvac_mode)
  File "/config/custom_components/ai_thermostat/models/models.py", line 56, in convert_outbound_states
    return TS0601_thermostat_outbound(self,hvac_mode)
  File "/config/custom_components/ai_thermostat/models/TS0601_thermostat/remap.py", line 23, in TS0601_thermostat_outbound
    new_calibration = temperature_calibration(self)
  File "/config/custom_components/ai_thermostat/models/utils.py", line 42, in temperature_calibration
    loop.create_task(self.overswing(new_calibration))
AttributeError: 'AIThermostat' object has no attribute 'overswing'

Can’t read device model at startup on 0.8.1

The new 0.8.1 version throws errors again reg. Device model issues. All the settings are according to the readme and everything worked fine with 0.8.0 (except for night mode)…

Logger: custom_components.ai_thermostat.models.models
Source: /config/custom_components/ai_thermostat/models/models.py:45 
Integration: ai_thermostat (documentation, issues) 
First occurred: 8:25:01 AM (9 occurrences) 
Last logged: 8:25:01 AM

ai_thermostat: can't read the device model of TVR, Enable include_device_information in z2m or checkout issue #1
NoneType: None

Errors in HomeAssistant log - Can't find device model

Hello,

I have Eurotronic Spirit Zigbee (SPZB0001) but in homeassistant log I see the following errors:

Logger: homeassistant
Source: custom_components/ai_thermostat/climate.py:372
Integration: ai_thermostat (documentation, issues)
First occurred: 14:45:41 (5 occurrences)
Last logged: 14:46:12

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/ai_thermostat/climate.py", line 372, in _async_tvr_changed
if self.hass.states.get(self.heater_entity_id).attributes.get('device').get('model') is not None:
AttributeError: 'NoneType' object has no attribute 'get'

My config is:

  • platform: ai_thermostat
    name: ai_kitchen
    thermostat: climate.thermo_kitchen
    temperature_sensor: sensor.conditions_kitchen_temperature
    window_sensors: group.windows
    weather: weather.yandex_weather
    off_temperature: 2

"legacy" is enabled in specific settings of zigbee2mqtt.

Thanks.

New function: night reduction

It would be great if a special target temperature is seated at night so we can save energy.

Possible config:

night_temp: 18
night_start: '23:00'
night_end: '07:00'

Question

Sorry to bother but would it also be possible to use this with a nest thermostat?
Thank you

SPZB0001 with FW 22190930 doesn't work, how to upgrade

Prerequisites

  • Model name of your Devices from Zigbee2Mqtt
    Eurotronic SPZB0001
  • Output from Home Assistent Developer Tools state e.g.
hvac_modes:
  - 'off'
  - auto
  - heat
min_temp: 5
max_temp: 30
target_temp_step: 0.5
current_temperature: 21.5
temperature: 21.5
hvac_action: None
battery: 127.5
current_heating_setpoint: 21.5
device:
  applicationVersion: 22
  dateCode: '20191014'
  friendlyName: wohnzimmer_heizung_rechts
  hardwareVersion: 35
  ieeeAddr: '0x00158d000369857b'
  manufacturerID: 4151
  manufacturerName: Eurotronic
  model: SPZB0001
  networkAddress: 22783
  powerSource: Battery
  softwareBuildID: '22190930'
  stackVersion: 5
  type: EndDevice
  zclVersion: 2
eurotronic_error_status: 0
eurotronic_host_flags:
  boost: false
  child_protection: false
  mirror_display: false
  window_open: false
eurotronic_system_mode: 1
linkquality: 248
local_temperature: 21.5
local_temperature_calibration: 0
occupied_heating_setpoint: 21.5
pi_heating_demand: 30
running_state: null
system_mode: auto
trv_mode: null
unoccupied_heating_setpoint: 16
update:
  state: idle
update_available: false
valve_position: null
friendly_name: wohnzimmer_heizung_rechts
supported_features: 1

configuration.yaml

climate:
  - platform: ai_thermostat
    name: wohnzimmer_heizung_rechts_ai
    unique_id: 1637927441
    thermostat: climate.wohnzimmer_heizung_rechts
    temperature_sensor: sensor.wohnzimmer_temperatursensor_temperature

Description

ai_thermostat does not change the local_temperature_calibration. But no errors.

Steps to Reproduce

Install ai_thermostat via HACS and add the new climate entity
2.
Restart and wait for ai_thermostat to do something

Expected behavior:

adjustement of the local_temperature_calibration on the tvr

Actual behavior:

nothing happens

Versions

core-2021.11.5
z2m 1.22.1-1

Additional Information

I am unable to send the local_temperature_calibration manual via service

service: mqtt.publish
data:
  topic: zigbee2mqtt/wohnzimmer_heizung_rechts/set
  payload: >
    {
      "local_temperature_calibration":2
    }

results in

debug Received MQTT message on 'zigbee2mqtt/wohnzimmer_heizung_rechts/set' with data '{ "local_temperature_calibration":2 } '
debug Publishing 'set' 'local_temperature_calibration' to 'wohnzimmer_heizung_rechts'
error Publish 'set' 'local_temperature_calibration' to 'wohnzimmer_heizung_rechts' failed: 'Error: Write 0x00158d000369857b/1 hvacThermostat({"localTemperatureCalibration":20}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'INVALID_VALUE')'
info MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"Publish 'set' 'local_temperature_calibration' to 'wohnzimmer_heizung_rechts' failed: 'Error: Write 0x00158d000369857b/1 hvacThermostat({\"localTemperatureCalibration\":20}, {\"timeout\":10000,\"disableResponse\":false,\"disableRecovery\":false,\"disableDefaultResponse\":true,\"direction\":0,\"srcEndpoint\":null,\"reservedBits\":0,\"manufacturerCode\":null,\"transactionSequenceNumber\":null,\"writeUndiv\":false}) failed (Status 'INVALID_VALUE')'","meta":{"friendly_name":"wohnzimmer_heizung_rechts"},"type":"zigbee_publish_error"}'

Not setting temperature of "real" TRV

I have configured the virtual TRV and also created a group to cover the windows, but having set the "virtual" TRV to a different value from the "real" TRV, it is not changing the temperature of the "real" TRV.
TRV model is TS0601_thermostat.

Exception in callback AIThermostat.async_added_to_hass.<locals>._async_startup

TRV Model: BRT-100-TRV
Z2M Version: 1.22.0-2
HA Version: 2021.11.4
ai_thermostat version: 0.4.0
weather integration: Meteorologisk institutt (Met.no)

Config ai_thermostat:

  - platform: ai_thermostat
    name: tvr_bedroom_vitrual
    thermostat: climate.tvr_bedroom
    temperature_sensor: sensor.temperature_humidity_bedroom_temperature
    window_sensors: group.livingroom_windows
    weather: weather.nikolskoe
    off_temperature: 20
    window_off_delay: 0
hvac_modes:
  - auto
  - 'off'
  - cool
  - heat
  - dry
  - fan_only
min_temp: 5
max_temp: 35
target_temp_step: 0.5
preset_modes:
  - none
  - programming
  - manual
  - temporary_manual
  - holiday
current_temperature: 19
temperature: 20
preset_mode: manual
battery: 77
boost_heating: 'OFF'
boost_heating_countdown: 0
boost_heating_countdown_time_set: 300
child_lock: LOCK
current_heating_setpoint: 20
device:
  applicationVersion: 64
  dateCode: ''
  friendlyName: trv_bedroom
  hardwareVersion: 1
  ieeeAddr: '0x84fd27fffe8c3d13'
  manufacturerID: 4098
  manufacturerName: _TZE200_b6wax7g0
  model: BRT-100-TRV
  networkAddress: 35585
  powerSource: Battery
  stackVersion: 0
  type: EndDevice
  zclVersion: 3
eco_mode: 'OFF'
eco_temperature: 17
last_seen: '2021-11-20T10:20:22.741Z'
linkquality: 81
local_temperature: 19
local_temperature_calibration: 0
max_temperature: 35
min_temperature: 5
position: 0
preset: manual
program_saturday:
  saturday: '6h:0m 24°C,  12h:0m 23°C,   14h:30m 22°C,  17h:30m 21°C '
program_sunday:
  sunday: '  6h:0m 19°C,  12h:30m 20°C,  14h:30m 21°C,  18h:30m 20°C '
program_weekday:
  weekday: ' 6h:0m 20°C,  11h:30m 21°C,  13h:30m 22°C,  17h:30m 23°C '
update_available: null
window: CLOSED
window_detection: 'OFF'
friendly_name: trv_bedroom
supported_features: 17

Description

There is an error when starting HA:

Logger: homeassistant
Source: custom_components/ai_thermostat/climate.py:217
Integration: ai_thermostat (documentation, issues)
First occurred: 18:46:06 (1 occurrences)
Last logged: 18:46:06

Error doing job: Exception in callback AIThermostat.async_added_to_hass.._async_startup(<Event homeassistant_start[L]>) at /config/custom_components/ai_thermostat/climate.py:209
Traceback (most recent call last):
File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/core.py", line 835, in _onetime_listener
self._hass.async_run_job(listener, event)
File "/usr/src/homeassistant/homeassistant/core.py", line 452, in async_run_job
return self.async_run_hass_job(HassJob(target), *args)
File "/usr/src/homeassistant/homeassistant/core.py", line 433, in async_run_hass_job
hassjob.target(*args)
File "/config/custom_components/ai_thermostat/climate.py", line 217, in _async_startup
self.mqtt.async_publish('zigbee2mqtt/'+self.hass.states.get(self.heater_entity_id).attributes.get('friendly_name')+'/set', payload, 0, False)
AttributeError: 'NoneType' object has no attribute 'attributes'

Steps to Reproduce

  1. Adding a virtual thermostat to the yaml
  2. Restart HA

0.7.0 not responding

TS0601

Any operation (turn on, set temperature etc.) ends with an error.

Ten błąd pochodzi z niestandardowej integracji.

Logger: homeassistant
Source: custom_components/ai_thermostat/helpers.py:13 
Integration: ai_thermostat (documentation, issues) 
First occurred: 15:24:22 (24 occurrences) 
Last logged: 16:30:22

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/ai_thermostat/climate.py", line 412, in _async_sensor_changed
    await self._async_control_heating()
  File "/config/custom_components/ai_thermostat/climate.py", line 530, in _async_control_heating
    if convert_time(self.night_start).time() < datetime.now().time() and convert_time(self.night_end).time() > datetime.now().time():
  File "/config/custom_components/ai_thermostat/helpers.py", line 13, in convert_time
    return datetime.strptime(time_string, "%H:%M")
AttributeError: module 'datetime' has no attribute 'strptime'
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/ai_thermostat/helpers.py:13 
Integration: Home Assistant WebSocket API (documentation, issues) 
First occurred: 15:23:47 (13 occurrences) 
Last logged: 16:32:02

[139991952765664] module 'datetime' has no attribute 'strptime'
[139991710317008] module 'datetime' has no attribute 'strptime'
[139991724083616] module 'datetime' has no attribute 'strptime'
[139991921135920] module 'datetime' has no attribute 'strptime'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 667, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 863, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 704, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 586, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/config/custom_components/ai_thermostat/climate.py", line 366, in async_set_temperature
    await self._async_control_heating()
  File "/config/custom_components/ai_thermostat/climate.py", line 530, in _async_control_heating
    if convert_time(self.night_start).time() < datetime.now().time() and convert_time(self.night_end).time() > datetime.now().time():
  File "/config/custom_components/ai_thermostat/helpers.py", line 13, in convert_time
    return datetime.strptime(time_string, "%H:%M")
AttributeError: module 'datetime' has no attribute 'strptime'

When I commented 'night_temp', 'night_start' and 'night_end' everything works fine.

TS0601 is crashing

Sending a lot of updates to the local_temperature_calibration value leads to crashes of the TS0601 thermostat. It will reboot, but lose the Zigbee connectivity. To restore it I needed to pair it again.

As I already explained in #15, I tried this local_temperature_calibration-value updating process and run into a lot of troubles.

I recommend sending just setpoint updates to the thermostats and don't change the local_temperature_calibration.

limit local temperature calibration to -/+ 6.0 celsius

I had some funny errors today when the temperatur delta between the saswell 802 and the actual temperature was 7.2 degrees celsius. Home assistant then throws an error because accepted values only range from -6.0 to +6.0. I do not know about other models but I would propose that in such (hopefully rare cases) the offset is set to the accepted maximum until the trv temperature gets closer to reality...

Throws an error about 'NoneType' on startup

Version 0.5.1 throws this error on startup:

Logger: homeassistant
Source: custom_components/ai_thermostat/climate.py:383
Integration: ai_thermostat (documentation, issues)
First occurred: 20:58:16 (4 occurrences)
Last logged: 20:58:16

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/ai_thermostat/climate.py", line 383, in _async_tvr_changed
    if self.hass.states.get(self.heater_entity_id).attributes.get('device').get('model') is not None:
AttributeError: 'NoneType' object has no attribute 'get'

v 0.7.0 - 0.7.3 errors

After the update, I have the impression that HA has slowed down drastically.

Log error:
2021-11-28 13:51:27 DEBUG (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat: avg outdoor temp: 3
--- Logging error ---
Traceback (most recent call last):
File "/usr/local/lib/python3.9/logging/handlers.py", line 1432, in emit
self.enqueue(self.prepare(record))
File "/usr/local/lib/python3.9/logging/handlers.py", line 1415, in prepare
msg = self.format(record)
File "/usr/local/lib/python3.9/logging/init.py", line 927, in format
return fmt.format(record)
File "/usr/local/lib/python3.9/logging/init.py", line 663, in format
record.message = record.getMessage()
File "/usr/local/lib/python3.9/logging/init.py", line 367, in getMessage
msg = msg % self.args
ValueError: unsupported format character '|' (0x7c) at index 65
Call stack:
File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/src/homeassistant/homeassistant/main.py", line 331, in
sys.exit(main())
File "/usr/src/homeassistant/homeassistant/main.py", line 318, in main
exit_code = runner.run(runtime_conf)
File "/usr/src/homeassistant/homeassistant/runner.py", line 121, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 629, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 596, in run_forever
self._run_once()
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1890, in _run_once
handle._run()
File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/config/custom_components/ai_thermostat/climate.py", line 419, in _async_sensor_changed
await self._async_control_heating()
File "/config/custom_components/ai_thermostat/climate.py", line 599, in _async_control_heating
_LOGGER.debug(
File "/usr/local/lib/python3.9/logging/init.py", line 1434, in debug
self._log(DEBUG, msg, args, **kwargs)
File "/usr/local/lib/python3.9/logging/init.py", line 1589, in _log
self.handle(record)
File "/usr/local/lib/python3.9/logging/init.py", line 1599, in handle
self.callHandlers(record)
File "/usr/local/lib/python3.9/logging/init.py", line 1661, in callHandlers
hdlr.handle(record)
File "/usr/src/homeassistant/homeassistant/util/logging.py", line 51, in handle
self.emit(record)
Message: 'ai_thermostat triggerd, States > Window open: %s | Night mode: % | Mode: %s | Setted: %s | hasmode: %s | Calibration: %s - send: %s | settemp: %s | curtemp: %s | Model: %s | Calibration type: %s | Winter: %s | TRV: %s'
Arguments: (False, False, 'auto', 'heat', True, 27.0, False, 24.5, 25, 'TS0601_thermostat', 1, True, 'Zuzia Termostat')

the graph also shows strange behavior
image
I have 2 TVRs and it looks the same for both
Meanwhile, I am reverting to version 0.6.0

Valve maintenance is throwing errors

I've added the valve maintenance flag to my valves after updating to 0.5.1.

When I try to do anything with them, they throw this error:

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/ai_thermostat/climate.py:601
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 21:03:36 (6 occurrences)
Last logged: 21:03:50

[547333061024] 'AIThermostat' object has no attribute 'next_valve_maintenance'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 667, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 863, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 704, in _handle_entity_call
    await result
  File "/config/custom_components/ai_thermostat/climate.py", line 329, in async_set_hvac_mode
    await self._async_control_heating()
  File "/config/custom_components/ai_thermostat/climate.py", line 601, in _async_control_heating
    if currentTime > self.next_valve_maintenance:
AttributeError: 'AIThermostat' object has no attribute 'next_valve_maintenance'

Thermostat didn't start after HA restart

I had to do a VM restart in Proxmox and ai_thermostat states in logs that my TVR is unavailable. But it is available.

2021-11-29 20:31:56 INFO (MainThread) [custom_components.ai_thermostat.climate] Starting ai_thermostat for sypialnia with version: 0.7.3 waiting for entity to be ready...
2021-11-29 20:31:56 INFO (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat kaloryfer_sypialnia still waiting for climate.kaloryfer_sypialnia to be available
2021-11-29 20:31:56 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 30s...
2021-11-29 20:32:27 INFO (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat kaloryfer_sypialnia still waiting for climate.kaloryfer_sypialnia to be available
2021-11-29 20:32:27 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 30s...
2021-11-29 20:32:57 INFO (MainThread) [custom_components.ai_thermostat.climate] ai_thermostat kaloryfer_sypialnia still waiting for climate.kaloryfer_sypialnia to be available
2021-11-29 20:32:57 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 30s...

That's all I found in log. After the last "retry in 30s..." nothing more showed up.
Zrzut ekranu 2021-11-29 o 21 01 37

night_temp not working

running the 0.8.0 version using 8x 802 saswell and 1x ts0601 TRVs I am unable to get the night_temp setting working. The temperatures do not change at specified times (or at a later time). I do not have an errors in the home assistant log. I have not yet put it in debugging mode though. Is the potentially a configuration issue on my side? Here, as an example the setting for the bedroom (all trv are configured the same with only night temperatures varying):

climate:
  - platform: ai_thermostat
    name: Schlafzimmer
    thermostat: climate.thermostat_schlafzimmer
    temperature_sensor: sensor.atc8_temperature
    weather: weather.xxx
    off_temperature: 14
    valve_maintenance: true
    night_temp: 17
    night_start: "21:00"
    night_end: "07:00"
    #outdoor_sensor: sensor.outdoor_temperature #if you want to use it, remove the weather config!
    #window_sensors: group.office_windows #if this is not set, the window open detection is off
    #window_off_delay: 0

Project name is missleading

There's no AI involved here ... so I was wondering if you're open to changing the name? The current one feels a bit missleading.

Issue on start: No method get

I like to report an issue that seems to happen on startup of HA

Log message

Logger: homeassistant
Source: custom_components/ai_thermostat/climate.py:372
Integration: ai_thermostat (documentation, issues)
First occurred: 20:29:54 (1 occurrences)
Last logged: 20:29:54

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/ai_thermostat/climate.py", line 372, in _async_tvr_changed
    if self.hass.states.get(self.heater_entity_id).attributes.get('device').get('model') is not None:
AttributeError: 'NoneType' object has no attribute 'get'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.