Closed ottelo9 closed 1 year ago
@gemu2015 Can you have a look and help?
i am already in contact with @ottelo9 at another forum about this issue. i think we can close this here
Hi everyone, I am using the following code, based on the example you gave here above.
`>D hour=0 temp=0 M:s4h=0 960 cstr2="cnth0/120"
T temp=DS18B20#Temperature
S hour=hours
if (secs%15==0) then s4h=temp endif
hour-=4 if (hour<0) then cstr2="cnth"+s(1.0((24-4+hours)240)+(mins4))+"/240" else cstr2="cnth"+s(1.0((hours-4)240)+(mins4))+"/240" endif hour=hours
W $
$gc(lt s4h "wr" "Temperature [°C]" cstr2) $var options = { $chartArea:{left:30,width:'90%%',right:10}, $width:'90%%', $legend:'none', $vAxis:{format:'# °C',viewWindow:{min:0},viewWindow:{max:80}}, $title:'Boiler temperature last 4 hours [°C]' $}; $gc(e)`
and I get a well working google chart.
I have tried to replace the hours to 12, the minutes to 720, but I cannot get a working 12 h plot. Can you give me an hint about how the above code shall be modified to have a 12 hours plot? Thanks a lot!
you can not keep 15 seconds resolution with 12 hours on an esp8266, so we switch to every minute
>D
hour=0
temp=0
M:s4h=0 720
cstr2="cnth0/120"
>T
temp=DS18B20#Temperature
>S
hour=hours
if (secs%60==0)
then
s4h=temp
endif
hour-=12
if (hour<0)
then
cstr2="cnth"+s(1.0((24-12+hours)*60)+mins)+"/60"
else
cstr2="cnth"+s(1.0((hours-12)*60)+mins)+"/60"
endif
>W
$<div id="chart1" style="text-align:center;width:400px;height:100%%;padding:0px"></div>
$gc(lt s4h "wr" "Temperature [°C]" cstr2)
$var options = {
$chartArea:{left:30,width:'90%%',right:10},
$width:'90%%',
$legend:'none',
$vAxis:{format:'# °C',viewWindow:{min:0},viewWindow:{max:80}},
$title:'Boiler temperature last 12 hours [°C]'
$};
$gc(e)
#
Thanks! Every 60 seconds is perfect!
PROBLEM DESCRIPTION
Scripting (not berry) problem with the Google Chart function "cnth" (cnthX/Y not yet in the documentation). @gemu2015 added this functionality to "xdrv_10_scripter.ino" on 31. March 2022 . With this you can create charts with seconds at x-axis. With cstr="cnth"+s(hours*240)+"/240" and then $gc(lt s4h "wr" "Leistung [W]" cstr2). I can downgrade to 11.0.0.6 and upload the script via the ScriptEditor and everything is working fine. Upgrade to 12.x and the problem reappears :(. My big array s4h[960] is filled up like this:
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
[x] Read the Contributing Guide and Policy and the Code of Conduct
[x] Searched the problem in issues
[x] Searched the problem in discussions
[x] Searched the problem in the docs
[x] Searched the problem in the chat
[x] Device used (e.g., Sonoff Basic): ESP8266
[x] Tasmota binary firmware version number used: 12.2.0, 12.1.1, (11.0.0.6)
[x] Flashing tools used: OTA (and even serial flashing)
[x] Provide the output of command:
Backlog Template; Module; GPIO 255
:not relevant -
[ ] If using rules, provide the output of this command:
Backlog Rule1; Rule2; Rule3
:not relevant -
[x] Provide the output of this command:
Status 0
:[x] Set
weblog
to 4 and then, when you experience your issue, provide the output of the Console log:not relevant -
TO REPRODUCE
Self compiled via TasmoCompiler and these defines to use SML and google chart:
Create a new script (I upload my big script via the ScriptEditor):
EXPECTED BEHAVIOUR
With Tasmota 11.0.0.6 (includes the new cnth) the 4h chart (last 4h) works perfect. See screenshots.
SCREENSHOTS
Working 4h Google Chart with cstr2="cnth"+s(1.0((hours-4)240)+(mins4))+"/240". Full 4 hours and on the right side is the actual time (left = -4h). The 24h chart below has no issues with the x-axis labels. Correct time stamps.
With Tasmota 12.1 or 12.2 I got this here. On the right side is the actual time-2h. And only ~2 hours on X-Axis. And take a look at the 24h chart labels.
After restart/boot I got this: Then after few secs: And after ~30s this:
ADDITIONAL CONTEXT
(Please, remember to close the issue when the problem has been addressed)