@cabalforces wrote:
Hi! I am trying to control IOT Link on my pc through mqtt with input selects. There are multiple serious issues with this, namely that I am terrible at programming, not familiar with the syntax of jinja or yaml just impatient in general for any kind of debugging. I have tried to basically copy-paste code i have found on the site but of course it does not work.
This is what it looks like:- id: computer_state alias: Power trigger: - platform: state entity_id: input_select.pc_power condition: [] action: - service: mqtt.publish data_template: entity_id: input_select.pc_power option: >- {% set mydict = { 'logoff': 'Log Out' 'lock': 'Lock', 'reboot': 'Reset', } %} {{ mydict.get(action.topic) }} topic: "iotlink/workgroup/odin/commands/{{action.topic}}" payload: ''
And this is the error it throws:
Invalid config for [automation]: invalid template (TemplateSyntaxError: expected token ‘,’, got ‘:’) for dictionary value @ data[‘action’][0][‘data_template’][‘option’]. Got None. (See /config/configuration.yaml, line 48).
Invalid config for [automation]: Entity ID input_select. is an invalid entity id for dictionary value @ data[‘trigger’][0][‘entity_id’]. Got None
expected str for dictionary value @ data[‘id’]. Got None
string value is None for dictionary value @ data[‘alias’]. Got None. (See /config/configuration.yaml, line 48).Line 48 is an enter, with nothing else, line 49 is:
automation: !include automations.yaml
Very helpful.
Thank you in advance for your help
Posts: 19
Participants: 3