Ok, i’m really close but I feel like i’m taking one step forward and two steps back.
Here is the current config:
- platform: mqtt
schema: template
name: Office Level
command_topic: "homeassistant/light/office_level/set"
state_topic: "homeassistant/light/office_level/state"
command_on_template: >
{"state": "on"
{%- if brightness is defined -%}
, "brightness": "{{ brightness }}"
{%- endif -%}
{%- if transition is defined -%}
, "transition": "{{ transition }}"
{%- endif -%}
}
command_off_template: >
{"state": "off"
{%- if transition is defined -%}
, "transition": "{{ transition }}"
{%- endif -%}
}
state_template: "{{ value }}"
brightness_template: "{{ value }}"
i KNOW that brightness part is wrong but here’s what’s messed up. I can control the light just fine. Switch it on/off, dim it, everything. It just throws an error of “Invalid brightness value received”. Which is annoying and i want to fix. The state part works 100% fine.
EDIT: I think i see the problem, and I don’t know the solution. The problem is for “brightness_template” it’s trying to find the value in /homeassistant/light/office/state. But the issue is, it’s not there. The value is in /homeassistant/light/office/brightness. But I can’t define brightness_command_topic like I can with the other variants of MQTT Light. So I think i’m stuck either 1) not having transitions and using the “default” light or 2) having transitions/brightness/what I want using the “template” light but getting spammed with errors all the time about how the brightness value isn’t correct. Sigh, damned if I do damned if I don’t.