hacksics
(HACKSICS)
June 2, 2021, 6:28am
1
I’m getting following error when reloading the automation.yaml file.
2021-06-02 11:52:02 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [value_template] is an invalid option for [automation]. Check: automation->value_template. (See /config/configuration.yaml, line 9).
Here is my configuration
- id: '1622606175334'
alias: RF Example
description: ''
trigger:
- platform: mqtt
topic: tele/tasmota_rfbridge/RESULT
payload: 'ON'
value_template: '{{ value_json.RfRaw.Data }}'
condition: []
action:
- type: turn_on
device_id: ac347a76fe8056094d4c87d6d92d32a3
entity_id: switch.exhaust_fan
domain: switch
mode: restart
HA documentation says I can use value_template as well.
automation:
trigger:
- platform: mqtt
topic: "living_room/switch/ac"
payload: "on"
value_template: "{{ value_json.state }}"
Any idea what could be the issue?
Troon
(Troon)
June 2, 2021, 6:48am
3
If value_template
were not allowed, I’d expect the error to be “invalid config for trigger ”, and refer to “automation->trigger->value_template”.
Suggestions:
Carefully check your indentation within the trigger
: make sure you’re not using tabs instead of spaces.
Use value
rather than value_template
.
Make your overall indentation match the documentation snippet you pasted: it’s much neater.
hacksics
(HACKSICS)
June 2, 2021, 10:29am
4
Thanks for the quick reply. Nothing wrong with indentation. It just works fine (no errors in the log if I remove value_template from the configurations. But then I can’t achieve what I want to do with this
hacksics
(HACKSICS)
June 2, 2021, 11:49am
5
After few hours of searching Internet, trial and error I figured out how to do this. I’m guessing documentation needs to be updated.
Here is how I got it to work
- id: '1622606175334'
alias: RF Example
description: ''
trigger:
- platform: mqtt
topic: tele/tasmota_rfbridge/RESULT
condition:
- condition: template
value_template: '{{trigger.payload_json.RfRaw.Data | regex_match(".*3808080808190909090808.*",
ignorecase=False) }}'
action:
- type: turn_on
device_id: ac347a76fe8056094d4c87d6d92d32a3
entity_id: switch.exhaust_fan
domain: switch
mode: restart
As you can see, value_template should be part of condition. Thats why only payload is available under trigger section when adding automation from UI