#Remapping Light Brightness Levels?

1 messages · Page 1 of 1 (latest)

hollow wyvern
#

If there a way for a specific light that I can remap the brightness levels? It's a Zigbee dimmer module via Z2M, and any brighter than 30% (this is actually an int value of 76) and the lights start flickering.

Is there a way where I can have HA remap 30% as 100% and to adjust the inbetween levels accordingly?

I've got an automation to handle it for now,

grand cove
#

Documentation HERE would be a starting point.

hollow wyvern
#

Hmmm nearly

#

Error rendering data template: ValueError: Template error: float got invalid input 'None' when rendering template '{{ ( 0.77 * state_attr('light.bedroom_ceiling', 'brightness')|float +77 )|int }}' but no default was specified

#
  - light:
      - name: "Bedroom Ceiling"
        turn_on:
          service: light.turn_on
          data:
            entity_id: light.bedroom_ceiling_lights
        turn_off:
          service: light.turn_off
          data:
            entity_id: light.bedroom_ceiling_lights
        set_level:
          service: light.turn_on
          data_template:
            entity_id: light.bedroom_ceiling_lights
            brightness: "{{ ( 0.77 * state_attr('light.bedroom_ceiling', 'brightness')|float +77 )|int }}"
grand cove
hollow wyvern
#

Ah there we go

  - light:
      - name: "Bedroom Ceiling"
        state: >
          {% set state = states('light.bedroom_ceiling_lights') %}
          {% if state == 'on' %}
            On
          {% else %}
           Off
          {% endif %}
        turn_on:
          service: light.turn_on
          data:
            entity_id: light.bedroom_ceiling_lights
        turn_off:
          service: light.turn_off
          data:
            entity_id: light.bedroom_ceiling_lights
        set_level:
          service: light.turn_on
          data_template:
            entity_id: light.bedroom_ceiling_lights
            brightness: >
              {% set brightness = state_attr('light.bedroom_ceiling', 'brightness') %}
              {% if brightness is none %}
                {{ 0 |int }}
              {% else %}
                {{ ((brightness|float) * 70 / 255)|int }}
              {% endif %}