Page 1 of 1

room temperature not in $gui array via html folder script

Posted: Sun Feb 04, 2024 10:00 pm
by gda01
Januari 2024 I upgraded the software on my Raspberry2B - OTGW implementation from Jessie to Bookworm and OTmonitor from 4.3 to 6.5, on a new SD card. Everything is working as was, except for one data item, the room temperature.

For temperature logging I collect the room temperature and outside temperature with an http request from the OTmonitor webserver. I created a script file in the html folder which returns me a json structure, using the methodology from iphone.html.tmpl.

Code: Select all

% global gui ;# request room and outside temperature from otmonitor
% array set val {
%	temperature	0
%	outside	0
% }
% foreach n [array names val] {
%     if {[info exists gui($n)]} {set val($n) $gui($n)}
% }
{"tempsensors":\[{"ts_id":3,"temp":$val(temperature)},{"ts_id":4,"temp":$val(outside)}\]}
This delivers me the outside temperature, but not the room temperature.

When I put the iphone.html.tmpl file in the html directory and do the iphone.html request, this shows the default room temperature value, but not the actual room temperature. Same issue when I copy the status.html.tmpl to the html directory. iphone and status show the correct room temperature value when not copied into the html directory.

On my Rpi-Jessie/ Otmonitor 4.3 implementation the next line works:

Code: Select all

{"tempsensors":\[{"ts_id":3,"temp":$gui(temperature)},{"ts_id":4,"temp":$gui(outside)}\]}
But on the Rpi-Bookworm/ Otmonitor 6.5 I get the next error message:

Code: Select all

errorinfo: can't read "gui(temperature)": no such element in array
    while executing
"subst {{"tempsensors":\[{"ts_id":3,"temp":$gui(temperature)},{"ts_id":4,"temp":$gui(outside)}\]}
}"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 "set # {}; $script; set #""
    (procedure "template" line 17)
    invoked from within
"template $body"
    (procedure "::wibble::zone::templatefile" line 8)
    invoked from within
"{*}$command $state"
    (procedure "getresponse" line 38)
    invoked from within
"getresponse $request"
So it looks in requests from the html directory the gui array has not the room temperature entry.
Happens this only with my implementation, or are more people experiencing this issue?

Anybody an idea for an hint ?

Re: room temperature not in $gui array via html folder script

Posted: Sun Feb 04, 2024 11:42 pm
by hvxl
The internal name was changed from "temperature" to "roomtemp" 6 years ago.

Re: room temperature not in $gui array via html folder script

Posted: Sat Feb 10, 2024 8:46 pm
by gda01
Thanks, that solves the issue. (My previous OTmonitor implementation dates from 2016).