sindrebroch/ha-magicmirror

Merge monitor switch and monitor brightness in a light entity

sisimomo opened this issue · 2 comments

Describe the solution you'd like
It would be simpler if the monitor switch and the brightness were merge in a single entity (light).
image

Describe alternatives you've considered
Here's the Template Light I'm currently using to get the wanted result:

light:
  - platform: template
    lights:
      magicmirror_monitor:
        friendly_name: "MagicMirror Monitor"
        icon_template: mdi:mirror-rectangle
        level_template: >-
          {% if is_state('switch.magicmirror_monitor', 'on')|default(true, false) %}
            {{ ((states('number.magicmirror_brightness')|default(100, false)|int)*2.55)|round() }}
          {% else %}
            0
          {% endif %}
        value_template: "{{ states('switch.magicmirror_monitor')|default('on', false) }}"
        turn_on:
          service: switch.turn_on
          target:
            entity_id: switch.magicmirror_monitor
        turn_off:
          service: switch.turn_off
          target:
            entity_id: switch.magicmirror_monitor
        set_level:
          service: number.set_value
          data:
            value: "{{ (brightness/2.55)|round() }}"
          target:
            entity_id: number.magicmirror_brightness

Great suggestion! Will definetely implement this at some point.

Should be fixed in release 1.4.0. Please reopen if there are any issues.