Where did your button and hat be bought? Are there any key words?
Thank you. I like the ESP firmware and the rotary encoder.
I want to connect to rotary encoder on 8266, and then correspond to:
Gpio12= switch
Gpio0=DT
Gpio2=CLK
Gpio12=MOS field effect 1 (dimming)
Gpio4= MOS field effect 2 (dimming)
I am the condition.
I think how to write rules in ESP (Rules).
Let the rotary encoder gpio12 turn on the relay 1 at 1 times, hold one second to open the relay 2, rotate the relay 1 when rotating, and control the relay 2 when the rotation is held.
Can ESP firmware meet such requirements?
Thank you. I like the ESP firmware and the rotary encoder.
I want to connect to rotary encoder on 8266, and then correspond to:
Gpio12= switch
Gpio0=DT
Gpio2=CLK
Gpio12=MOS field effect 1 (dimming)
Gpio4= MOS field effect 2 (dimming)
I am the condition.
I think how to write rules in ESP (Rules).
Let the rotary encoder gpio12 turn on the relay 1 at 1 times, hold one second to open the relay 2, rotate the relay 1 when rotating, and control the relay 2 when the rotation is held.
Can ESP firmware meet such requirements?
I think you are confused. A relay is different to a dimmer. Nor can you rotate a relay.
Describing the error, I’m talking about using the field effect,STP16NF06,MOS can adjust current and use relays
Hi, I’m having some issues controlling a (hue) light group this way.
There is 6 lights in my group, but when I control it using this method, it’s really not working very smoothly. It’s extremely laggy and unreliable.
- id: woonkamer_2_dimmer_1
alias: "woonkamer 2 dimmer 1"
trigger:
platform: mqtt
topic: /ESP_Easy/rotary-1/rotary-1
action:
service: light.turn_on
entity_id: light.woonkamer_groep
data_template:
brightness: "{{states.sensor.woonkamer_2_rotary_1_normalised.state}}"
- platform: template
sensors:
woonkamer_2_rotary_1_normalised:
friendly_name: "woonkamer 2 Rotary 1 - normalised"
value_template: "{{ states.sensor.woonkamer_2_rotary_1.state | int **2 }}"
I had the same problem. The I switched to ESPHomelib and the dimming became much smoother.
this is my config:
esphomeyaml:
name: bedroom_dimmer
platform: ESP8266
board: nodemcuv2
wifi:
ssid: <SSID>
password: <password>
domain: '.local'
manual_ip:
static_ip: <IP>
gateway: <Gateway IP>
subnet: 255.255.255.0
api:
# Enable logging
debug:
logger:
level: VERBOSE
ota:
password: <password>
sensor:
- platform: rotary_encoder
name: "Rotary Encoder"
pin_a: D1
pin_b: D2
filters:
- or:
- debounce: 0.1s
- delta: 10
of the device and the automation on the home-assistant side:
- alias: dimmer changed
id: z3
initial_state: 'on'
trigger:
platform: state
entity_id: sensor.rotary_encoder_2
action:
service: light.turn_on
entity_id: light.nightstand
data_template:
brightness: '{{states.light.nightstand.attributes.brightness | int + (trigger.to_state.state|
int - trigger.from_state.state | int)*5 }}'
Thanks, tried this but I see no improvement at all. I was a bit skeptic in the first place since the rotary encoder state from espeasy is perfectly smooth from 1 to 100. I think things go south where home assistant tries passing the fast changing state of the encoder entity to the 8 lights of my light group.
For me there is a little lag, but it is definitely tolerable.
Very nice. thanks for sharing.
This has been on my to-do list for a very long time - actually I requested the author of esphomeyaml to add support for rotary encoders but I’m embarrassed to say that I never properly followed up to make use of it.
I will give this a go!
BTW did you do an OTA update from ESPEasy to esphomeyaml?
Or did you flash via serial?
I found the important part was the delta and debounce. Those two lines make esphomeyaml only put out a message when there has been significant turns.
sensor:
- platform: rotary_encoder
name: "Rotary Encoder"
pin_a: D1
pin_b: D2
filters:
- or:
- debounce: 0.1s
- delta: 10
maybe the delta could be less. But if you turn 15 steps and have an automation for every single step of course it gets slow.
Better to just do one automation…
I actually used a Wemos for the dimmer. I flashed via USB from esphoemyaml.
I did flash a sonoff basic via sonota and then flashed esphomeyaml via upload.
Finally done it - ESPEasy was buggy and whilst doing an OTA upgrade it borked the sonoff, so I re-implemented in ESPHome.
Works great with the hassio ESPhome addon, and the device was autodiscovered by HA via the API. Wonderful!
Here is my yaml:
esphome:
name: dimmer
platform: ESP8266
board: esp01_1m
wifi:
ssid: "SSID"
password: "password"
# Enable logging
logger:
# Enable Home Assistant API
api:
password: 'password'
ota:
password: 'password'
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "Dimmer Internal Button"
on_press:
- switch.toggle: relay
- platform: gpio
pin:
number: GPIO14
mode: INPUT_PULLUP
inverted: True
name: "Dimmer Push Switch"
switch:
- platform: gpio
name: "Dimmer Relay"
pin: GPIO12
id: relay
status_led:
pin:
number: GPIO13
inverted: yes
sensor:
- platform: rotary_encoder
name: "Dimmer Rotary Encoder"
pin_a: GPIO1
pin_b: GPIO3
min_value: 0
max_value: 100
resolution: 4
Discovered in HA and shown in integrations page:
Now I need to investigate the possibilities of double click, long click etc
esphome:
name: rotary01
## Woonkamer rotary controllers ingang
platform: ESP8266
board: d1_mini
wifi:
ssid: !secret esphome_wifi_ssid
password: !secret esphome_wifi_password
api:
password: !secret esphome_api_password
ota:
password: !secret esphome_ota_password
logger:
sensor:
### Rotary encoder 1
- platform: rotary_encoder
name: "Woonkamer 1 Rotary 1"
id: woonkamer1rotary1
pin_a: GPIO12
pin_b: GPIO13
filters:
- or:
- debounce: 0.1s
- delta: 3
resolution: 1
min_value: 1
max_value: 10
on_value:
then:
- homeassistant.service:
service: light.turn_on
data_template:
entity_id: light.woonkamer_groep
brightness_pct: "{{ brightness_1 | int }}"
variables:
brightness_1: 'return id(woonkamer1rotary1).state * 10;'
binary_sensor:
### Switch 1
- platform: gpio
pin: GPIO14
id: switch1
name: "Woonkamer 1 switch 1"
filters:
- invert:
on_multi_click:
- timing:
- ON for at most 0.4s
- OFF for at most 0.4s
- ON for at most 0.4s
- OFF for at least 0.2s
then:
- logger.log: "Double Clicked"
- homeassistant.service:
service: input_select.select_next
data:
entity_id: input_select.hue_scenes
- timing:
- ON for 0.6s to 3s
- OFF for at least 0.3s
then:
- logger.log: "Single Long Clicked"
- homeassistant.service:
service: input_boolean.toggle
data:
entity_id: input_boolean.radio_woonkamer
- timing:
- ON for at most 0.5s
- OFF for at least 0.4s
then:
- logger.log: "Single short Click"
- homeassistant.service:
service: light.toggle
data:
entity_id: light.woonkamer_groep
that was fast!
Thanks!
I’m planning to use node-red for routing events to actions, as opposed to calling HA API from ESPHome, since this is how I am working with other buttons (xiaomi/hue via zigbee2mqtt).
Just saw this usage for rotary encoder on a yeelight product that’s very similar to this project.
Nice ux for colour temp etc…
Could this be done with Tasmota instead of ESPEasy?
You know googling for tasmota rotary dimmer would find the answer.
I would recommend to use ESPHome now.