Please Help, esp8266 with Rotary encoder and dimmer module. Any advice programming espeasy.

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
djmeeg
New user
Posts: 4
Joined: 13 Feb 2018, 00:38

Please Help, esp8266 with Rotary encoder and dimmer module. Any advice programming espeasy.

#1 Post by djmeeg » 13 Feb 2018, 00:52

Hi Everyone,

I have spent some time now researching the best method to achieve the results I would like from this project. Basically, I would like to use a esp8266 with espeasy software with a rotary encoder and dimmer module attached. The Idea is that the esp running espeasy is programmed in the rules that if I turn on the light switch or change the dimming settings. This is done through the esp8266 but also sends a message to my mqtt server which then relays the message to homeassisant. Espeasy also needs to be programmed to change the dimming or turn on off the light after receiving a message from the mqtt server.

So far I have flashed a esp8266 node mcu with easyesp. But after reading espeasy wiki page it says it supports rotary encoders but I can find the switch type.

If anyone could help get me started it would be a big help. Right now I can't even add a rotary encoder installed to espeasy. I still then need to make rules and figure out how I send the pwm settings in a mqtt message 2 ways as described above. I hoping the community might help me on my way :)

Parts
Node mcu v1 esp8266 (flashed with Espeasy v2.0)
Keyes Rotary encoder
240v - 5v Stepdown
RobotDyn AC Light Dimmer Module

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Please Help, esp8266 with Rotary encoder and dimmer module. Any advice programming espeasy.

#2 Post by grovkillen » 13 Feb 2018, 06:43

What version exactly are you using? It should be in normal build for the Mega and in testing build for v2.0.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

djmeeg
New user
Posts: 4
Joined: 13 Feb 2018, 00:38

Re: Please Help, esp8266 with Rotary encoder and dimmer module. Any advice programming espeasy.

#3 Post by djmeeg » 13 Feb 2018, 15:14

HI grovkillen

Thanks for getting in touch. Yes I previously had the normal build but have now reflashed to the testing build v2.0.

I have a fair idea about home assistant but programming in espeasy to achieve what i want to do I know is possible but just cant figure it out. Any help would be mostly appreciated.

djmeeg
New user
Posts: 4
Joined: 13 Feb 2018, 00:38

Re: Please Help, esp8266 with Rotary encoder and dimmer module. Any advice programming espeasy.

#4 Post by djmeeg » 01 Mar 2018, 05:08

Update *

Please anyone who could help me here it would be appreiated I am stuck trying to get this code to work. To reiterate I have the following:
Node mcu v1 esp8266 (flashed with Espeasy v2.0 TEST)
Keyes Rotary encoder
240v - 5v Stepdown
RobotDyn AC Light Dimmer Module

What I want to add to the rules is this:
1.When I turn the rotary encoder, the value is read and converted to a pwm valve.
2.The pwm value is then sent to the dimmer module to alter the dimming on the light.
3.I also need the pwm to be sent to my mqtt broker so that home assistant can also update the state of the switch
4.I would also like to control the dimming of the light through home assistant. So I need easyesp to also listen on a mqtt topic to receive pwm values and update the switch accordingly. So 2 way communication.
5. The rotary encoder also has the push button. So when you click in the rotary encoder it acts like a switch. I would also like to implement this so when you click the rotary encoder it turns the lights off and on. Again 2 way with mqtt.

I had some help from a very helpful member who gave me this code to try. However if I reset the unit it stops responding once I save the code :(

I have included screen shots of my setup also. If anyone can help with the code in the rules or tell me where my settings are wrong that would be ace!
Attachments
Screen Shot 2018-02-19 at 18.29.04.png
Screen Shot 2018-02-19 at 18.29.04.png (62.82 KiB) Viewed 6647 times
Screen Shot 2018-02-19 at 18.28.24.png
Screen Shot 2018-02-19 at 18.28.24.png (63.6 KiB) Viewed 6647 times
Screen Shot 2018-02-19 at 18.27.55.png
Screen Shot 2018-02-19 at 18.27.55.png (51.21 KiB) Viewed 6647 times
Screen Shot 2018-02-19 at 18.27.42.png
Screen Shot 2018-02-19 at 18.27.42.png (64.79 KiB) Viewed 6647 times
Screen Shot 2018-02-19 at 18.26.53.png
Screen Shot 2018-02-19 at 18.26.53.png (75.44 KiB) Viewed 6647 times
Screen Shot 2018-02-19 at 18.26.32.png
Screen Shot 2018-02-19 at 18.26.32.png (93.37 KiB) Viewed 6647 times
Screen Shot 2018-02-19 at 18.26.05.png
Screen Shot 2018-02-19 at 18.26.05.png (68.73 KiB) Viewed 6647 times

djmeeg
New user
Posts: 4
Joined: 13 Feb 2018, 00:38

Re: Please Help, esp8266 with Rotary encoder and dimmer module. Any advice programming espeasy.

#5 Post by djmeeg » 01 Mar 2018, 05:09

On dimmer#counter Do
Event,DimLight=[dimmer#counter]*10 //since you might want the counter to be 0..100
Endon

On button#push Do
TaskValueSet,2,1,[dummy#pushcount]+1
TimerSet,1,1
Event,DimLight=0
Endon

On DimLight Do
//PWM,15,%eventvalue%
Publish,%sysname%/light,PWM level: %eventvalue%
//TaskValueSet,1,1,%eventvalue%/10
Endon

On Rules#Timer=1 Do
If [dummy#pushcount]>1
//do what you want and reset the dummy
TaskValueSet,2,1,0
Else
TaskValueSet,2,1,0
Endif
Endon

codesnipper
New user
Posts: 1
Joined: 24 Nov 2018, 19:15

Re: Please Help, esp8266 with Rotary encoder and dimmer module. Any advice programming espeasy.

#6 Post by codesnipper » 24 Nov 2018, 19:21

I want connect this robotdyn dimmer to easyesp, can you explain, how did you done that?

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests