Skip to content

Rotary Encoder Support#415

Draft
Haydend wants to merge 64 commits into
romasku:mainfrom
Haydend:dunnicliffeh/encoder
Draft

Rotary Encoder Support#415
Haydend wants to merge 64 commits into
romasku:mainfrom
Haydend:dunnicliffeh/encoder

Conversation

@Haydend
Copy link
Copy Markdown
Contributor

@Haydend Haydend commented May 2, 2026

Hi,

I've been working on adding support for Rotary Encoders to your firmware. Is this something you'd be interested in merging?
This work is still rough and in progress, just wanted to get it out there early for feedback.
Currently it supports detecting and sending the commands to bound devices. But there is no config or multistate.

Demo

Rotary.Encoder.Demo.720.mp4

Motivation

My dream 'light switch replacement' for my smart home is a device which looks like a normal dimmer switch, is mains powered, and does on/off, brightness and color temp, via bindings. For use with smart bulbs which are always powered. I haven't found such a device, so I decided to look into creating my own. Currently I'm using 3 of the inputs from a TS0004 (https://www.zigbee2mqtt.io/devices/TS0004_switch_module.html) with a basic dev kit rotary encoder (https://www.ebay.co.uk/itm/365206572477).
There are some battery devices which I believe this change would add support for, like https://www.zigbee2mqtt.io/devices/ERS-10TZBVK-AA.html I have some, but I have not tested this on them yet.

Unit Tests

The branch also includes support for unit tests, using Unity and CMock. This was something I really wanted, as my unfamiliarity with this type of programming meant I was often unsure about behaviour and needed to test it. It can of course be dropped from this merge, but I think it has value.

Disclaimer ;)

I'm a professional Java and Node engineer. But C, Make and programming for embedded systems are completely new to me and very different! (though also very interesting). I have probably brought some of my high-level language habits with me. So please advise on any code smells, etc. Feedback very welcome!

Haydend added 30 commits May 2, 2026 15:15
Not done yet!
This allows us to drop all reference to the hal stub. And to control the response from hal_millis()
Tested by binding a light and toggling it on & off
…oggle command and level up/down

Will re-add logic as when we need a feature
@Haydend Haydend force-pushed the dunnicliffeh/encoder branch from 986df4b to 6569123 Compare May 2, 2026 14:22
Comment thread src/device_config/config_parser.c
@Ctrl-F4
Copy link
Copy Markdown

Ctrl-F4 commented May 8, 2026

Very interesting! I think a valuable addition to this fw!

The ERS-10TZBVK-AA you mention default FW has an annoying issue (trigger accidentally toggle between COMMAND and EVENT mode) If your fw addition could solve this then that would be great.
It seems to have a EFR32MG21 chip inside (bootloader available in this repository)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants