Create dimmer from broadlink IR commands

Hello Home assistant experts!,

I would like to create a dimmer from IR commands that are send via the broadlink RM pro.
When i do a long press on my IR remote, the lights will dim.

I created 4 scripts based on IR codes from my remote: on/off/dim+/dim-. These scripts work fine when i run them in HA but i would like to implement these 4 scripts into 1 dimmer.

When i press on the dim+ script 5 times i noticed my lamps are at max brightness so one press is about 20%.
Based on that is would like to make a dimmer that runs the following scripts:

  • if slider is at 20%, run script dim+
  • if slider is at 40%, run script dim+ 2x
  • if slider is at 60%, run script dim+ 3x
  • if slider is at 80%, run script dim+ 4x
  • if slider is at 100% run script on
  • if slider goes down 20%, run script -

Because i want to use the dimmer in homekit. i would like to create a template.light but i have not yet acquired the skills how implement the scripts into the set_level variable.

If you guys have other suggestions how to create a dimmer from a switchs based on IR commands, i am happy to hear them!

Thanks in advance

Hi,

i managed to get my dimmer working partially.
when i set slider to value 51, 102, 153 etc, lights react accordingly.
however. when i but my slider down, nothing happens.

here is my code:

  - platform: template
    lights:
      lighttube1:
        friendly_name: "Light tube"
        level_template: "{{ states('input_number.slider1') | int >= 51 }}"
        value_template: '{{ states.input_boolean.lighttube_state.state }}'
        turn_on:
          - service: input_number.set_value
            data:
              entity_id: input_number.slider1
              value: 255
          - service: script.lighttube_on
        turn_off:
          - service: input_number.set_value
            data:
              entity_id: input_number.slider1
              value: 0
          - service: script.lighttube_off
        set_level:
          - service: input_number.set_value
            data_template:
              entity_id: input_number.slider1
              value: "{{ brightness }}"
          - service: script.lighttube_dimplus
            data:
              entity_id: input_number.slider1
              value: 51

            
input_number:
  slider1:
    name: Slider
    initial: 0
    min: 0
    max: 255
    step: 51

i hope someone can help me out

I realize this is almost 2 years old but did you ever get this working?
I’m trying to do the same. So far I have scripts which replicate all the remote buttons (on/off/dim/bright/warm/cool) but wish to template these into a light.

again after another 2 years I m trying to do the same. Any success?