Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95919

Automation Config - Updating entity based on MQTT topic

$
0
0

@rdlaner wrote:

Hey folks, I’m trying to set up an automation that is triggered by an MQTT topic and then sets the value of an input number slider based on data from the MQTT topic. The trigger seems to be working fine, but the action that is supposed to update the input number value is not doing anything. I tried using the template editor, but it doesn’t seem to work for automations.

I suspect that I’m not parsing the trigger payload correctly in the data_template. Any insight on what I may be doing wrong?

Here’s the yaml:

- alias: Kitchen_RGBW_Sub
  id: Kitchen_RGBW_Sub
  trigger:
    platform: mqtt
    topic: "stat/Lights/Kitchen_Cab/STATE"
  action:
    - service: input_number.set_value
      data_template:
        entity_id: input_number.red_slider
        value: "{{ trigger.payload.value_json.Color.split(',')[0] | int}}"
    - service: input_number.set_value
      data_template:
        entity_id: input_number.green_slider
        value: "{{ trigger.payload.value_json.Color.split(',')[1] | int }}"
    - service: input_number.set_value
      data_template:
        entity_id: input_number.blue_slider
        value: "{{ trigger.payload.value_json.Color.split(',')[2] | int }}"
    - service: input_number.set_value
      data_template:
        entity_id: input_number.white_slider
        value: "{{ trigger.payload.value_json.Channel[3] | int }}"

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>