Last active
November 8, 2024 00:59
-
-
Save tkroo/5187c92e445696696e7b3683e03fe468 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 192.168.0.31 | |
# https://esphome.io/components/sensor/rotary_encoder.html | |
substitutions: | |
name: esphome-web-1caba8 | |
friendly_name: c3pico-rotary | |
esphome: | |
name: ${name} | |
friendly_name: ${friendly_name} | |
min_version: 2024.6.0 | |
name_add_mac_suffix: false | |
project: | |
name: esphome.web | |
version: dev | |
esp32: | |
board: esp32-c3-devkitm-1 | |
framework: | |
type: arduino | |
# Enable logging | |
logger: | |
# Enable Home Assistant API | |
api: | |
# Allow Over-The-Air updates | |
ota: | |
- platform: esphome | |
# Allow provisioning Wi-Fi via serial | |
improv_serial: | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
dashboard_import: | |
package_import_url: github://esphome/firmware/esphome-web/esp32c3.yaml@main | |
import_full_config: true | |
number: | |
- platform: template | |
id: "rot_max" | |
name: "Rotation max value" | |
optimistic: true | |
min_value: 0 | |
max_value: 254 | |
step: 1 | |
on_value: | |
then: | |
lambda: | |
id(my_rotary_encoder)->set_max_value(x); | |
sensor: | |
- platform: rotary_encoder | |
id: my_rotary_encoder | |
name: "Rotary Encoder" | |
min_value: 0 | |
max_value: 100 | |
resolution: 1 | |
pin_a: | |
number: 4 | |
mode: | |
input: true | |
pullup: true | |
pin_b: | |
number: 5 | |
mode: | |
input: true | |
pullup: true | |
on_clockwise: | |
- logger.log: "Clockwise" | |
on_anticlockwise: | |
- logger.log: "Anticlockwise" | |
binary_sensor: | |
- platform: gpio | |
pin: | |
number: 0 | |
inverted: true | |
mode: | |
input: true | |
pullup: true | |
name: "rotary button" | |
id: "rotary_press" | |
on_click: | |
then: | |
- logger.log: "button pressed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment