giovanni
(Giovanni)
November 9, 2021, 10:01pm
1
So basically here’s my code:
check if outside is cold enough (e.g. +16°C)
if yes, then write to an input_number the current value of the radiator
wait 30 mins for the house to warm up and be cozy
set back the temperature that was originally written in the dedicated input_number
I’ve been hitting the refresh script button more than my computer can count, could somebody help me out?
warmup:
sequence:
- condition: numeric_state
entity_id: sensor.outside_average_temperature
below: '16'
- service: input_number.set_value
target:
entity_id: input_number.stored_temp_bathroom
data_template:
value: '{{ state_attr(''sensor.climate.bathroom_radiator'', ''temperature'')
| float }}'
- service: climate.set_temperature
target:
entity_id: climate.bathroom_radiator
data:
temperature: 24
- delay:
hours: 0
minutes: 30
seconds: 0
milliseconds: 0
- service: climate.set_temperature
target:
entity_id: climate.bathroom_radiator
data:
temperature: '{{ state_attr(''sensor.climate.bathroom_radiator'', ''temperature'')
| float }}'
mode: single
alias: Warmup
icon: mdi:thermometer-plus
Oh, I forgot to add the error I get when I run the script:
Failed to call service script/warmup. Invalid value for input_number.stored_temp_bathroom: 0.0 (range 10.0 - 30.0)
Check for data template, it is setting 0 to input but it is designed to be between 10 and 30. Probably, you put upper/lower limits
{{ state_attr(''sensor.climate.bathroom_radiator'', ''temperature'') | float }}
giovanni
(Giovanni)
November 9, 2021, 10:50pm
3
I put limits but they’re useless, temperature is now within 10 and 30 (13°C).
I wonder what kind of number it is trying to write… how could I see that?
giovanni
(Giovanni)
November 9, 2021, 10:57pm
4
Ok I have absolutely not even the remote idea of what I have done but now it works.
Guess I could mark it as solved?
giovanni
(Giovanni)
November 9, 2021, 11:41pm
5
Aaaaaactually it doesn’t go back to the original temperature (step 4 of my script).
And it was easy to realise why, until I tried what I thought was right (but was unexplicably wrong):
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- service: climate.set_temperature
target:
entity_id: climate.bathroom_radiator
data:
temperature: '{{ state(input_number.stored_temp_bathroom) | float }}'
giovanni
(Giovanni)
November 11, 2021, 1:26pm
6
Ok, I have simplified my code a lot and I’m stuck ad this step in my script:
service: input_number.set_value
target:
entity_id: input_number.stored_temp_bathroom
data_template:
value: "{{ state_attr('sensor.climate.radiator_bathroom', 'temperature') | float }}"
and
service: climate.set_temperature
target:
entity_id: climate.bathroom_radiator
data:
temperature: '{{ state(input_number.stored_temp_bathroom) | float }}'
Could someone tell me what am I doing wrong? I tried everything and honestly the documentation is not super helpful…
koying
(Chris B)
November 11, 2021, 3:32pm
8
It’s states and you need to quote the entity_id
temperature: '{{ states("input_number.stored_temp_bathroom") | float }}'
1 Like
giovanni
(Giovanni)
November 11, 2021, 4:45pm
11
Ok I solved the first issue but not this one… basically I’m unable to set back the temperature stored in input_number.stored_temp_bathroom
.
It’s interesting to see at the trace… it looks like the thermostat has 10 as a temperature limit but that can’t be, obviously.
Executed: November 11, 2021, 5:44:07 PM
Result:
params:
domain: climate
service: set_temperature
service_data:
temperature: 18
entity_id:
- climate.bathroom_radiator
target:
entity_id:
- climate.bathroom_radiator
running_script: false
limit: 10
giovanni
(Giovanni)
November 11, 2021, 4:51pm
13
I’m an idiot… I wrote “bathroom_radiator” instead of “radiator_bathroom”.