I have a dimmer switch for the light over my bathroom vanity and managed to get two different mqtt light entries in the configuration file. Is there a way for them to share the same state?
What my lovelace card looks like (Vanity is full dimmer capability while “nightlight toggle” only takes the Vanity lights to 5% brightness. That part works, but the dimmer does not indicate the lights are turned on when the nightlight is toggled (showing that light it on and dimmer is at 5%) and when the lights are turned off / dimmed to 5%. The toggle switch for the “Nightlight” however does toggle on when the dimmer is set and off when taken to 0.
I am guessing my issue lies in the payload_on and payload_off entries. I can hardcode these as set values in the nightlight part (since I only care about on/off being 5% brightness and 0%) but uncertain how to do this for the Bathroom Vanity since default (“on/off” is not recognized by the dimmer).
The dimmer switch is a GE enbrighten.
- platform: mqtt
name: "Bathroom Vanity"
state_topic: "zwave/bathroom_vanity/38/1/0"
state_value_template: "{{ '0' if value == '0' else '99' }}"
command_topic: "zwave/bathroom_vanity/38/1/0/set"
brightness_command_topic: "zwave/bathroom_vanity/38/1/0/set"
brightness_scale: 99
brightness_state_topic: "zwave/bathroom_vanity/38/1/0"
on_command_type: "brightness"
payload_on: "on"
payload_off: "off"
qos: 0
optimistic: false
- platform: mqtt
name: "Bathroom Nightlight"
state_topic: 'zwave/bathroom_vanity/38/1/0'
state_value_template: "{{ '0' if value == '0' else '5' }}"
command_topic: 'zwave/bathroom_vanity/38/1/0/set'
payload_on: '5'
payload_off: '0'
brightness_scale: 5
brightness_state_topic: 'zwave/bathroom_vanity/38/1/0'
brightness_command_topic: 'zwave/bathroom_vanity/38/1/0/set'
on_command_type: 'brightness'