Hi.
Can someone please tell me how to grab a json brightness and update the status in HA before i break the “Check Configuration” and “Restart button”?
I have a MQTT light that only outputs brightness states in json when updated status, there is no state command from the light. I am able to control the light as expected from HA using the set topic and status shown in GUI is correct, but if i change the light from any other source it does not update the status in HA.
Examples from MQTT explorer:
The json string from the dimmer(hdl/1.61/2) contains channel nr for the light, execution status and level witch is the brightness from the light and the value i want in to HA. Also you can see the set string from HA(hdl/1.61/2/set)
My configuration.yaml file for the light
light:
- platform: mqtt
schema: template
name: "TV Light"
state_topic: "hdl/1.61/2"
command_topic: "hdl/1.61/2/set"
command_on_template: >
{"state": "on"
{%- if brightness is defined -%}
, "level": {{ brightness }}
{%- else -%}
, "level": 255
{%- endif -%}
}
command_off_template: '{"level": 0}'
brightness_template: "{{ value_json.level }}"
Have tried changing “brightness_template” to the following:
brightness_template: "{{ level }}"
and:
brightness_template: "{{ value_json['level'] }}"
Brightness does not change status in HA when i change the light manually.