Skip to content

Commit

Permalink
fixed a bug where a missing /www/api/methods/ccu/getversion.tcl file
Browse files Browse the repository at this point in the history
resulted in an incomplete JSON API interface. While CCU.getVersion was
properly defined in methods.conf the corresponding getversion.tcl was
missing. This fixes #1123
  • Loading branch information
jens-maus committed Feb 12, 2021
1 parent 2bb8fec commit 3e87e95
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
--- occu/WebUI/www/api/methods/ccu/getversion.tcl.orig
+++ occu/WebUI/www/api/methods/ccu/getversion.tcl
@@ -0,0 +1,27 @@
+##
+# CCU.getVersion
+# Liefert die Firmware-Version der HomeMatic Zentrale
+#
+# Parameter: <keine>
+#
+# Rückgabewert: [string]
+# Firmware-Version der HomeMatic Zentrale
+##
+
+proc read_var { filename varname} {
+ set fd [open $filename r]
+ set var ""
+ if { $fd >=0 } {
+ while { [gets $fd buf] >=0 } {
+ if [regexp "^ *$varname *= *(.*)$" $buf dummy var] break
+ }
+ close $fd
+ }
+ return $var
+}
+
+proc get_version { } {
+ return [read_var /VERSION VERSION]
+}
+
+jsonrpc_response [json_toString [get_version]]
--- occu/WebUI/www/api/methods/interface/reportvalueusage.tcl.orig
+++ occu/WebUI/www/api/methods/interface/reportvalueusage.tcl
@@ -0,0 +1,21 @@
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
##
# CCU.getVersion
# Liefert die Firmware-Version der HomeMatic Zentrale
#
# Parameter: <keine>
#
# Rückgabewert: [string]
# Firmware-Version der HomeMatic Zentrale
##

proc read_var { filename varname} {
set fd [open $filename r]
set var ""
if { $fd >=0 } {
while { [gets $fd buf] >=0 } {
if [regexp "^ *$varname *= *(.*)$" $buf dummy var] break
}
close $fd
}
return $var
}

proc get_version { } {
return [read_var /VERSION VERSION]
}

jsonrpc_response [json_toString [get_version]]

0 comments on commit 3e87e95

Please sign in to comment.