Annoyingly no, as states are always returned as a string so that will return false
In the mean time I modified your script to use timers to implement the back-off option: I created a timer for each room, at the end of the automation I start the timer (e.g. with a 15’ time) and a condition on automation activation checks if the timer is idle
Not sure where the best place to put it is, written it in my git and added the home-assistant-config topic as per the examples write up info:
Did anyone get the automation working from @north3221? I seem to get the following error;
2021-03-02 10:21:04 ERROR (MainThread) [aiohttp.server] Unhandled exception Traceback (most recent call last): File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1152, in _sendfile_fallback read = await self.run_in_executor(None, file.readinto, view) asyncio.exceptions.CancelledError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 485, in start resp, reset = await task File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 440, in _handle_request reset = await self.finish_response(request, resp, start_time) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 591, in finish_response await prepare_meth(request) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_fileresponse.py", line 241, in prepare return await self._sendfile(request, fobj, offset, count) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_fileresponse.py", line 96, in _sendfile await loop.sendfile(transport, fobj, offset, count) File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1131, in sendfile return await self._sendfile_fallback(transport, file, File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1161, in _sendfile_fallback await proto.restore() File "/usr/local/lib/python3.8/asyncio/base_events.py", line 263, in restore self._transport.resume_reading() File "/usr/local/lib/python3.8/asyncio/sslproto.py", line 344, in resume_reading self._ssl_protocol._transport.resume_reading() AttributeError: 'NoneType' object has no attribute 'resume_reading'
hello community ,as im a noob in this can someone guide where i must write these commands
alias: Tado bedroom offset
description: ‘’
trigger:
- platform: state
entity_id:- sensor.bedroom_temperature_measurement
- sensor.bedroom_temperature
condition:
- condition: template
value_template: >
{% set tado_temp = states(‘sensor.bedroom_temperature’)|float %} {% set
room_temp = states(‘sensor.bedroom_temperature_measurement’)|float %} {{
(tado_temp - room_temp)|abs > 0.3 }} - condition: state
entity_id: climate.bedroom
state: home
attribute: preset_mode
action: - service: tado.set_climate_temperature_offset
data:
entity_id: climate.bedroom
offset: >
{% set tado_temp = states(‘sensor.bedroom_temperature’)|float %} {% set
room_temp = states(‘sensor.bedroom_temperature_measurement’)|float %} {%
set current_offset = state_attr(‘climate.bedroom’, ‘offset_celsius’) %}
{{ (-(tado_temp - room_temp) + current_offset)|round(1) }} - delay:
hours: 0
minutes: 5
seconds: 0
milliseconds: 0
mode: single
thx and sorry for my noob question
Hi @north3221,
Thank you very much for your contribution!
I’m customizing your automation to match my entities names.
What are sensor.house and climate.house for you?
I only have sensors and climate entities for each room, so this “house” is confusing me.
Thank you
Giosem
I have a thermostat for the house as well as TRVs (and sensors) in rooms. So just match your own needs, rename to each sensor/climate pairing you have. I have a few rooms without smart TRVs so they heat based on the ‘house’ thermostat
Basically don’t worry that I have one called house.
I’ve updated that automation, I’ll maybe upload an update, although pretty sure the one that’s there is better for general purpose, mine is quite specific to my house now. I also need to contribute my last updated code back to ha tado integration
Thanks again @north3221, I’m really appreciating your job and support!
Everything seems to work fine, except I’m getting this WARNING msg in the logs:
Logger: homeassistant.helpers.template
Source: helpers/template.py:1254
First occurred: 12:57:18 PM (1 occurrences)
Last logged: 12:57:18 PM
Template warning: ‘int’ got invalid input ‘unknown’ when rendering template ‘{{ states(sensor_id)|int != 0 or states(sensor_id) == ‘0’ }}’ but no default was specified. Currently ‘int’ will return ‘0’, however this template will fail to render in Home Assistant core 2022.1
Is this something I should take care of?
Thanks
Bye
Giosem
That’s interesting I don’t get that warning, however that’s likely cause I dont get ‘unknown’ returned as the temp on my sensors.
So first off - you must have your naming convention wrong, that is suggesting when it looks for the temp of your ‘sensor_id’ its returning ‘unknown’. So check your namespaces cause they must not be consitent?
As for the warning itself and no longer going to render in 2022.1. Its funny cause the way I am checking numeric state of the sensors isn’t ideal as pointed out by @metsessantaset above, but at the time you couldn’t check if the state is number as they are always string. However, looks like that was fixed at some point I can now use is_number() to validate.
I’ve updated the file on git. Good catch
Thanks @north3221!!
Got the last you updated on Git, but get this error msg:
Logger: homeassistant.config
Source: config.py:464
First occurred: 5:51:17 PM (1 occurrences)
Last logged: 5:51:17 PM
Invalid config for [automation]: Unexpected value for condition: ‘[’{{ is_number(states(sensor_id)) }}’, “{{ states(climate_sensor_id)|int != 0 or states(climate_sensor_id) == ‘0’ }}”, “{{ states(climate_id) == ‘auto’ and state_attr(climate_id, ‘preset_mode’) == ‘home’ }}”]’. Expected and, device, not, numeric_state, or, state, sun, template, time, trigger, zone @ data[‘action’][1]. Got None. (See /config/configuration.yaml, line 28).
Not sure what else can be done here…
Thanks for your help!
Bye
Giosem
I am not sure tbh. I see I missed a bit in updating git, which I have fixed, but they wont fix your issue.
I do wonder if there is an issue in your naming convention of entities. What namespaces are you using in settings?
What happens when you ‘Check Configuration’?
Why don’t people just use generic_thermostat? It’s a bit of a pain as you need to work with operation modes but it should be do’able. You can feed in whatever temp sensor you like as part of generic_thermostat.
@north3221
May I ask you how do you use/setup the tado and the all heating controll?
Are you using the tado app to make a schedule or you are using it from HA only?
This is you old setup which I use it for offset, its still working just fine:
alias: Fűtés Tado temperature offset bedroom
description: ''
trigger:
- platform: state
entity_id: sensor.bedroom_temperature_2,sensor.bedroom_temperature
condition:
- condition: template
value_template: >
{% set tado_temp = states('sensor.bedroom_temperature')|float %} {% set
room_temp = states('sensor.bedroom_temperature_2')|float %} {{ (tado_temp
- room_temp)|abs > 0.3 }}
- condition: state
entity_id: climate.bedroom
state: home
attribute: preset_mode
action:
- service: tado.set_climate_temperature_offset
data:
entity_id: climate.bedroom
offset: >
{% set tado_temp = states('sensor.bedroom_temperature')|float %} {% set
room_temp = states('sensor.bedroom_temperature_2')|float %} {% set
current_offset = state_attr('climate.bedroom', 'offset_celsius') %} {{
(-(tado_temp - room_temp) + current_offset)|round(1) }}
- delay:
hours: 0
minutes: 5
seconds: 0
milliseconds: 0
mode: single
I dont use the tado app at all, there is my config:
alias: Fűtés Emeleti
description: ''
trigger:
- platform: state
entity_id: group.csalad
id: csalad home
to: home
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: time_pattern
minutes: /1
- platform: state
entity_id: binary_sensor.wan
to: 'on'
- platform: state
entity_id: group.emeleti_ablak_door
for:
hours: 0
minutes: 3
seconds: 2
to: 'on'
condition:
- condition: state
entity_id: input_boolean.futes_szezon
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: group.csalad
state: home
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.bedroom_temperature_2
below: input_number.emeleti_futes_cel
- condition: time
before: input_datetime.emeleti_futes_befejezes
after: input_datetime.emeleti_futes_kezdes
- condition: state
entity_id: group.emeleti_ablak_door
state: 'off'
sequence:
- service: climate.set_temperature
data:
temperature: '{{ states(''input_number.emeleti_futes_cel'') }}'
entity_id: climate.bedroom
- service: climate.set_temperature
data:
temperature: '{{ states(''input_number.emeleti_futes_cel'') }}'
entity_id: climate.room_1
- conditions:
- condition: state
entity_id: group.emeleti_ablak_door
state: 'on'
for:
hours: 0
minutes: 3
seconds: 0
milliseconds: 0
sequence:
- service: climate.turn_off
target:
entity_id:
- climate.bedroom
- climate.room_1
- conditions:
- condition: numeric_state
entity_id: sensor.bedroom_temperature_2
above: input_number.emeleti_futes_cel
sequence:
- service: climate.set_temperature
data:
temperature: '{{ states(''input_number.emeleti_futes_tavol'') }}'
entity_id: climate.room_1
- service: climate.set_temperature
data:
temperature: '{{ states(''input_number.emeleti_futes_tavol'') }}'
entity_id: climate.bedroom
default: []
mode: single
I am just looking for a better solutions.
Hello
I wanted to compliment you on the automation you wrote to manage the tado valves.
I have a problem that could become a suggestion.
during the heating phases the automation works correctly by adjusting the offset.
Once I set the away mode the automation rightly no longer adjusts the offset.
the valves continue to maintain the last offset set.
for example:
- the offset is set at -5.8 ° C
- the target temperature in away is 17 ° C
- the external sensor measures 21 ° C
- the temperature read by the valve 15.2 ° C (21 - 5.8)
the heating in away mode will continue to start unduly.
Is it possible to insert an automation that adjusts the offset once every hour in all conditions?!
Hi all,
What’s the best approach in 2022? Using the automation in this thread to adjust offsets or have a generic thermostat as mentioned here?
Or install one of these to move the stat by 90 deg?