I’m trying to get dimming to work for an mqtt light. All that’s needed for dim/brightness is a number between 0-99 with 0 off and 99 100%. I have off and on working but can’t get any other brightness to work. How to I configure HA to do this? I’m sure this is brightness_value_template related but just can’t crack this.
Apologies I thought I was clear. Looking for HA to send a value between 0-99 which represents off to on in percentage. It seems on further testing HA is indeed sending a dimmer value for my configuration. When I dim my kitchen light to 52% sure enough mqtt reflects the correct value. However 1 second later I seem to get a 99 sent over mqtt. If I use node-red to send a dimmer value, this works perfectly. Seems HA is sending “99” for “on” right after it sends the dimmer value.
In this scenario, avoid using retain: true because it will make the MQTT Broker retain a command topic. That’s often a source of unexpected consequences when the target device reboots.
However, Homeseer should publish the light’s state with retain=true. When Home Assistant reboots and re-subscribes to the light’s state_topic, it will receive the light’s current state.
General Rule of Thumb:
Controller of a device shouldn’t publish commands with retain=true.