mager
(Martin Gerken)
May 28, 2023, 12:05am
1
Sorry, I am lost. This was working for some while, but when doing some other edits, it threw the error about the penultimate line:
- id: '1680639628837'
alias: Akku Leistungsregelung
description: ''
trigger:
- platform: time_pattern
seconds: /30
condition:
- type: is_value
condition: device
device_id: 9c460473e7da8a9c30faab45dbfadf58
entity_id: sensor.epever_battery_voltage
domain: sensor
above: 25.6
action:
- service: mqtt.publish
data:
topic: hoymiles/ctrl/limit/0
payload_template: "{{ ([[states('sensor.q3da_sml_p_in')|int + states('sensor.hm300_p_ac')|int - 20|int, 0]|max, 200]|min)|string + "W"}}"
mode: single
I’ve seen this before. I think it is to do with the [ ] characters but unsure why it sometimes happens. I think I worked around in by pasting in the full template string (not typing) in the “edit in YAML” mode.
Troon
(Troon)
May 28, 2023, 6:22am
3
Issues with that configuration:
You should provide default values for your int
filters — states('sensor.foo')|int(0)
, for example;
You don’t need to run 20
through int
;
Your quoting is messed up because you have double quotes around the W
at the end.
You can also clean up your condition by using a numeric state condition rather than the device one:
condition:
- condition: numeric_state
entity_id: sensor.epever_battery_voltage
above: 25.6
1 Like
mager
(Martin Gerken)
May 28, 2023, 11:44am
4
Yeah, after some fiddling with the GUI and the YAML editor it works. Some strange quirk!