How to get the current PWM value in RULES #22918
-
Hello, Used: Rule2, button6, pwm8 It doesn't work for me to read in the current PWM: Rule2 ON button6#state==2 DO Backlog var1 pwm8; add1 5; pwm8 var1 ENDON How does it work? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
In many cases, the way to query some value is to first issue the command to have it printed/logged, and then use a separate rule to pick up the value from the command JSON result, similar to getting sensor values. And then a third rule to act on a calculation result. Something like Only a very few types can be referenced directly in rules. More generally, as you seem to be using ESP32, you also have the Berry language for more flexible and less quirky ways of doing automations. |
Beta Was this translation helpful? Give feedback.
In many cases, the way to query some value is to first issue the command to have it printed/logged, and then use a separate rule to pick up the value from the command JSON result, similar to getting sensor values. And then a third rule to act on a calculation result.
Something like
Rule2 on Button6#state==2 do Backlog PWM8 endon on PWM#PWM8 do var1=%value%+5 endon on var1#state do pwm8 %value% endon
Only a very few types can be referenced directly in rules.
https://tasmota.github.io/docs/Rules/#rule-variables
More generally, as you seem to be using ESP32, you also have the Berry language for more flexible and less quirky ways of doing automations.