arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.19k stars 4.81k forks source link

Scripting. =>tmsend crashes esp8266 being executed in >E section or in subroutine #12724

Closed nikvostro closed 3 years ago

nikvostro commented 3 years ago

PROBLEM DESCRIPTION

The following command crashes esp8266 being executed in >E section or in subroutine (or manually in Console with "script >"): =>tmsend somesampletext But this problem doesn't occur on ESP32 devices - tested on ESP32CAM and Lillygo TTGO T-Display.

tmsend [text] command works fine in console and in other places (sections) of Script:

16:30:53.731 CMD: tmsend testmess
16:30:54.248 RSL: RESULT = {"TmSend":"Done"}

REQUESTED INFORMATION

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

E pwrstate=Power1#State if %pwrstate%==1 { =>tmsend pwrstate1! }

S

ALERT(msg)

print message=%msg% =>tmsend tstmsg


- [x] Provide the output of this command: `Status 0`:
```lua
14:15:38.222 RSL: STATUS = {"Status":{"Module":18,"DeviceName":"Tasmota","FriendlyName":["Tasmota"],"Topic":"tasmota_D3444F","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0,"InfoRetain":0,"StateRetain":0}}
14:15:38.248 RSL: STATUS1 = {"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://ota.tasmota.com/tasmota/release/tasmota.bin.gz","RestartReason":"Software Watchdog","Uptime":"0T00:03:08","StartupUTC":"2021-07-22T13:12:30","Sleep":50,"CfgHolder":4617,"BootCount":10,"BCResetTime":"2021-07-22T13:39:58","SaveCount":40,"SaveAddress":"F4000"}}
14:15:38.281 RSL: STATUS2 = {"StatusFWR":{"Version":"9.5.0.3(tasmota)","BuildDateTime":"2021-07-22T15:38:12","Boot":31,"Core":"2_7_4_9","SDK":"2.2.2-dev(38a443e)","CpuFrequency":80,"Hardware":"ESP8266EX","CR":"376/699"}}
14:15:38.300 RSL: STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"MqttLog":0,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["domuk",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["00008001","2805C8000100060000005A0A000000000000","00000080","00006000","00000000"]}}
14:15:38.330 RSL: STATUS4 = {"StatusMEM":{"ProgramSize":672,"Free":328,"Heap":17,"ProgramFlashSize":1024,"FlashSize":1024,"FlashChipId":"1440E0","FlashFrequency":40,"FlashMode":3,"Features":["00000809","87DAC787","043E8001","000000CF","010013C0","C000F981","0000C004","00001000","00000020"],"Drivers":"1,2,3,4,5,6,7,8,9,10,12,16,18,19,20,21,22,24,26,27,29,30,35,37,40,45","Sensors":"1,2,3,4,5,6"}}
14:15:38.361 RSL: STATUS5 = {"StatusNET":{"Hostname":"tasmota_D3444F-1103","IPAddress":"192.168.11.104","Gateway":"192.168.11.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.11.1","Mac":"18:FE:34:D3:44:4F","Webserver":2,"WifiConfig":4,"WifiPower":17.0}}
14:15:38.384 RSL: STATUS7 = {"StatusTIM":{"UTC":"2021-07-22T13:15:38","Local":"2021-07-22T14:15:38","StartDST":"2021-03-28T02:00:00","EndDST":"2021-10-31T03:00:00","Timezone":"+01:00","Sunrise":"05:11","Sunset":"20:41"}}
14:15:38.402 RSL: STATUS10 = {"StatusSNS":{"Time":"2021-07-22T14:15:38"}}
14:15:38.409 RSL: STATUS11 = {"StatusSTS":{"Time":"2021-07-22T14:15:38","Uptime":"0T00:03:08","UptimeSec":188,"Heap":17,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":132,"MqttCount":0,"POWER":"OFF","Wifi":{"AP":1,"SSId":"domuk","BSSId":"F0:79:59:36:57:40","Channel":3,"Mode":"11n","RSSI":52,"Signal":-74,"LinkCount":1,"Downtime":"0T00:00:03"}}}
14:15:38.445 RSL: STATUS12 = {"StatusSTK":{"Exception":4,"Reason":"Software Watchdog","EPC":["4024e8ae","00000000","00000000"],"EXCVADDR":"00000000","DEPC":"00000000","CallChain":["4024e9aa","4024e9aa","4024375e","402645f0","4026459c","4026417a","4024387c","402439ba","401011e4","40243a6d","40252e80","40252e80","402164a1","40101b77","4021680b","40216889","40220c00","4028cfa4","4028cf90","4022b858","40217479","4022b42a","4029e8c6","402475fa","40254d00","401018f3","40101b77","40294e05","40294da6","40207e39","4022b61c"]}}

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Soft WDT reset

stack>>>

ctx: cont sp: 3ffff600 end: 5c5c5c5c offset: 01a0 3ffff7a0: 00000078 00000000 00000001 4024e9aa 3ffff7b0: 00000000 00000000 3fff581c 4024e9aa 3ffff7c0: 00000008 00067a6a 3fff5544 4024375e 3ffff7d0: 00000078 00000005 13cb2fa7 00000000 3ffff7e0: 402645f0 4026459c 3fff581c 4026417a 3ffff7f0: 3fff5d1c 3fff713c 3fff581c 3fff5544 3ffff800: 3fff713c 00000001 3fff5544 4024387c 3ffff810: 3fff713c 3fff905c 00000000 402439ba ..................................


### TO REPRODUCE
1. user_config_override.h
```lua
#define USE_TELEGRAM 

#undef USE_RULES
#ifndef USE_SCRIPT
#define USE_SCRIPT  // adds about 17k flash size, variable ram size
#endif
#define USE_SCRIPT_SUB_COMMAND
  1. Edit script as below:
    
    >D
    msg=""
    pwrstate=0

E pwrstate=Power1#State if %pwrstate%==1 { =>tmsend pwrstate1! }

S

ALERT(msg)

print message=%msg% =>tmsend tstmsg


3. Try executing one of the following commands:
3.1 alert "test":
```lua
14:44:26.535 CMD: weblog 4
14:44:26.539 RSL: RESULT = {"WebLog":4}
14:44:34.376 CMD: alert 1234
14:44:34.382 message=1234.000000
14:44:34.383 Script: performs "tmsend tstmsg"

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Soft WDT reset

>>>stack>>>

ctx: sys
sp: 3ffff4e0 end: 3fffffb0 offset: 01a0
3ffff680:  00000000 00000000 3fff56ec 4024189f
3ffff690:  00000008 000b0c86 3fff564c 402438da
3ffff6a0:  00000078 00000005 4aaef5ab 00000000
3ffff6b0:  40264700 402646ac 3fff56ec 4026428a
3ffff6c0:  3fff5bec 3fff4b4c 3fff56ec 3fff564c
3ffff6d0:  3fff4b4c 00000001 3fff564c 4024398c
3ffff6e0:  3fff4b4c 3fff77dc 00000000 40243aca
3ffff6f0:  3fff77dc 3ffff790 401011e4 3fff564c
3ffff700:  000001bb 3fff4b4c 3fff564c 3fff564c
3ffff710:  000001bb 3fff4b4c 3fff564c 40243b7d
3ffff720:  40252f90 dca79a95 40252f90 dca79a95
3ffff730:  3ffff79c 3ffff7a8 3ffef348 402164a1
3ffff740:  0000005a 0000005a 3ffff79c 3ffff800
3ffff750:  3ffff79c 3ffff7dc 00000000 40101b77
3ffff760:  00ff55b4 3fff4b4c 0010001f 8024d958
3ffff770:  3ffff79c 3ffff7dc 3ffff79c 3ffff800
3ffff780:  3ffff79c 3ffff7dc 00000000 4021680b
3ffff790:  6d747300 00006773 00fff7d0 3fff5500
3ffff7a0:  005a005f 00000000 3fff76cc 005a005f
3ffff7b0:  80ff30ef 3fff557c 002d002f 80201c93
3ffff7c0:  00000002 00000000 3fff1244 40216889
3ffff7d0:  31333833 35343231 09280038 6d747374
3ffff7e0:  00006773 06000000 3fff1244 3ffff800
3ffff7f0:  00000002 00000000 3fff1244 40220c00
3ffff800:  4028d0b4 4028d0a0 00000000 00000006
3ffff810:  00000011 00000000 00000011 00000006
3ffff820:  00000011 00000060 00000011 4022b860
3ffff830:  00000011 00000058 00000011 40217479
3ffff840:  00000001 3ffff971 3ffff961 4022b431
3ffff850:  3ffff961 7fffffff 4029e9d6 4024770a
3ffff860:  646e6d63 4556442f 33445f53 46343434
3ffff870:  2f62665f 3fff5500 3ffff925 3ffff925
3ffff880:  3ffff920 3ffff910 00000008 40254e00
3ffff890:  3ffff920 3ffff910 0000000c 3fff50bc
3ffff8a0:  00000000 31ffffff 34343a34 2e34333a
3ffff8b0:  00002aa0 00000554 00000554 401018f3
3ffff8c0:  00000003 3ffff8a7 00000000 3ffff980
3ffff8d0:  3ffff980 00000003 00000020 40101b77
3ffff8e0:  3ffff980 3ffff970 00000008 3ffff980
3ffff8f0:  3ffff980 00000003 65536d54 0000646e
3ffff900:  00000000 00007375 00000000 00000000
3ffff910:  40294f15 00000013 3ffff940 40294eb6
3ffff920:  00000000 00000000 00000000 3ffff960
3ffff930:  3ffff8f8 ffffff9d 3fff75c4 40207e39
3ffff940:  656c7552 6d695400 00007265 3ffff980
3ffff950:  3ffff980 3ffff976 3fff75ca 4022b624
3ffff960:  74737420 0067736d 3fff557c 40207e52
3ffff970:  534d542f 00444e45 00000008 4022b564
3ffff980:  3fff75c4 0000005f 0000002f 3ffff970
3ffff990:  000000fe 00000000 3fff74c4 3fff4054
3ffff9a0:  3fff75c4 00000000 3fff74c4 4022c8a7
3ffff9b0:  449a4000 4029e849 3ffffa60 4025583c
3ffff9c0:  00000000 00000000 00000000 00000000
3ffff9d0:  00000000 000007bb 3f302073 00000000
3ffff9e0:  00000000 4029c044 3ffffa90 40255588
3ffff9f0:  3ffffaf0 3ffffda1 3ffffa50 402560b4
3ffffa00:  00333733 00000014 3f302073 00000013
3ffffa10:  00000000 00000013 3ffffaf0 40255652
3ffffa20:  3ffffb30 3fff4b4c 00000030 3ffe8304
3ffffa30:  00000000 00000001 00000000 3fff4b4c
3ffffa40:  00000000 3fff4b5f 3ffffaf0 4025583c
3ffffa50:  3fff55b4 3ffe8304 00001000 40254df1
3ffffa60:  3fff09e7 00000013 00302044 ffff0208
3ffffa70:  3fff022c 00000fff 00000020 00000000
3ffffa80:  3ffffca0 3ffe8304 00000097 40254df1
3ffffa90:  0034fcb4 4029e848 00000082 ffff0208
3ffffaa0:  3ffffca0 00000096 00000000 4029e848
3ffffab0:  3ffffc70 3ffffc60 00000004 3ffe8304
3ffffac0:  00000004 00000013 00000000 00000005
3ffffad0:  00000000 3ffffc05 3ffffc05 00000004
3ffffae0:  00000000 3ffe8304 00000001 40254df1
3ffffaf0:  3fff5500 3fff557c 00000000 ffff0208
3ffffb00:  00000000 00000013 3ffe894c 80250100
3ffffb10:  00000000 00000000 3ffffbb4 00000000
3ffffb20:  00002aa0 00000006 00000001 3fff022c
3ffffb30:  0000001f 00000033 00000000 40207aec
3ffffb40:  3ffffbd0 00000000 00000020 00000000
3ffffb50:  3ffffbf7 3fff55b4 3ffffc05 3fff4054
3ffffb60:  00000000 3fff557c 00000000 40254e34
3ffffb70:  00002aa0 00000554 00000554 00000006
3ffffb80:  3ffffbd7 3ffffbd0 06000000 4022d07b
3ffffb90:  00000000 3fff557c 00000020 40101b77
3ffffba0:  3fff4b4c 7fffffff 4029e67a 4024770a
3ffffbb0:  00000001 00000000 ffffffff 3ffe9044
3ffffbc0:  0000000e 3ffffbdb 3fff1244 4022d320
3ffffbd0:  454c4123 31285452 29343332 40254e00
3ffffbe0:  3ffffc70 3ffffc60 00000004 3fff4b4c
3ffffbf0:  00000000 31fffc70 34343a34 2e34333a
3ffffc00:  000034d0 0000069a 0000069a 401018f3
3ffffc10:  00000003 00000013 3ffefecc 00000004
3ffffc20:  00000000 4bc6a7f0 d26e978d 00000000
3ffffc30:  00000000 00000000 4bc6a7f0 00000000
3ffffc40:  3ffffda1 00000007 401011e4 00019e10
3ffffc50:  52454c41 3fff0054 3ffffda1 40202c7b
3ffffc60:  01dec373 66664f00 3f007400 00000004
3ffffc70:  00000001 3ffffdb1 3ffffda1 00000004
3ffffc80:  00000001 3ffffdb1 3ffffda1 4022b41a
3ffffc90:  3ffffda1 3fff5594 00000020 40101b77
3ffffca0:  646e6d63 4556442f 33445f53 46343434
3ffffcb0:  2f62665f 00000000 00000001 40247ab5
3ffffcc0:  000000e9 3fff4b4c 3ffffd75 3ffffd75
3ffffcd0:  3ffffd70 3ffffd60 00000008 40254e00
3ffffce0:  3ffffd70 3ffffd60 00000010 3fff4b4c
3ffffcf0:  00000000 31ffffff 34343a34 2e34333a
3ffffd00:  000034e8 0000069d 0000069d 401018f3
3ffffd10:  00000003 3ffffcf7 00000000 40221618
3ffffd20:  00000001 00000003 00000020 40101b77
3ffffd30:  0000000b 3ffffd8c 00000000 00000000
3ffffd40:  00000000 00000000 00000000 00000000
3ffffd50:  3ffffd70 3ffffd60 00000008 3fff50bc
3ffffd60:  00000000 00000000 00000000 3ffffda0
3ffffd70:  3ffffd38 000004d2 3ffffda8 40241c00
3ffffd80:  00000001 3ffffe0c 3ffffda8 3ffffdc0
3ffffd90:  3ffffdc0 3ffffdb5 3ffffe11 4022b624
3ffffda0:  33323120 3fff0034 43626557 6f736e6f
3ffffdb0:  454c412f 00005452 3fff4b4c 4022b564
3ffffdc0:  3ffffe0c 0000005f 0000002f 3ffffdb0
3ffffdd0:  3fff6f7c 3fff6f7c 00000009 40221618
3ffffde0:  00000001 3ffffe0c 00000009 4022df71
3ffffdf0:  00000001 00000001 3fff4c5c 4022e076
3ffffe00:  3f003100 3ffffe40 00000000 72656c61
3ffffe10:  32312074 0a003433 3ffffe40 40221618
3ffffe20:  3ffffe40 3fff4c5c 00000000 40221c93
3ffffe30:  00000001 00000001 00000001 40236d2c
3ffffe40:  74003200 00000003 00fffe80 40221618
3ffffe50:  00000001 40251914 3fff22d4 402518b6
3ffffe60:  00000001 40251914 3fff22d4 401000e1
3ffffe70:  3fff4c9c 3fff4c9c 3fff22d4 40221650
3ffffe80:  00736300 3fff4c9c 00ff4c5c 4024d985
3ffffe90:  3fff22d4 3fff4c9c 3fff4c5c 40228496
3ffffea0:  0073632f 00000000 03c6a7f0 74736f00
3ffffeb0:  003b0000 00004c53 401011e4 00019e05
3ffffec0:  3fff4c9c 4bc6a7f0 3fff4c5c 00000001
3ffffed0:  00000001 00000001 00001388 40202eac
3ffffee0:  00000000 3fff6f1c 3fff4c5c 3fff1728
3ffffef0:  00000001 3fff4c80 3fff4c5c 402285b3
3fffff00:  40252cb8 00000000 00001388 00000000
3fffff10:  00000000 3fff6f1c 48f5c28f 00000000
3fffff20:  00000005 00000000 00000005 40228762
3fffff30:  01deb60e 3fff1a80 401011e4 402287b5
3fffff40:  00000000 3fff1a80 00000001 3fff1728
3fffff50:  00000005 00000000 00000005 40217479
3fffff60:  3fffdad0 00000000 00019e05 4024006d
3fffff70:  3fffdad0 00000000 00019e05 40240130
3fffff80:  00000000 00000000 00000001 40100a50
3fffff90:  3fffdad0 00000000 3fff16e8 3fff1728
3fffffa0:  3fffdad0 00000000 3fff16e8 4024eb04
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

3.2 power1 1 3.3 script>=>tmsend test

EXPECTED BEHAVIOUR

Text message should be sent

SCREENSHOTS

N/A

ADDITIONAL CONTEXT

N/A

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

arendst commented 3 years ago

It looks like it is running out of stack space when telegram is executed from script.

I see no easy solution.

nikvostro commented 3 years ago

It looks like it is running out of stack space when telegram is executed from script.

I see no easy solution.

Hello Theo! Glad to see you there here in my bug :) OK, more complex solutions are also welcome! Do you have any ideas?

p.s. I'm making not smart but a bit clever home without any automation servers - decentralized ecosystem. It's quite important to have most of Tasmota features available for every device making them independant of each other. Indeed I understand the physical MCU limitations but nevertheless I beleive in magic of coding :)

p.s.p.s. Thanks a lot for growing such a good project!!! Very appreciate on your efforts! Hope I can bring some value by reporting bugs....

sfromis commented 3 years ago

Tasmota is specifically designed for operation via MQTT, and not for devices being maximally independent. It is outside the concept to insist on multiple "big" features existing on the same ESP8266. Using ESP32 may provide more headroom, as you've observed.

nikvostro commented 3 years ago

Tasmota is specifically designed for operation via MQTT, and not for devices being maximally independent. It is outside the concept to insist on multiple "big" features existing on the same ESP8266. Using ESP32 may provide more headroom, as you've observed.

Indeed I do understand the concept. For my case I'm don't want to have additional MQTT server/broker as my automation needs are potentially covered by exciting rules/scripting features. Sure MQTT setup is much more easy to control in one place and it's endless flexible. But it's rather redundant for me neither bringing value. Telegram integration is really useful thing to bring control to end-user without any additional manipulations with LAN/WAN port forwarding, using VPN etc. I'm trying to use factory modules (devices) maximally. Sure ESP32 would be much more appropriate but esp8266 (and wb3s) are not pin compatible with esp32. It would be great to use more powerful esp32 MCU but this is not a case unfortunately because I'm using ZbBridge... for other wb3s devices it was not a problem for me to swap MCUs.

sfromis commented 3 years ago

Using the new ESP32-C3 chip, you can actually get a module which is largely pin compatible with WB3S. See this video.

Do note that the Tasmota support for ESP32-C3 is in a very early stage (but largely compatible with the "classic" ESP32), meaning that while the basics seem to work, the risk of running into issues is very much there.

nikvostro commented 3 years ago

Using the new ESP32-C3 chip, you can actually get a module which is largely pin compatible with WB3S. See this video.

Do note that the Tasmota support for ESP32-C3 is in a very early stage (but largely compatible with the "classic" ESP32), meaning that while the basics seem to work, the risk of running into issues is very much there.

Will try C3 later on on closer to stable stage... resoldering...

Another one example of unstable work of subroutines. ESP8266. Command IRHVAC executes correctly but RSL is returned corrupted each time.

#ACSET(par)
modenum=par%10
fan=((par%100)-modenum)/10
temp=(par-(fan*10)-modenum)/100
switch modenum
case 0
mode="Cool"
case 1
mode="Heat"
case 2
mode="Fan"
ends  
print %temp% %fan% %modenum% %mode%
->IRHVAC {"Vendor":"FUJITSU_AC","Model":1,"Mode":"%mode%","Power":"On","Temp":%temp%,"FanSpeed":"%fan%"}

#ACOFF
print acoff
temp=0
->IRHVAC {"Vendor":"FUJITSU_AC","Model":1,"Power":"Off"}

subroutines work:

10:14:54.977 CMD: acset 2533
10:14:54.983 25.00 3.00 3.00 
10:14:54.138 RSL: RESULT = {"ACSET":"{"V��?@��?FUJITSU_AC"}
10:15:01.115 CMD: acoff
10:15:01.118 acoff
10:15:01.202 RSL: RESULT = {"ACOFF":"��?1��?���?��%@"}
10:15:14.503 CMD: acset 2400
10:15:14.509 24.00 0.00 0.00 Cool
10:15:14.663 RSL: RESULT = {"ACSET":"{"V��?@��?FUJITSU_AC"}
10:20:05.555 CMD: acoff
10:20:05.559 acoff
10:20:05.642 RSL: RESULT = {"ACOFF":"��?1��?���?��%@"}
nikvostro commented 3 years ago

image

arendst commented 3 years ago

Just scanned my tasmota source code but I'm sorry to say I see nowhere that a command like acset is present.

Do I miss something?

nikvostro commented 3 years ago

Just scanned my tasmota source code but I'm sorry to say I see nowhere that a command like acset is present.

Do I miss something?

It's all about subroutines. See 1 comment above please - #ACOFF sub

arendst commented 3 years ago

Ah it's scripting. I guess you'll have to escape the quotes in your command line but as I'm not a script expert @gemu2015 may know better.

nikvostro commented 3 years ago

Ah it's scripting. I guess you'll have to escape the quotes in your command line but as I'm not a script expert @gemu2015 may know better.

I guess I can't avoid quotas for IRHVAC JSON, but let's try anyway:

#ACOFF
print acoff
temp=0
->IRHVAC {Vendor:FUJITSU_AC,Model:1,Power:Off}

11:24:28.603 script compressed to 751 bytes = 60 %
11:24:28.606 Script: nv=11, tv=2, vns=106, ram=289
11:24:44.191 CMD: acoff
11:24:44.195 acoff
11:24:44.200 RSL: RESULT = {"ACOFF":""}
11:24:54.240 CMD: acset 2533
11:24:54.245 25.00 3.00 3.00 
11:24:54.399 RSL: RESULT = {"ACSET":"{"V��?@��?FUJITSU_AC"}
11:24:58.445 CMD: acoff
11:24:58.448 acoff
11:24:58.454 RSL: RESULT = {"ACOFF":""}
nikvostro commented 3 years ago

Removed quotas for acset sub:

#ACSET(par)
modenum=par%10
fan=((par%100)-modenum)/10
temp=(par-(fan*10)-modenum)/100
switch modenum
case 0
mode="Cool"
case 1
mode="Heat"
case 2
mode="Fan"
ends  
print %temp% %fan% %modenum% %mode%
+>IRHVAC {Vendor:FUJITSU_AC,Model:1,Mode:%mode%,Power:On,Temp:%temp%,FanSpeed:%fan%}

11:32:01.772 script compressed to 735 bytes = 60 %
11:32:01.775 Script: nv=11, tv=2, vns=106, ram=289
11:32:04.951 CMD: acset 2533
11:32:04.957 25.00 3.00 3.00 
11:32:04.962 RSL: RESULT = {"IRHVAC":"Invalid JSON"}
11:32:04.965 RSL: RESULT = {"ACSET":"{Vendor:FUJd�%@0��?!��?���?��%@ "}
gemu2015 commented 3 years ago

try this:

+>IRHVAC {Vendor:"FUJITSU_AC",Model:1,Mode:"%mode%",Power:On,Temp:%0temp%,FanSpeed:%0fan%}

by the way. i also replaced my iobroker raspberry setup with tasmota scripting.

i am using esp8266 devices for all sensors and actors. most of these devices have dedicated web pages with google graphs for local sensors. additionally all variables are made public by global variables.

then i have several esp32 devices with displays that collect all these data, show them on webui with extended graphs, store them on SD card and every week send the collected data as email attachments.

nikvostro commented 3 years ago
print +>IRHVAC {Vendor:"FUJITSU_AC",Model:1,Mode:"%mode%",Power:On,Temp:%0temp%,FanSpeed:%0fan%}
+>IRHVAC {Vendor:"FUJITSU_AC",Model:1,Mode:"%mode%",Power:On,Temp:%0temp%,FanSpeed:%0fan%}

12:13:35.769 Script: nv=11, tv=2, vns=106, ram=289
12:13:38.443 24.00 0.00 0.00 Cool
12:13:38.445 +>IRHVAC {Vendor:"FUJITSU_AC",Model:1,Mode:"Cool",Power:On,Temp:24,FanSpeed:0}
12:13:38.450 RSL: RESULT = {"IRHVAC":"Invalid JSON"}
12:13:38.453 RSL: RESULT = {"ACSET":"{Vendor:"FUd�%@0��?!��?���?��%@ "}

Good approach with using esp32 as a core device! And global variables are in my plan for imlementation :) In my case I've decided (not to dive into Android programming) to utilize Tasker. I'm don't need to collect and analyze any data (as for now:)). Here are my 2 screens for controlling Light and ACs: Screenshot_20210728-121557_res Screenshot_20210728-121603_res

gemu2015 commented 3 years ago

sorry other quotes missing:

+>IRHVAC {"Vendor":"FUJITSU_AC","Model":1,"Mode":"%mode%","Power":"On","Temp":%1temp%,"FanSpeed":%0fan%}

example from docs IRhvac {"Vendor":"Mitsubishi_Heavy_152", "Power":"On","Mode":"Hot","FanSpeed":3,"Temp":22.5}

nikvostro commented 3 years ago

I guess %1 forces 1/10 decimal precision level in parameter definition... So the result is still same:

12:52:01.218 24.00 0.00 0.00 Cool
12:52:01.219 +>IRHVAC {"Vendor":"FUJITSU_AC","Model":1,"Mode":"Cool","Power":"On","Temp":24.0,"FanSpeed":0}
12:52:01.372 RSL: RESULT = {"IRHVAC":{"Vendor":"FUJITSU_AC","Model":1,"Mode":"Cool","Power":"On","Celsius":"On","Temp":24,"FanSpeed":"Auto","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"Off","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}
12:52:01.375 RSL: RESULT = {"ACSET":"{"V��?@��?FUJITSU_AC"}
gemu2015 commented 3 years ago

yes is decimal precision

no, now you don't get invalid json. so it should send correctly. the command ACSET however returns an invalid result. i dont use irhvac, so i cant test directly. why do you use +> and not -> ? this may cause weird effects by unwanted recursions.

nikvostro commented 3 years ago

This worked initially actually - command was executed properly, but idea was to fix RSL JSON. My app is getting a bit confused by getting this response for HTTP request. Sure it doesn't make big sense here but it can be quite critical in other appliances.

Command IRHVAC executes correctly but RSL is returned corrupted each time.

I faced with incorrect behaviour somewhere by using => (or ->) and replacing it with +> has solved the problem. To be honest I do understand recursion in programming but I don't understand what does mean "+> Execute recursion enabled" in Scripting. Nothing explained in Docs :(

gemu2015 commented 3 years ago

=> execute tasmota cmd with MQTT output enabled -> execute tasmota cmd with MQTT output disabled +> execute tasmota cmd with MQTT output enabled and recursion enabled.

exampe, if you execute a tasmota cmd in an >E section and this cmd itself executes >E you will get an infinite loop. this is disabled normally and enabled by the +> in case you know what you are doing

feel free to edit the tasmota documents to clarify things!

arendst commented 3 years ago

Good news.

Starting with ArduinoEsp8266 core 3.x more user RAM is available. This allows more heap space too which solves the OP's issue with executing telegram from a script.

To test use the latest development environment and enable Core 3.0.2