Is it possible-ESPhome potentiometer to control different devices?

I’m wondering if it’s possible to hook an ESP home device equipped with a potentiometer to control devices like light dimming, fan speed, thermostats, speaker volume, and other devices that might take variable inputs easier done with a knob.

I’m also wondering if the Phillips hue aurora wireless dimmer switch (I already have this in home assistant) could be used for the same purpose.

It would be great to be able to control multiple devices with a single potentiometer or Aurora, but I’d be fine with having a dedicated knob per device if that’s the best that could happen.

Yes. Sure this is possible. Where exactly is your problem?
Attach the poti to the ADC input (make sure to obey the ADC voltage range of your MCU). Use an Analog To Digital Sensor to transfer the ADC value to HA. In HA create an automation to control whatever you want with the ADC value.

1 Like

Thanks, I’m a noob and have had HA for a matter of weeks. I understand most of what you said. I’m not sure how to expose the potentiometer values to HA yet. You said to use an analog to digital sensor. Can you explain that a bit further?

Did you see this?

And you can combine the ADC sensor with the linear calibration option.


Other idea, use a rotary encoder (same same but different).

They can turn “unlimited” and most of them have even a “push button” integrated on the shaft.

The esphome integration makes it also much easier to work with compares to the adc component:


This sounds like you have never exposed any ESPHome sensor to HA? The process is really simple!
I recommend that you check some Youtube videos about that. There are plenty available.

In a nutshell: You add some sensor in your ESPHome YAML (i.e. the fore-mentioned Analog To Digital Sensor) together with the WiFi Component and the API Component and that’s it. Just compile and upload the code to the MCU.
When HA sees your MCU for the very first time you may have to accept the newly found ESPHome device in HA’s frontend in the section Configuration → Integrations. But you only need to do this once.

Thanks so far. Struggling with the automation part now.

I have a the esp equipped with a rotary encoder and see the change in my dashboard however I’m not sure how to pass the value to a light to dim or brighten it when the encoder changes value. Under the “Actions”, is there something I’m missing. I feel like I should see a way to pass in my rotary encoder value.

Not an automation expert (as I do all this in Node Red) but this should work:
Set action to “Call service”, service to “Light: turn on”, add your target entity, switch to YAML mode (three dot menu) and add a data_template: block that sets the brightness: data parameter with a template that references the state of your rotary switch entity.

Should be something like:

  service: light.turn_on
  entity_id: light.office_light
    brightness: >
      {{ states('sensor.rotary_encoder_3')|int }}

Also see this posting:

A little futher, still on the automation.

So this automation seems to trigger only when I pass the “0” and “100” thresholds. It doesn’t trigger continuosly. Seems like I should find a value change trigger?

What I have so far:

description: ''
  - type: value
    platform: device
    device_id: 5685ed64cdeb6b9181c03e4a330101b4
    entity_id: sensor.rotary_encoder_3
    domain: sensor
    id: sensor.rotary_encoder_3
    above: 0
    below: 100
condition: []
  - service: notify.notify
      message: value changed
  - data_template:
      brightness: '{{states(''sensor.rotary_encoder_3'')|int }}'
    entity_id: light.round
    service: light.turn_on
mode: parallel
max: 10

Not even a thank you. Just the next request for help.
Very rude.

Ah sorry, I am actual very grateful for the help so far. I am learning from the forum and respect your time and contribution here.

Got this going with @Jpsy and @tom_l 's help. Thanks, working well with a WemosEsp $3 and a rotary encoder $2. Need to come up with an enclosure…


alias: Small Volume Knob
description: ''
  - platform: state
    entity_id: sensor.rotary_encoder5
    id: sensor.rotary_encoder5
condition: []
  - service: media_player.volume_set
      device_id: 5a3838ba2c012cf630bbddda0b307ee8
      volume_level: '{{ ( states(''sensor.rotary_encoder5'')|float(0) * 0.01 )|round(2) }}'
mode: parallel
max: 10


  name: small-esp
  platform: ESP8266
  board: esp01_1m

# Enable logging

# Enable Home Assistant API

  password: "ef4dbb1586c342eaf9512a110bf94e42"

  ssid: !secret wifi_ssid
  password: !secret wifi_password


  # Enable fallback hotspot (captive portal) in case wifi connection fails
    ssid: "Small-Esp Fallback Hotspot"
    password: "SqioPkLZTB80"

  - platform: rotary_encoder
    name: "Rotary_Encoder5"
    pin_a: GPIO5
    pin_b: GPIO4
  - platform: gpio
    pin: GPIO2
    name: "High"
    restore_mode: RESTORE_DEFAULT_ON



Very nice compact :pinching_hand: build :+1:
Are you powering the encoder (+) from pin D4 on your d1 mini? :thinking:


have to type at least 10 characters to post.

nice :wink: