Sporo czasu próbowałem odtworzyć Twój brak działania reguły i rzeczywiście nie działa ona po tym jak kopiowałem regułę z forum. Po kilku próbach gdzie już nawet podejrzewałem błąd w oficjalnych wydaniach, kompilacji własnego pliku bin, w końcu wpadłem na pomysł aby wszystko wpisywać w konsoli z palca.
I jak się okazuje, wszystko działa zgodnie z tym co podałeś.
22:48:40.994 QPC: Reset
22:48:42.994 RSL: STATE = {"Time":"2024-06-14T22:48:42","Uptime":"0T00:00:09","UptimeSec":9,"Heap":151,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":0,"Berry":{"HeapUsed":4,"Objects":45},"POWER1":"OFF","POWER2":"OFF","Wifi":{"AP":1,"SSId":"dom","BSSId":"F0:9F:C2:7A:85:AF","Channel":6,"Mode":"HT20","RSSI":48,"Signal":-76,"LinkCount":1,"Downtime":"0T00:00:04"}}
22:48:43.030 RSL: SENSOR = {"Time":"2024-06-14T22:48:43","Switch3":"ON","Switch4":"ON"}
22:48:50.615 CMD: so114
22:48:50.617 RSL: RESULT = {"SetOption114":"OFF"}
22:48:57.775 RSL: RESULT = {"POWER1":"ON"}
22:48:57.776 RSL: POWER1 = ON
22:48:58.996 RSL: RESULT = {"POWER1":"OFF"}
22:48:58.997 RSL: POWER1 = OFF
22:49:04.065 RSL: RESULT = {"POWER1":"ON"}
22:49:04.066 RSL: POWER1 = ON
22:49:07.719 RSL: RESULT = {"POWER1":"OFF"}
22:49:07.720 RSL: POWER1 = OFF
22:49:13.393 CMD: so114 1
22:49:13.396 RSL: RESULT = {"SetOption114":"ON"}
22:49:15.171 RSL: RESULT = {"Switch3":{"Action":"TOGGLE"}}
22:49:18.222 RSL: RESULT = {"Switch3":{"Action":"TOGGLE"}}
22:49:18.922 RSL: RESULT = {"Switch3":{"Action":"TOGGLE"}}
22:49:19.072 RSL: RESULT = {"Switch3":{"Action":"TOGGLE"}}
22:49:32.026 CMD: switchmode3 1
22:49:32.029 RSL: RESULT = {"SwitchMode3":1}
22:49:37.056 CMD: switchmode4 1
22:49:37.058 RSL: RESULT = {"SwitchMode4":1}
22:49:42.139 RSL: RESULT = {"Switch3":{"Action":"OFF"}}
22:49:44.138 RSL: RESULT = {"Switch3":{"Action":"ON"}}
22:50:18.292 CMD: rule2 on switch3#state=1 do power1 1 endon
22:50:18.294 RUL: Stored uncompressed, would compress from 36 to 28 (-22%)
22:50:18.296 RSL: RESULT = {"Rule2":{"State":"OFF","Once":"OFF","StopOnError":"OFF","Length":36,"Free":475,"Rules":"on switch3#state=1 do power1 1 endon"}}
22:50:24.014 CMD: rule2 1
22:50:24.017 RSL: RESULT = {"Rule2":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":36,"Free":475,"Rules":"on switch3#state=1 do power1 1 endon"}}
22:50:26.037 RSL: RESULT = {"Switch3":{"Action":"OFF"}}
22:50:26.839 RUL: SWITCH3#STATE=1 performs 'power1 1'
22:50:26.844 RSL: RESULT = {"POWER1":"ON"}
22:50:26.845 RSL: POWER1 = ON
22:50:26.847 RSL: RESULT = {"Switch3":{"Action":"ON"}}
22:50:33.045 RSL: RESULT = {"Switch3":{"Action":"OFF"}}
22:50:34.597 RUL: SWITCH3#STATE=1 performs 'power1 1'
22:50:34.602 RSL: RESULT = {"POWER1":"ON"}
22:50:34.603 RSL: POWER1 = ON
22:50:34.605 RSL: RESULT = {"Switch3":{"Action":"ON"}}
22:50:50.199 RSL: RESULT = {"Switch3":{"Action":"OFF"}}
22:50:58.101 RUL: SWITCH3#STATE=1 performs 'power1 1'
22:50:58.106 RSL: RESULT = {"POWER1":"ON"}
22:50:58.107 RSL: POWER1 = ON
22:50:58.109 RSL: RESULT = {"Switch3":{"Action":"ON"}}
22:51:12.252 RSL: RESULT = {"Switch3":{"Action":"OFF"}}
22:51:15.954 RUL: SWITCH3#STATE=1 performs 'power1 1'
22:51:15.959 RSL: RESULT = {"POWER1":"ON"}
22:51:15.960 RSL: POWER1 = ON
22:51:15.962 RSL: RESULT = {"Switch3":{"Action":"ON"}}
W logach widać też zapisy fizycznego używania switch3.
Tak, że ten… cytując klasyka “u mnie działa”.
EDIT:
Znalazłem kluczową różnicę switch3#state=1
- okazuje się że nie działa tu zamienne używanie ON
z 1
.
Było:
rule2 on switch3#state=ON do power1 1 endon
Powinno być (aby działało):
rule2 on switch3#state=1 do power1 1 endon
Nie ma to natomiast znaczenia dla POWER1 - reguła działa zarówno dla ON
jak i 1
.
Na szczęście wielkość liter nadal nie ma znaczenia