-
-
Notifications
You must be signed in to change notification settings - Fork 8
Description
im script https://github.com/ottelo9/tasmota-sml-script/blob/main/2_Tasmota_SML_Script_Chart_PV.txt#L63
werden permanente Variablen benutzt, die aber dann mit 0 initialisiert werden.
@gemu2015
Die Tasmota Scripting Dokumentation ist leider sehr vage in dem Punkt "permanente Variablen" über Vor- und Nachteile, auch bleibt offen wie man sie zurücksetzt. Könntest Du vielleicht dazu was hier schreiben?
PS: ich verbessere die offizielle Tasmota Scripting Dokumentation laufend durch PRs, es würde dann dort eingearbeitet.
Doc:
p:vname
specifies permanent variables. The number of permanent variables is limited by Tasmota rules space (50 bytes) - numeric variables are 4 bytes; string variables are one byte longer than the length of string. p vars are stored sequentially in the order of defintion. therefore when specifing permanent variables, add newly defined ones always at the end of already defined p vars. otherwise variables are mixed up and string variables may even be destroyed.
Ich habe die Reihenfolge von original:
; Tages, Monats, Jahres Verbrauch / Einspeisung
p:mval=0
p:dval=0
p:mval2=0
p:dval2=0
p:yval=0
p:yval2=0
auf folgendes geändert und bekomme jetzt seltsame Werte, die auch nicht ändern kann.
Mache ich da vielleicht was falsch?
; Tages, Monats, Jahres Verbrauch / FromGrid
; Note: p: = permanent storage! ?? why - reset to 0 at boot!
p:dvalF=0
p:mvalF=0
p:yvalF=0
; Tages, Monats, Jahres Einspeisung / ToGrid
p:dvalT=0
p:mvalT=0
p:yvalT=0
Console:
11:34:19.380 CMD: backlog script >dvalF=0; script >dvalT=0;
11:34:19.389 RSL: RESULT = {"Script":">dvalF=0"}
11:34:19.628 RSL: RESULT = {"Script":">dvalT=0"}
11:34:30.910 CMD: script?dvalT
11:34:30.912 RSL: RESULT = {"script":{"dvalT":"���B"}}
11:35:37.675 CMD: script?dvalF
11:35:37.677 RSL: RESULT = {"script":{"dvalF":"���B "}}