Rule triggers Range value change

88 views
Skip to first unread message

Kabak Kabak

unread,
Oct 16, 2021, 8:27:23 AM10/16/21
to TasmotaUsers
Hi,

When we use an analog pin for the dimmer, we can use the rule:

rule1 ON analog#a0div10 DO dimmer %value% ENDON

As a result, the value will only be updated on changes. Which allows you to simultaneously modify the settings from the potentiometer and from the network (eg Home Assistant).

Unfortunately, my knob needs to be scaled up and range shited.
So i have to use "ADC range" instead of analog pin. I have a pin configured as ADC Range, and assigned AdcParam 6, scaling my range to 0-100.
My rule looks like this:

rule1 ON analog#range DO dimmer% value% ENDON

Unfortunately, this rule will constantly override the values sent from the Home Assistant.

My question, how to get trigger effect only when value change with scaled ADC Range input? Something like analog#rangediv10 trigger

Regards.

Philip Knowles

unread,
Oct 16, 2021, 3:28:25 PM10/16/21
to Kabak Kabak, TasmotaUsers

I don’t know if it will work but you could try

rule1 ON analog#range#div10 DO dimmer %value% ENDON

You haven’t given your scaling parameters but you could try just setting var1 which you then mult1 to scale followed by add1 to shift the range before you send to the dimmer.

 

Regards

 

Phil K

 

Sent from Mail for Windows

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/5eaa9073-586b-4715-89b4-ad1b885787een%40googlegroups.com.

 

Kabak Kabak

unread,
Oct 17, 2021, 3:20:47 PM10/17/21
to TasmotaUsers
Thanks for your reply and suggestions. I'll try to test it tomorrow.

My previous configuration
A0 GPIO17 ADC Input
AdcParam deault, I haven't touched
Rule1 ON analog # a0div10DO dimmer% value% ENDON

Thanks to such a rule, I had a trigger only when the ADC value changed. But since my knob starts with ADC = 6, I often have the light ON after a reset.

My current setup is:
A0 GPIO17 ADC Range
AdcParam 6,10,1023,0,100
Rule1 ON analog # range DO dimmer% value% ENDOP

The full range is shifted so that it starts at 10 and re-scaled to 0-100. But I can't modify the settings from Home assistant anymore.

Philip Knowles

unread,
Oct 17, 2021, 4:26:14 PM10/17/21
to Kabak Kabak, TasmotaUsers

OK so remove the adcParam 6

 

Rule 1 on analog#a0div10 do backlog scale1 %value%, 10,1023,0,100; dimmer %var1% endon

Reply all
Reply to author
Forward
0 new messages