Stand alone light entity for specific brightness

Wanting to create a “nighlight” entity for a dimmer switch I have over the bathroom vanity and not sure how to do this. The dimmer is integrated into HA via Z-wave to MQTT so is it’s own entity and works as a dimmer. What I would like to do is set a toggle (off/on) that would bring the light to 5% and allow for off/on only.

I used to have that part working when I had the light defined as an mqtt light before adding HA integration but it doesn’t seem to function properly anymore.

Thanks in advance!

You just need top make a template light.

And maybe an input boolean that you turn on/off for nightlight mode. You can control that boolean with other automations too (like time of day) to have it turn on/off automatically.

The template light will be 99% the regular light. So the turn_off, set_level, set_temperature etc will just be a 1 to 1 call of the original light.

i.e.


   ... 
   ...
   turn_off:
     service: light.turn_off
     entity_id: light.my_normal_light
   set_temperature: 
     service: light.turn_on
     data_template:
       entity_id: light.my_normal_light
       level: "{{ color_temp }}"
   set_brightness:
     service: light.turn_on
     data_template:
       entity_id: light.my_normal_light
       level: "{{ brightness }}"
    ...
    ...
 

Now we just change the turn_on to check the boolean.

   turn_on:
     service: light.turn_on
     data_template: 
       entity_id: light.my_normal_light
       brightness_pct: "{{ '5' if is_state('input_boolean.nightlight_mode', 'on') else 100}}"

Or you could have the turn_on set a scene if that boolean is set if you’d rather.

Also, set an automation that looks at that input_boolean. When it goes from ‘off’ to ‘on’, turn on the template light. No need to set brightness because the template light will already do that for you with the ‘on’ command if that boolean is on.