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)}\]}
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)}\]}
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"
Happens this only with my implementation, or are more people experiencing this issue?
Anybody an idea for an hint ?