I’m currently sending RGB data back to HASS using the following 3 sensors
- platform: mqtt
state_topic: "sensors/RGB"
name: "Red sensor"
value_template: "{{ value_json.red }}"
- platform: mqtt
state_topic: "sensors/RGB"
name: "Green sensor"
value_template: "{{ value_json.green }}"
- platform: mqtt
state_topic: "sensors/RGB"
name: "Blue sensor"
value_template: "{{ value_json.blue }}"
What I would like to do is instead use my value_template entries for a single MQTT Template light (or similar).
That way, I can use the dynamic light icon to show me the actual color, rather than dealing with 3 separate numbers.
I tried this:
- platform: mqtt_template
name: RGB Sensor
command_topic: "sensors/RGB"
command_on_template: "on"
command_off_template: "off"
red_template: "{{ value_json.red }}"
green_template: "{{ value_json.green }}"
blue_template: "{{ value_json.blue }}"
and while it gives me a new light, it doesn’t give me any colors.
instead I get:
2017-12-21 12:25:15 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is
undefined (value: on, template: {{ value_json.green }})
2017-12-21 12:25:15 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is
undefined (value: on, template: {{ value_json.red }})
2017-12-21 12:25:15 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is
undefined (value: on, template: {{ value_json.blue }})