Rotary Encoder set values

Moderators: grovkillen, TD-er, Stuntteam

Post Reply
Message
Author
Swagner
Normal user
Posts: 4
Joined: 14 May 2020, 17:45

Rotary Encoder set values

#1 Post by Swagner » 14 May 2020, 18:01

Hello All,

I have the following situaton and would like to know how to set the value for the Rotary Encoder in the Rules.

The Rotary Encoder is used to set three different Relais depending on the values, this works already.
When I push the switch all relais will be turned off and now the rotary switch need to set to 0, this doesn't work.
MQTT should be used to set the Rotary Encoder value to turn on/off the Relais via MQTT Broker or I turn on/off the relais and the Rotary Encoder Value will be set.

When I would uses TaskValueSet and a dummy device for this how I can ensure the Rotary Switch will not reach the max or min limit and would stop working ?

Thanks and cheers,

Stefan

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

Re: Rotary Encoder set values

#2 Post by grovkillen » 14 May 2020, 18:09

You can have events that checks if it's above or below your preferred values. It it is, just set it to max/min accordingly.
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:

Swagner
Normal user
Posts: 4
Joined: 14 May 2020, 17:45

Re: Rotary Encoder set values

#3 Post by Swagner » 14 May 2020, 19:40

Hi Grovkillen,

I guess it's easier with an example:

The Rotary Encoder has min. 0 and max. 3 set (it doesn't matter when a higher number is used it will possible just delay the problem)

a.) Rotary Encoder Switch ON
- When the Rotary Encoder is 1 Relais 1 is on
- When the Rotary Encoder is 2 Relais 2 is on
- When the Rotary Encoder is 3 Relais 3 is on

b.) Rotary Encoder Switch OFF will set Relais 1,2,3 to OFF

When b.) is done the the Rotary Encoder Value is not changed I have to build this by using a Dummy device and EventSetValue (I guess this should work) BUT:
When the Dummy device Value = 0 and all Relais are OFF the Rotary Encoder Value will be still 3 --> The Rotary Encoder has the max value reached and there is no Trigger which can increase the Dummy device Value when I move the rotary encoder to the right or is the a way how to solve this ?

PS: Similar situation can happen when MQTT is used to change the Dummy device value or turn ON/OFF the Ralais 1-3, I didn't found information how to set the Rotary Encoder Value to 0 or any other Value.

Thanks and cheers,

Stefan

Swagner
Normal user
Posts: 4
Joined: 14 May 2020, 17:45

Re: Rotary Encoder set values

#4 Post by Swagner » 17 May 2020, 18:17

Hi All,

I did several tests and I am not sure if this is a bug or normal, can somebody confirm this ?

I have created the following Rule#

on Rotary#Counter do
TaskValueSet 1,1,[Rotary#Counter]
Publish %sysname%/Counter/Set,[Rotary#Counter]
endon

on Relais#State do
TaskValueSet 2,1,[Relais#State]
Publish %sysname%/Relais/Set,[Relais#State]
endon

on Relais#State=0 do
TaskValueSet 1,1,[Rotary#Counter]=0
Publish %sysname%/Counter/Set,0
endon


When the Relais = 1 and the Rotary to 5
1_5.JPG
1_5.JPG (44.49 KiB) Viewed 486 times

When the Relais = 0 the Rotary will be set to 0
0_0.JPG
0_0.JPG (42.47 KiB) Viewed 486 times

Now the Relais = 1 and the Rotary is still set to 0
0_1.JPG
0_1.JPG (45.16 KiB) Viewed 486 times

Now the Problem when I move the Rotary Encoder it doesn't start with "0" it will start with the last number which was used before it was set to "0" so in this case it will start with a unvisible 5 and change it to 4 or 6
6_1.JPG
6_1.JPG (42.99 KiB) Viewed 486 times

Cheers,

Stefan

Swagner
Normal user
Posts: 4
Joined: 14 May 2020, 17:45

Re: Rotary Encoder set values

#5 Post by Swagner » 19 May 2020, 22:10

Hi All,

I did now several hours of tests and it's impossible to overwrite the Rotary Encoder Value by using TaskValueSet.
When TaskValueSet is used the Rotary Encoder Value will change but this is not persistent and the Rotary Encoder will always start with the previous used Rotary Encoder Value.

For all who searched already, there is no command which can be used in the Rules to set the Rotary Encoder to a Start Value or set it to "0"
I have tested with Release mega-20200515

When both GPIO Ports are set to 0 the Rotary Encoder Value can't be changed anymore when the Rotary Encoder is manually moved to left or right.
When both GPIO Ports are set to 1 the Rotary Encoder Value can be again changed when the Rotary Encoder is manually moved to left or right, it will not start from 0 or a set Value.
A combination of "0" and "1" can be used on the GPIO Ports to count +1 or -1 for the Rotary Encoder Value

Possible the only way is to use MQTT but I didn't tested it and I also expect it will not work and the Rotary Encoder will still start from the previous used value.

Hope this save others some time,

Cheers,

Stefan

PS: Thanks to all who are working on the ESP Mega Developement, I always wondering how much can be already done with the ESP

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests