Using hardware dimmer knob as fallback input to pwm led?

I’m trying to figure out just how to setup a pwm dimmer knob to esp8266 to act as fallback hardware input. IE change the knob, change the dimming level, but also change the dimming level via slider and ignore the knob input until it changes.

This example is a pwm output to control an led dimming.

light:
  - platform: monochromatic
    name: "Kitchen Lights"
    output: output_component1

# Example output entry
output:
  - platform: esp8266_pwm
    id: output_component1
    pin: D1

I want to add a pwm input as a hardware control (something like this) and it seems the pulse_counter would be the right choice

# Example configuration entry
sensor:
  - platform: pulse_meter
    pin: 12
    name: "Pulse Meter"

It seems I’d run the pulse_meter value into a filter that resolves the two values based on a on_change event (last one changed is the right value).

I’m not sure how to glue these together though, anyone tried this?

You should probably look at a rotary encoder.

That is interesting, thank you - in this case I know my “encoder” device feeds out pwm so I’ll need to read pulse_width or pulse_count etc.

I am not that much into the electronic parts, so you might have to ask again if you want to go with a rotary encoder.
Mentioning that in the title might draw the attention of some of the experts in that field.

1 Like