@erikbjork wrote:
I’m trying to control switches etc in HA by sending MQTT messages to HA. I have this automation rule:
- alias: Control switches via MQTT trigger: platform: mqtt topic: homeassistant/to-ha/cmd action: - service_template: "{{ trigger.payload_json['service'] }}" data_template: > {{ trigger.payload_json['data'] }}
The payload of my message is going to look like this:
{ "service": "light.turn_off", "data": { "entity_id": "group.kitchen_lights" } }
But this is not right. HA doesn’t like the configuration:
expected a dictionary for dictionary value @ data['action'][0]['data_template']. Got None
.How do I turn that JSON map to a dictionary?
Posts: 6
Participants: 3