-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rotary Encoder working with Shelly Dimmer 1/2 #10407
Comments
Thx. Will find a way to integrate. |
Add rotary No Pullup GPIO selection ``Rotary A/B_n`` (#10407)
The latest commit adds the option to select Rotary GPIO with no pullup. I haven't tried it yet but you might want to change the following in the Shelly Dimmer 1/2 template:
and see how it works. Suggested template:
|
Thank you for your work and Time! SetOption98 0 //turn off rules, turn on direct light Forced Mi Desk Lamp (66) as base model and introduced your suggested template. No trigger or output with (Rotary A_n and Rotary B_n) or (Rotary A and Rotary B). Changed to Generic (18) module, with you template No trigger or output with (Rotary A and Rotary B) Success with (Rotary A_n and Rotary B_n), Result: 06:37:32.954 RSL: /RESULT = {"POWER":"OFF","Dimmer":0} It also works with rules, just limited between 0 and 10 because i've not changed ROTARY_MAX_STEPS 10, but the step is 1. In resume:
Detected problems:
I am at yout disposal for testing more, and for new Detected Problems also. PS: Today i learned how important is to reset config between compiles. |
Thx
So this
If Rotary A and Rotary B no values are changed because they work with INPUT_PULLUP has been solved? |
Before your commit, Rotary Encoder imply INPUT_PULLUP, and Shelly Dimmer 1/2 and virtually many other devices don't work with REncoder. This behaviour is what i observe compiling your late dev commit with reset config on my behalve:
So after your commit we have the option to select two types of rotary encoder pinmodes. But because initially i've not reseted the config, what i was observing is the opposite:
This is probably due to the way config is managed, between compiles the table of sensors changed, and an incorrect assignment of gpio could occur!? Right now i don't have sufficient Tasmota knowledge to assume that. I've just mentioned this because i've litterally tested for hours with the opposite behaviour. What i do if i was you is the creation of a new SetOptionXXX Rotary Encoder Pin Mode
Because no other input pinmodes are possible, and Rotary A versus Rotary A_n is confuse without doc. The only limitations i found is:
|
Support rotary encoder on Shelly Dimmer (#10407)
Thx. I build the hardware connection to a Shelly Dimmer 2 as documented here https://www.instructables.com/Shelly-Dimmer-Wall-Switch-With-Rotary-Knob-and-Hom/ and it works using this template:
and new command |
Add command ``SetOption43 1..100`` to control Rotary step (#10407)
reset again load your template that have base 66, i'm having huge debounce problems: 18:10:32.497 /RESULT = {"POWER":"ON","Dimmer":88} I dont have a switch button on my encoder, maybe this mess up the code But with Generic 18 and LedTable 0: 18:28:54.845 /RESULT = {"POWER":"OFF","Dimmer":0} |
Yeah it seems very Rotary Encoder hardware dependant. Did you do the NOTE: I had the debounces when using BASE 18.... With BASE 66 it is very stable:
|
Literally: and unusable debounce problems. With: 18:28:54.845 /RESULT = {"POWER":"OFF","Dimmer":0} But i think if you use Base 66, the code used expect Button values that i don't have. |
Shelly Dimmer 2 pinout is different than 1. Maybe thats the reason why your BASE 18 results are bad!? The correct pinout is this: |
I have used the ky-040 rotary encoder connected to the header connector and flashed the dimmer with ESPEASY and use the dimmer as a remote sending http commands via Rules. This is working great but I would love the Tasmota firmware to work with the Dimmer2 and the rotary encoder. |
@Maikel-K Tasmota supports rotary decoder with Shelly dimmer 2. |
Still in testing mode right? |
Sure. On off is easy, works always with Tasmota. Just a button define. |
Tested with a different encoder EC11E12-15P30C-SW This one already have a switch. Now the behaviour is similar to @arendst , as it only works with BASE 66 and not with BASE 18. So his assumption that different Rotary Encoder could imply different Base Models is correct. DimmerStep doesn't affect results 01:12:06.173 RSL: RESULT = {"POWER":"ON","Dimmer":6} A little fast on the knob and we could get faster dimmming, or no result change at all. |
Hi, I'm considering using a Shelly Dimmer 2 & rotary encoder to replace my traditional dimmer switches which use a rotary control by pulling off the knob and replacing the dimmer module with the rotary encoder / shelly dimmer 2 so I can keep the brushed stainless steel look. I've never use the Dimmer 2 (but I haved used 1, 1PM, 2 etc), but I'm concerned that since it's intended that the SW1 / SW2 are normally connected to either L or N via a switch, that connecting the rotary encoder between GND and SW1 / SW2 could exceed the voltage rating on the rotary encoder. I know the Shelly design generally means the voltage is floating and that the GPIOs could have a high voltage on them if reference to L or N (but 3.3V between pins on the GPIO connector). Doesn't this imply there could be a high voltage between GND and SW1/SW2? Aren't the SW1 / SW2 normally floating at around 120V (for a 240V L)? Has anyone actually measured this voltage? Am I worrying unncessarily? Thanks |
Shelly has it on its site https://shelly.cloud/knowledge-base/devices/shelly-dimmer-2/#projects |
Indeed I would not send mains voltage in a rotary encoder. If you can validate this, it would be worth adding in Tasmota documentation or template page. |
I have asked Shelly about this and reproduce their reply below.
So despite linking the article from their website which could be regarded as an endorsement of the project, they're not prepared to comment on it's safety or the electrical characteristics of the Dimmer 2 -
I'm a big fan of the Shelly devices, but disappointed by their support response. They encourage creative uses and flashing alternative firmware, but aren't clear on the electrical details. It looks like an empirical approach is required and actually measuring the voltage will be necessary. |
I would more open it and try to reconstruct the schematic |
I don't know why we want Shelly to behave differently. |
@BPSoft I disagree. The have posted on there website a modification, without a disclamer. If it is dangerous it is everything else as professional. |
Yes i am well aware of the modification on their web site and i think it is criminal, not just because of the risks i mentioned before, but also because they link the modification to an instructable that belongs to a different hardware (Shelly Dimmer 1). |
Just to clarify, you say the Shelly Dimmer 2 is AC connected thru GPIO, yet you started this thread/issue around connecting a Rotary encoder to the SW inputs on the shelly dimmer 2 and linked to GND on the GPIO header. And you're ok with this and any potential issues? |
Well it didn’t took long, I figured it out myself… |
I don't know where you read that SetOption 62 would disable the internal pull-up as it's related to MQTT messages I assume pin 1 goes to GND? |
Yes, pin 1 in my drawing goes to GND, 2 to GPIO0 and 3-4 to SW1/SW2. I read about SetOption 62 at the docs for Shelly 2 but I see now at the commands docs that it is for mqtt as you say, so the shelly2 page is wrong/outdated. Something strange but the whole thing stopped working in front of my eyes… no magic smoke but I was at the console and saw how the dimmer messages started to slow down and then got totally unresponsive. Then no response at all to rotation or push anymore. I have measured the board and everything seems to be OK there, something might have got fried inside the shelly… I have put the shelly back to normal dimmer configuration so on/off gets controlled with sw1/sw2 but that doesn’t seem to be working either, so something might have got broken… I have another spare shelly dimmer so I will see if I can get that one working, hopefully not frying it. I will also flash tasmota from scratch in the one I have used now and see if that gets it back on track… Do you now if disabling the internal pullups creates a risk for internal components getting fried? |
PROBLEM DESCRIPTION
I've a rotary encoder (PEC11L without On/Off switch) connected to a Shelly DImmmer 2.
Conection is similar to Instructable:
https://www.instructables.com/Shelly-Dimmer-Wall-Switch-With-Rotary-Knob-and-Hom/
Shelly
SW1 < -------- > PinA
GND < -------- > PinC
SW2 < -------- > PinB
In Tasmota library "support_rotary.ino", lines 139 and 140 we have:
Problem is that for hardware reasons an INPUT_PULLUP will not work with Shelly Dimmer 1/2 and probably other devices.
I've changed to:
After compile, everything is working extremely well!
These two lines are shared with both:
I recommend the separation of pinMode by Rotary.model, either changing the Normal Rotary Model or creating a New Model.
For a Normal Rotary Encoder the number of steps doesn't matter, but this change:
Will ease the rule set because we can do a direct rule like this:
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Backlog Template; Module; GPIO 255
:Backlog Rule1; Rule2; Rule3
:Status 0
:weblog
to 4 and then, when you experience your issue, provide the output of the Console log:TO REPRODUCE
Steps to reproduce the behavior:
EXPECTED BEHAVIOUR
A clear and concise description of what you expected to happen.
SCREENSHOTS
If applicable, add screenshots to help explain your problem.
ADDITIONAL CONTEXT
Add any other context about the problem here.
(Please, remember to close the issue when the problem has been addressed)
The text was updated successfully, but these errors were encountered: