I have a light that uses MQTT discovery:
16/15:17:23.361 mqtt: Published homeassistant/light/HVXLb1d0d912ed315aad_C_5/config,
{"uniq_id":"HVXLb1d0d912ed315aad_C_5","name":"Kitchen Table","ret":false,"qos":1,
"dev":{"ids":["HVXLb1d0d912ed315aad_X10"],"name":"HomeVisionXL X10","mdl":"HomeVision","mf":"CustomSolutions"},
"~":"stat/KitchenTable/RESULT","stat_t":"~",
"cmd_t":"cmnd/KitchenTable/POWER","pl_on":"ON","pl_off":"OFF",
"stat_val_tpl":"{{ value_json.POWER }}",
"bri_cmd_t":"cmnd/KitchenTable/POWER","bri_stat_t":"~","bri_scl":"100","bri_val_tpl":"{{ value_json.Dimmer }}","on_cmd_type":"brightness"}
This creates an entity - light.homevisionxl_x10_kitchen_table that, when used in a entity card, shows it tracking the light’s state changes (ON/OFF) properly.
I have an automation that I was playing with, just to test how things worked, that would toggle another light (light.homevisionxl_x10_den_overhead, also MQTT discovered) whenever light.homevisionxl_x10_kitchen_table was turned on (via MQTT). I used the GUI to enter the automation, but here is the resulting yaml:
alias: test auto
description: ""
trigger:
- platform: state
entity_id:
- light.homevisionxl_x10_kitchen_table
from: "OFF"
to: "ON"
condition: []
action:
- service: light.toggle
target:
entity_id:
- light.homevisionxl_x10_den_overhead
data: {}
mode: single
However, this automation never triggers, and I can’t figure out why not.
Here’s the log showing the incoming MQTT message that turns on the light (after being turned OFF first.)
2024-03-16 15:17:45.278 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on stat/KitchenTable/RESULT (qos=1): b'{"POWER":"OFF","Dimmer":0}'
2024-03-16 15:17:45.279 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"POWER":"OFF","Dimmer":0}' with variables {'entity_id': 'light.homevisionxl_x10_kitchen_table', 'name': 'Kitchen Table', 'this': <template TemplateStateFromEntityId(light.homevisionxl_x10_kitchen_table)>} and Template<template=({{ value_json.POWER }}) renders=13>
2024-03-16 15:17:45.281 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"POWER":"OFF","Dimmer":0}' with variables {'entity_id': 'light.homevisionxl_x10_kitchen_table', 'name': 'Kitchen Table', 'this': <template TemplateStateFromEntityId(light.homevisionxl_x10_kitchen_table)>} with default value 'default' and Template<template=({{ value_json.Dimmer }}) renders=13>
2024-03-16 15:17:45.282 DEBUG (MainThread) [homeassistant.components.mqtt.light.schema_basic] Ignoring zero brightness from 'stat/KitchenTable/RESULT'
2024-03-16 15:17:49.617 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on stat/KitchenTable/RESULT (qos=1): b'{"POWER":"ON","Dimmer":100}'
2024-03-16 15:17:49.619 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"POWER":"ON","Dimmer":100}' with variables {'entity_id': 'light.homevisionxl_x10_kitchen_table', 'name': 'Kitchen Table', 'this': <template TemplateStateFromEntityId(light.homevisionxl_x10_kitchen_table)>} and Template<template=({{ value_json.POWER }}) renders=14>
2024-03-16 15:17:49.620 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"POWER":"ON","Dimmer":100}' with variables {'entity_id': 'light.homevisionxl_x10_kitchen_table', 'name': 'Kitchen Table', 'this': <template TemplateStateFromEntityId(light.homevisionxl_x10_kitchen_table)>} with default value 'default' and Template<template=({{ value_json.Dimmer }}) renders=14>
Is there something else I need to doto get this to trigger?