Change OTMonitor graph duration on web page

This Forum is about the Opentherm gateway (OTGW) from Schelte

Moderator: hvxl

Post Reply
Astroturf
Starting Member
Starting Member
Posts: 6
Joined: Mon Nov 09, 2020 11:40 pm

Change OTMonitor graph duration on web page

Post by Astroturf »

I tried changing the span variable in otmonitor.tcl to 10800 (3 hours) as indicated here. It did not change the graph duration on the web page unfortunately. Is there any way to change the duration? OTMonitor is installed on a headless server and I only interact via the web server.
hvxl
Senior Member
Senior Member
Posts: 1967
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: Change OTMonitor graph duration on web page

Post by hvxl »

Indeed, the web page still has the 2 hours hard-coded. Applying the patch below may fix that (I didn't wait two hours to actually check it):

Code: Select all

index dcbf2a6..16e8d5e 100644
--- a/otmonitor.vfs/docroot/graph.svg.tmpl
+++ b/otmonitor.vfs/docroot/graph.svg.tmpl
@@ -1,6 +1,6 @@
-% global track start gui graph graphdef theme timestamp
+% global track start gui graph graphdef theme timestamp span
 % set now $timestamp
-% set maxx [expr {min(1440, ($now - $start) / 5.) + 25}]
+% set maxx [expr {min($span, $now - $start) / 5. + 25}]
 % if {[info exists graph]} {
 % } elseif {[info exists gui(ch2)] && $gui(ch2)} {
 %     set graph $graphdef
@@ -51,7 +51,7 @@ svg {
 // Clock difference between server and client
 const skew = [clock milliseconds] - Date.now()
 // Start time of the graph
-var start = [expr {max($start, $now - 7200) * 1000}]
+var start = [expr {max($start, $now - $span) * 1000}]
 var ref = performance.timeOrigin + skew - start
 </script>
 <script href="graph.js"></script>
Edit: (2 hours later) This isn't quite enough. Adjustments will also be needed in graph.js.
Schelte
Astroturf
Starting Member
Starting Member
Posts: 6
Joined: Mon Nov 09, 2020 11:40 pm

Re: Change OTMonitor graph duration on web page

Post by Astroturf »

I tried something similar but failed (the graph itself got longer but not the lines). :wink:

Would it be possible to make the timespan configurable since graph.js is not interpreted by Tcl?
Maybe better to move this discussion to Github?
Last edited by Astroturf on Mon Nov 13, 2023 9:14 pm, edited 2 times in total.
Bororo
Member
Member
Posts: 64
Joined: Mon Jan 31, 2011 11:20 am
Contact:

Re: Change OTMonitor graph duration on web page

Post by Bororo »

---- MOD GRAF 24h ----
sudo nano /opt/otmonitor/otmonitor.vfs/otmonitor.tcl
# change set span = 86400 (t.j. 24h)
sudo nano /opt/otmonitor/otmonitor.vfs/docroot/graph.svg.tmpl
# change row 3 to min(86400, (t.j. 24h)
Attachments
OTGW_24h_2.PNG
OTGW_24h_2.PNG (45.01 KiB) Viewed 1355 times
OTGW_24h_1.PNG
OTGW_24h_1.PNG (67.67 KiB) Viewed 1355 times
Astroturf
Starting Member
Starting Member
Posts: 6
Joined: Mon Nov 09, 2020 11:40 pm

Re: Change OTMonitor graph duration on web page

Post by Astroturf »

Bororo wrote: Tue Nov 14, 2023 8:02 pm ---- MOD GRAF 24h ----
sudo nano /opt/otmonitor/otmonitor.vfs/otmonitor.tcl
# change set span = 86400 (t.j. 24h)
sudo nano /opt/otmonitor/otmonitor.vfs/docroot/graph.svg.tmpl
# change row 3 to min(86400, (t.j. 24h)
I suppose this will not work for the webpage (graph will not update after 2 hours).
The 2 hour timespan is still hard coded in graph.js as hvxl mentions.
https://github.com/hvxl/otmonitor/blob/ ... aph.js#L64
hvxl
Senior Member
Senior Member
Posts: 1967
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: Change OTMonitor graph duration on web page

Post by hvxl »

I think I got it working with the latest commit on github.

Binaries are available via github actions. It's no longer necessary to modify the source to change the span. Just add "span 14400" (or whatever span you want) in the view section of the configuration file.

Let me know if you notice any problems with these changes.
Schelte
Astroturf
Starting Member
Starting Member
Posts: 6
Joined: Mon Nov 09, 2020 11:40 pm

Re: Change OTMonitor graph duration on web page

Post by Astroturf »

Very nice. :D I'm running the last version now with span 86400, will report back.
Astroturf
Starting Member
Starting Member
Posts: 6
Joined: Mon Nov 09, 2020 11:40 pm

Re: Change OTMonitor graph duration on web page

Post by Astroturf »

No issues encountered.
Thanks again for implementing this, Schelte. :D
Post Reply

Return to “Opentherm Gateway Forum”