gemu2015 / Sonoff-Tasmota

Tasmota Fork TCS34725,PN532_i2,ccc1101 Moritz support,m5stack 4,7 epaper, hotplug drivers
GNU General Public License v3.0
24 stars 19 forks source link

chg[var] not working #53

Closed pkkrusty closed 9 months ago

pkkrusty commented 9 months ago

PROBLEM DESCRIPTION

When I use chg[var] to try and trigger an if...then statement, nothing happens.

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

- [ ] Provide the output of this command: `Status 0`:

15:42:13.758 MQT: pivot-local/stat/STATUS = {"Status":{"Module":18,"DeviceName":"Pivot Local","FriendlyName":["Pivot Local","Tasmota2","Tasmota3"],"Topic":"pivot-local","ButtonTopic":"0","Power":1,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":0,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0,"InfoRetain":0,"StateRetain":0,"StatusRetain":0}} 15:42:13.765 MQT: pivot-local/stat/STATUS1 = {"StatusPRM":{"Baudrate":9600,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://ota.tasmota.com/tasmota/release/tasmota.bin.gz","RestartReason":"Software/System restart","Uptime":"0T00:39:55","StartupUTC":"2023-09-29T15:02:18","Sleep":50,"CfgHolder":4802,"BootCount":10,"BCResetTime":"2023-09-25T13:19:04","SaveCount":41,"SaveAddress":"FD000"}} 15:42:13.773 MQT: pivot-local/stat/STATUS2 = {"StatusFWR":{"Version":"13.1.0.3(tasmota)","BuildDateTime":"2023-09-25T13:11:10","Boot":31,"Core":"2_7_4_9","SDK":"2.2.2-dev(38a443e)","CpuFrequency":160,"Hardware":"ESP8266EX","CR":"454/699"}} 15:42:13.779 MQT: pivot-local/stat/STATUS3 = {"StatusLOG":{"SerialLog":0,"WebLog":3,"MqttLog":0,"SysLog":2,"LogHost":"","LogPort":514,"SSId":["beersheba","pkkrusty"],"TelePeriod":900,"Resolution":"55C181C0","SetOption":["00608008","2805C80001000600003C5A00192800000000","000000C9","08006000","00004000","00000000"]}} 15:42:13.788 MQT: pivot-local/stat/STATUS4 = {"StatusMEM":{"ProgramSize":624,"Free":1420,"Heap":14,"ProgramFlashSize":4096,"FlashSize":4096,"FlashChipId":"1640D8","FlashFrequency":40,"FlashMode":"DOUT","Features":["00000809","0780068F","04080001","0000800F","00000600","40000000","00000080","00200000","00000800","00000000"],"Drivers":"1,2,3,4,8,9,10,20,38,50,56,59","Sensors":"1,2,3,12","I2CDriver":"13,26"}} 15:42:13.796 MQT: pivot-local/stat/STATUS5 = {"StatusNET":{"Hostname":"pivot-local","IPAddress":"192.168.3.87","Gateway":"192.168.2.1","Subnetmask":"255.255.254.0","DNSServer1":"192.168.2.1","DNSServer2":"0.0.0.0","Mac":"8C:CE:4E:CC:FB:17","Webserver":2,"HTTPAPI":1,"WifiConfig":4,"WifiPower":17.0}} 15:42:13.801 MQT: pivot-local/stat/STATUS6 = {"StatusMQT":{"MqttHost":"192.168.3.48","MqttPort":1883,"MqttClientMask":"pkkrusty%06X","MqttClient":"pkkrusty_CCFB17","MqttUser":"pkkrusty","MqttCount":1,"MAX_PACKET_SIZE":1200,"KEEPALIVE":30,"SOCKET_TIMEOUT":16}} 15:42:13.807 MQT: pivot-local/stat/STATUS7 = {"StatusTIM":{"UTC":"2023-09-29T15:42:13","Local":"2023-09-29T15:42:13","StartDST":"2023-03-26T02:00:00","EndDST":"2023-10-29T03:00:00","Timezone":"+00:00","Sunrise":"06:56","Sunset":"18:58"}} 15:42:13.814 MQT: pivot-local/stat/STATUS10 = {"StatusSNS":{"Time":"2023-09-29T15:42:13"}} 15:42:13.821 MQT: pivot-local/stat/STATUS11 = {"StatusSTS":{"Time":"2023-09-29T15:42:13","Uptime":"0T00:39:55","UptimeSec":2395,"Heap":14,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER1":"ON","POWER2":"OFF","POWER3":"OFF","Wifi":{"AP":1,"SSId":"beersheba","BSSId":"A0:F3:C1:DB:CF:51","Channel":6,"Mode":"11n","RSSI":46,"Signal":-77,"LinkCount":1,"Downtime":"0T00:00:06"}}}

- [ ] Provide the output of the Console log output when you experience your issue; if applicable:
  _(Please use_ `weblog 4` _for more debug information)_

Console output here:


### TO REPRODUCE
Use the following script to test:

D 48 SB=4096 IP=192.168.3.87 m:cvr=0 19 cntr=0 message="" I:fullepoch=0 slot=1 pow1=0 pow2=0 pow3=0 pwr1state="" pwr2state="" pwr3state="" cmnd="" value="" mln=0 valln=0 colon=0 rupsecs="" B pow1=1 pow2=1 pow3=1 S pow1=pwr[1] pow2=pwr[2] pow3=pwr[3] print %0pwr[1]%,%0pow1% if (chg[pow1]) { print trigger1 =>serialsend2 power1:%0pow1% } if (chg[pow2]) { print trigger2 =>serialsend2 power2:%0pow2% } if (chg[pow3]) { =>serialsend2 power3:%0pow3% }

EXPECTED BEHAVIOUR

chg[var] is true when var changes from 0 to 1 or from 1 to 0

SCREENSHOTS

If applicable, add screenshots to help explain your problem.

ADDITIONAL CONTEXT

Add any other context about the problem here.

(Please, remember to close the issue when the problem has been addressed)

gemu2015 commented 9 months ago

syntax is like this

If chg[pow1]>0 then