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
21.97k stars 4.77k forks source link

SML Script with multiple Meters get's wrong assigment #21028

Closed kadrim closed 5 months ago

kadrim commented 5 months ago

PROBLEM DESCRIPTION

Having multiple Meters via SML is supported but some fields/registers are wrongly assigned. For example: define 2 Meters for SML

Maybe just ISKRA related?

REQUESTED INFORMATION

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

10:13:49.875 RSL: RESULT = {"NAME":"Generic","GPIO":[1,1,1,1,1,1,1,1,1,1,1,1,1,1],"FLAG":0,"BASE":18} 10:13:50.083 RSL: RESULT = {"Module":{"1":"Sonoff Basic"}} 10:13:50.338 RSL: RESULT = {"GPIO0":{"32":"Button1"},"GPIO1":{"0":"None"},"GPIO2":{"0":"None"},"GPIO3":{"0":"None"},"GPIO4":{"0":"None"},"GPIO5":{"0":"None"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"},"GPIO12":{"224":"Relay1"},"GPIO13":{"320":"Led_i1"},"GPIO14":{"0":"None"},"GPIO15":{"0":"None"},"GPIO16":{"0":"None"},"GPIO17":{"0":"None"}}

- [x] If using rules, provide the output of this command: `Backlog Rule1; Rule2; Rule3`:
```lua
  Rules output here:
- [ ] Set `weblog` to 4 and then, when you experience your issue, provide the output of the Console log:
```lua
  Console output here:

TO REPRODUCE

  1. Compile a Firmware with SML and SCRIPS enabled, i.e.:

platformio_tasmota_cenv.ini

[env:tasmota-d1mini-iskra-mt691]
extends                    = env:tasmota-4M
build_flags                = ${env:tasmota-4M.build_flags} -DFIRMWARE_ISKRA_MT691

user_config_override.h

#ifdef FIRMWARE_ISKRA_MT691

    #undef CODE_IMAGE_STR
    #define CODE_IMAGE_STR "iskra_mt691"

    // Put here your override for firmware tasmota32-iskra_mt691
    #ifndef USE_SCRIPT
    #define USE_SCRIPT
    #endif
    #ifndef USE_SML_M
    #define USE_SML_M
    #endif
    #ifdef USE_RULES
    #undef USE_RULES
    #endif

#endif
  1. Upload the Firmware
  2. Finish the usual Setup (Wifi etc.)
  3. Enable Scripts and add this one (taken from Documenation https://tasmota.github.io/docs/Smart-Meter-Interface/), adjusted to fit two separate Meters:
>D
>B
=>sensor53 r
>M 2
+1,3,s,0,9600,Z1
1,77070100010800ff@1000,Total Consumed,kWh,Total_in,3
1,77070100100700ff@1,Current Consumption,W,Power_cur1,0
1,77070100020800ff@1000,Total Delivered,kWh,Total_out,3
1,77070100000009ff@#,Service ID,,Meter_id,0|
+2,14,s,0,9600,Z2
2,77070100100700ff@1,Current Production,W,Power_cur2,0
2,77070100020800ff@1000,Total Delivered,kWh,Total_out,3
2,77070100000009ff@#,Service ID,,Meter_id,0|
#

you will see a Page like this:

image

EXPECTED BEHAVIOUR

The Current Production should be assigned to Z2 but instead it is assigned to Z1. See the line 2,77070100100700ff@1,Current Production,W,Power_cur2,0 which should assign it to the second Meter

SCREENSHOTS

see above

ADDITIONAL CONTEXT

This issue can be tested without any real hardware other than an ESP.

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

gemu2015 commented 5 months ago

your script contains illegal characters at the end of 2 lines ("|") remove them and it will work

gemu2015 commented 5 months ago

i see this error comes from the example. will fix it.

kadrim commented 5 months ago

OMG, stupid me - thanks alot @gemu2015 !

closing this right now