Can I make it somehow make two separate helpers that automatically are updated to two degrees above and two degrees below the temperature set and then use those? Idek how I would accomplish that tbh.
Add more triggers. Like when your device turns on and off. Also a Home Assistant start event trigger. In case you miss it while HA is offline. You have to add some conditions to ensure it only runs when the temperature is right…
Sure. You can use the templates as template conditions as well as template triggers.
Sure, create two input numbers.
Write an automation. The trigger is any change of the first input number (a state trigger with no to:
). The action is to subtract two from the input number. This has to be run in single mode or the automation will trigger itself.
Repeat for the second input number.
Remove the +/-2 from the templates and update them to use the correct input numbers.
So can I use another input variable instead of the number 2 to make a buffer that I can change the length of? Is that doable? Like just replace the number with input_number.tmptoolow or input_number.tmptoohigh and have a variable buffer for the heating and cooling so I can change it from the dash?
Also thanks, and can i use a climate devices current temperature instead of a sensor? its a tuya device.
So now you want three input numbers. Two input numbers to set the heat/cool temperature trigger points and another input number as the offset (2° in previous examples)?
Sure you can do that.
Yes you can. Use "{{ state_attr('climate.your_climate_device','current_temperature') }}"
ohh thats how you specify the attribute. it was saying something about not being an number because it was on cooling. and so i just stick the input_number.tmptoohigh where the 2 was before? or do i have to do something specific? also thanks again i couldnt figure it out.
I seem to remember you asking for a condition so…
Cooling example:
condition:
- condition: template
value_template: "{{ state_attr('climate.your_climate_device','current_temperature')|float >= states('input_number.cool_set_point')|float + states('input_number.offset')|float }}"
Heating example:
condition:
- condition: template
value_template: "{{ state_attr('climate.your_climate_device','current_temperature')|float <= states('input_number.heat_set_point')|float - states('input_number.offset')|float }}"
Perhaps investigate the generic thermostat?
Thought of that but it only does one of heat or cool. Not heat and cool.
Use two? One for each?
Yeah that is a possibility, an annoying one. It really needs updating for both.
The other thing is Thomas appears to already have a climate component that does both and just wants to automate when it gets turned on.
I’ve been down that path. It gets complicated.
Oh ya I looked into that actually. And it just seemed easier to try to learn how to make it work in a more Manual way so I can adjust how it works more. Plus I just generally didn’t understand how to get it to work right and thought it would be easier to use an automation. I thought it had both cool and heat and I just couldn’t figure it out.
So something is wrong and It says I need to define something… How do I like, define input_number.tmptoolow and input_number.tmptoohigh? It exists as a helper so I think I need to so something in the Template. I’ll post the yamls and log. Do I need to remove the like quote things around the helper/variable?
alias: ashley/kitchen ac template -var bth
description: Requires both tuya and ecowitt sensors to trigger with 1 degree buffer
trigger:
- platform: state
entity_id: sensor.temperature_2 - platform: state
entity_id: sensor.ashley_h_t_temperature - platform: state
entity_id: climate.02720007bcddc2a51487
condition: - condition: template
value_template: >-
{{ states(‘sensor.temperature_2’)|float <=
states(‘input_number.kitchen_ac_temp’)|float - ‘input_number.tmptoolow’ }} - condition: template
value_template: >-
{{ states(‘climate.02720007bcddc2a51487’,‘current_temperature’)|float <=
states(‘input_number.kitchen_ac_temp’)|float - ‘input_number.tmptoolow’ }}
action: - type: turn_off
device_id: 9c72c9a4d9ba8cda7e44828ad2c63cf9
entity_id: switch.main_room_ac
domain: switch - type: turn_off
device_id: 1bcdd611bd3e15f1fdf3c3fe0369592e
entity_id: switch.main_room_dehumidifier
domain: switch - type: turn_off
device_id: 7b42f7c56de0b17227502e28fe71cdce
entity_id: switch.kitchen_ac_2
domain: switch
mode: single
alias: ashley/kitchen ac template +var bth
description: ‘’
trigger:
- platform: state
entity_id: sensor.temperature_2 - platform: state
entity_id: sensor.ashley_h_t_temperature - platform: state
entity_id: climate.02720007bcddc2a51487
condition: - condition: template
value_template: >-
{{ states(‘sensor.temperature_2’)|float >=
states(‘input_number.kitchen_ac_temp’)|float + ‘input_number.tmptoohigh’
}} - condition: template
value_template: >-
{{ states(‘climate.02720007bcddc2a51487’,‘current_temperature’)|float >=
states(‘input_number.kitchen_ac_temp’)|float + ‘input_number.tmptoohigh’
}}
action: - type: turn_on
device_id: 9c72c9a4d9ba8cda7e44828ad2c63cf9
entity_id: switch.main_room_ac
domain: switch - type: turn_on
device_id: 1bcdd611bd3e15f1fdf3c3fe0369592e
entity_id: switch.main_room_dehumidifier
domain: switch - type: turn_on
device_id: 7b42f7c56de0b17227502e28fe71cdce
entity_id: switch.kitchen_ac_2
domain: switch
mode: single
Logger: homeassistant.components.automation
Source: components/automation/init.py:728
Integration: Automation (documentation, issues)
First occurred: 2:14:32 PM (543 occurrences)
Last logged: 11:00:19 PM
Error evaluating condition in ‘ashley/kitchen ac template +1 bth’: In ‘condition’ (item 2 of 2): In ‘template’ condition: TypeError: call() takes 2 positional arguments but 3 were given
Error evaluating condition in ‘ashley/kitchen ac template +var bth (Duplicate)’: In ‘condition’ (item 1 of 2): In ‘template’ condition: UndefinedError: ‘input_number’ is undefined In ‘condition’ (item 2 of 2): In ‘template’ condition: TypeError: call() takes 2 positional arguments but 3 were given
Error evaluating condition in ‘ashley/kitchen ac template +var bth’: In ‘condition’ (item 1 of 2): In ‘template’ condition: UndefinedError: ‘input_number’ is undefined In ‘condition’ (item 2 of 2): In ‘template’ condition: TypeError: call() takes 2 positional arguments but 3 were given
Error evaluating condition in ‘ashley/kitchen ac template -var bth’: In ‘condition’ (item 1 of 2): In ‘template’ condition: TypeError: unsupported operand type(s) for -: ‘float’ and ‘str’ In ‘condition’ (item 2 of 2): In ‘template’ condition: TypeError: call() takes 2 positional arguments but 3 were given
Error evaluating condition in ‘ashley/kitchen ac template +var bth’: In ‘condition’ (item 1 of 2): In ‘template’ condition: TypeError: unsupported operand type(s) for +: ‘float’ and ‘str’ In ‘condition’ (item 2 of 2): In ‘template’ condition: TypeError: call() takes 2 positional arguments but 3 were given
Please have a read of point 11 here, then edit your post.
Look at how the first two entity values are returned using the states()
function and |float
filter. You need to do the same thing to the last input_number in this template.
value_template: >-
{{ states('sensor.temperature_2')|float <= states('input_number.kitchen_ac_temp')|float - 'input_number.tmptoolow' }}
Same for the high temperature template.
condition: template
value_template: >-
{{ states('climate.02720007bcddc2a51487','current_temperature')|float >=
states('input_number.kitchen_ac_temp)|float +
states('input_number.tmptoohigh')|float }}
condition: template
value_template: >-
{{ states('sensor.temperature_2')|float >=
states('input_number.kitchen_ac_temp)|float +
states('input_number.tmptoohigh')|float }}
Like that? Or no? It’s giving me a syntax error.
Look how the forum has highlighted quoted parts in red.
{{ states('climate.02720007bcddc2a51487','current_temperature')|float >=
states('input_number.kitchen_ac_temp)|float +
states('input_number.tmptoohigh')|float }}
You missed a single quote at the end of kitchen ac temp. Should look like this:
{{ states('climate.02720007bcddc2a51487','current_temperature')|float >=
states('input_number.kitchen_ac_temp')|float +
states('input_number.tmptoohigh')|float }}
Oh crap. Should’ve used a laptop. I didn’t realize that. It seems to work now. Thanks.
states('climate.02720007bcddc2a51487','current_temperature')
should be
state_attr('climate.02720007bcddc2a51487','current_temperature')
Oh crap that’s why the tuya device isn’t working. Figured tuya just blew hard weiners. Thanks