basovink
(Bas Ovink)
February 8, 2022, 10:12pm
1
Now I think I am doing the same, but it is not accepted. Can you shine a light on this?
service: number.set_value
data: value:"{{ states('input_number.warmtevraag') |float * 5 + 50 |int(0) }}"
target:
entity_id: number.centrale_verwarming_temperatuur
The error I get in the trace is
Error rendering data template: TypeError: can only concatenate str (not “int”) to str
tom_l
February 8, 2022, 10:57pm
2
Your indentation is wrong and you are only converting the number 50 to an int. Try this
service: number.set_value
data:
value:"{{ (states('input_number.warmtevraag') |float(0) * 5 + 50) |int(0) }}"
target:
entity_id: number.centrale_verwarming_temperatuur
1 Like
basovink
(Bas Ovink)
February 9, 2022, 10:33am
3
Thanks. However, I get a new error:
Error rendering data template: Result is not a Dictionary
Could there be a problem in the definition of the number?
number:
- platform: mqtt
name: "Centrale verwarming temperatuur"
state_topic: "K2/CH/temperature"
command_topic: "K2/CH/temperature/set"
min: 20
max: 80
icon: mdi:radiator
basovink
(Bas Ovink)
February 9, 2022, 10:56am
4
I changed the automation to this, which is accepted, but doesn’t change number.centrale_verwarming_temperatuur
in the end. aaargh. I really appreciate some guidance here.
service: number.set_value
data:
value: '{{ (states(''input_number.warmtevraag'') |float(1) * 5 + 50) |int(0) }}'
entity_id: number.centrale_verwarming_temperatuur
(btw the changes in quoting are done by HAss.)
tom_l
February 9, 2022, 11:09am
5
Don’t worry about the quotes, the GUI editor does that. It’s ok.
I missed a space in my config. Try this:
service: number.set_value
data:
value: '{{ (states(''input_number.warmtevraag'') |float(0) * 5 + 50) |int(0) }}'
target:
entity_id: number.centrale_verwarming_temperatuur
basovink
(Bas Ovink)
February 9, 2022, 4:30pm
6
Thanks Tom. Unfortunately this doesn’t change a thing. Code runs fine, trace shows no errors, but the value doesn’t change:
Trace:
Executed: 9 februari 2022 17:25:55
Result:
params:
domain: number
service: set_value
service_data:
value: 53
entity_id:
- number.centrale_verwarming_temperatuur
target:
entity_id:
- number.centrale_verwarming_temperatuur
running_script: false
limit: 10
In Template tool:
{{ (states(“input_number.warmtevraag”) |float(0) * 5 + 50) |int(0) }}
{{ states(‘number.centrale_verwarming_temperatuur’) }}
Result:
53
0
123
(Taras)
February 9, 2022, 4:44pm
7
Go to Developer Tools > Services and select Number: Set
Select your entity: number.centrale_verwarming_temperatuur
Enable the Value option and enter 53
Click the Call Service button.
Go to Developer Tools > States
Find number.centrale_verwarming_temperatuur
and confirm its state
value is now 53
If it’s not 53
then that issue has to be solved first.
1 Like
basovink
(Bas Ovink)
February 9, 2022, 8:14pm
8
Thanks @123 and @tom_l
Tom’s suggestion was wordking already. My arduino simply wasn’t responding to the mqtt request:
K2/CH/temperature/set 53
Should be responded with
K2/CH/temperature 53
Solved!