From 3d5fe29f367cd144a491b34d184f3ad4f22b00ec Mon Sep 17 00:00:00 2001 From: Philipp Ebert Date: Sat, 10 Feb 2018 12:31:35 +0100 Subject: [PATCH 1/3] Unify behaviour regarding virtual remotes and add query parameter Previously devicelist.cgi and statelist.cgi handled virtual remotes differently. devicelist.cgi ommited these channels based on the type of the device, statelist.cgi used the name of the device to achieve the same, which yielded inconsitent behaviour. Now the device type is used in both scripts. This breaks the possiblity to receive the workaround to receive the virtual remote in statelist.cgi by renaming the device. Therefore this also adds a query parameter show_remote to both scripts to reliably receive the virtual remote channels. --- xmlapi/devicelist.cgi | 12 ++++++++---- xmlapi/info.html | 6 ++---- xmlapi/statelist.cgi | 10 +++++++--- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/xmlapi/devicelist.cgi b/xmlapi/devicelist.cgi index 88f3755..4e6f910 100755 --- a/xmlapi/devicelist.cgi +++ b/xmlapi/devicelist.cgi @@ -5,7 +5,8 @@ Access-Control-Allow-Origin: * } -set show_internal "" +set show_internal 0 +set show_remote 0 catch { set input $env(QUERY_STRING) @@ -19,7 +20,8 @@ catch { array set res [rega_script { - string show_internal = "} $show_internal {"; + integer show_internal = "} $show_internal {"; + integer show_remote = "} $show_remote {"; integer DIR_SENDER = 1; integer DIR_RECEIVER = 2; @@ -33,7 +35,9 @@ array set res [rega_script { { object oDevice = dom.GetObject(sDevId); boolean bDevReady = oDevice.ReadyConfig(); - if( (true == bDevReady) && ("HMW-RCV-50" != oDevice.HssType()) && ("HM-RCV-50" != oDevice.HssType()) ) + boolean isRemote = ( ("HMW-RCV-50" == oDevice.HssType()) || ("HM-RCV-50" == oDevice.HssType() ) ); + + if( (true == bDevReady) && ( ( isRemote == false ) || ( show_remote == 1 ) ) ) { string sDevInterfaceId = oDevice.Interface(); string sDevInterface = dom.GetObject(sDevInterfaceId).Name(); @@ -59,7 +63,7 @@ array set res [rega_script { show = true; } - if ( show_internal == "1"){ + if ( show_internal == 1){ show = true; } diff --git a/xmlapi/info.html b/xmlapi/info.html index 06c87d7..d3d5ef1 100755 --- a/xmlapi/info.html +++ b/xmlapi/info.html @@ -16,7 +16,7 @@ version.cgiVersion der XML-API devicelist.cgiListe aller Geräte mit Kanälen. Enthält u.a. die Namen, Seriennummern, Gerätetypen und ID's -
Parameter: show_internal=1 (gibt zusätzlich die internen Kanäle aus) +
Parameter: show_internal=1 (gibt zusätzlich die internen Kanäle aus), show_remote=1 (gibt Kanäle der virtuellen Fernbedienung aus) functionlist.cgiListe aller Gewerke mit Kanälen favoritelist.cgiListe aller Favoriten und Usern
Paramter: favoritelist.cgi&show_datapoint gibt zusätzlich die Attribute datapoint_id und datapoint_type aus. @@ -37,9 +37,7 @@ statelist.cgi Liste alle Geräte mit Kanälen und aktuellen Werten -
Parameter: ise_id, show_internal=1 (gibt zusätzlich das Attribut state aus) -

HMW-RCV-50 BidCoS-Wir! -
Damit die virtuellen Wired Kanäle der CCU angezeigt werden, muss der Name "HMW-RCV-50 BidCoS-Wir" der Komponente auf der CCU in einen X Beliebigen umbenannt werden.
+
Parameter: ise_id, show_internal=1 (gibt zusätzlich das Attribut state aus), show_remote=1 (gibt Kanäle der virtuellen Fernbedienung aus) diff --git a/xmlapi/statelist.cgi b/xmlapi/statelist.cgi index 0ce41b0..6437c63 100755 --- a/xmlapi/statelist.cgi +++ b/xmlapi/statelist.cgi @@ -8,6 +8,7 @@ Access-Control-Allow-Origin: * set ise_id 0 set show_internal 0 +set show_remote 0 catch { set input $env(QUERY_STRING) @@ -19,8 +20,9 @@ catch { } } -set comm "var ise_id=$ise_id;\n" -set comm "var show_internal=$show_internal;\n" +append comm "var ise_id=$ise_id;\n" +append comm "var show_internal=$show_internal;\n" +append comm "var show_remote=$show_remote;\n" if { $ise_id != 0 } then { @@ -63,8 +65,10 @@ string sDPId; foreach (sDevId, root.Devices().EnumUsedIDs()) { object oDevice = dom.GetObject(sDevId); + + boolean isRemote = ( ("HMW-RCV-50" == oDevice.HssType()) || ("HM-RCV-50" == oDevice.HssType() ) ); - if( oDevice.ReadyConfig() && (oDevice.Name() != "Zentrale") && (oDevice.Name() != "HMW-RCV-50 BidCoS-Wir") ) + if( oDevice.ReadyConfig() && ( ( isRemote == false ) || ( show_remote == 1 ) ) ) { Write(" Date: Sat, 10 Feb 2018 12:31:35 +0100 Subject: [PATCH 2/3] Unify behaviour regarding virtual remotes and add query parameter Previously devicelist.cgi and statelist.cgi handled virtual remotes differently. devicelist.cgi ommited these channels based on the type of the device, statelist.cgi used the name of the device to achieve the same, which yielded inconsitent behaviour. Now the device type is used in both scripts. This breaks the possiblity to receive the workaround to receive the virtual remote in statelist.cgi by renaming the device. Therefore this also adds a query parameter show_remote to both scripts to reliably receive the virtual remote channels. --- xmlapi/devicelist.cgi | 18 +++++++++++++----- xmlapi/statelist.cgi | 10 +++++++++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/xmlapi/devicelist.cgi b/xmlapi/devicelist.cgi index 7e9b38d..06a481e 100755 --- a/xmlapi/devicelist.cgi +++ b/xmlapi/devicelist.cgi @@ -7,21 +7,27 @@ puts -nonewline "" if {[info exists sid] && [check_session $sid]} { - set show_internal "" + set show_internal 0 + set show_remote 0 catch { set input $env(QUERY_STRING) set pairs [split $input &] foreach pair $pairs { if {0 != [regexp "^show_internal=(.*)$" $pair dummy val]} { set show_internal $val - break + continue + } + if {0 != [regexp "^show_remote=(.*)$" $pair dummy val]} { + set show_remote $val + continue } } } array set res [rega_script { - string show_internal = "} $show_internal {"; + integer show_internal = "} $show_internal {"; + integer show_remote = "} $show_remote {"; integer DIR_SENDER = 1; integer DIR_RECEIVER = 2; @@ -35,7 +41,9 @@ if {[info exists sid] && [check_session $sid]} { { object oDevice = dom.GetObject(sDevId); boolean bDevReady = oDevice.ReadyConfig(); - if( (true == bDevReady) && ("HMW-RCV-50" != oDevice.HssType()) && ("HM-RCV-50" != oDevice.HssType()) ) + boolean isRemote = ( ("HMW-RCV-50" == oDevice.HssType()) || ("HM-RCV-50" == oDevice.HssType() ) ); + + if( (true == bDevReady) && ( ( isRemote == false ) || ( show_remote == 1 ) ) ) { string sDevInterfaceId = oDevice.Interface(); string sDevInterface = dom.GetObject(sDevInterfaceId).Name(); @@ -60,7 +68,7 @@ if {[info exists sid] && [check_session $sid]} { show = true; } - if ( show_internal == "1"){ + if ( show_internal == 1){ show = true; } diff --git a/xmlapi/statelist.cgi b/xmlapi/statelist.cgi index bce192e..7b87d83 100755 --- a/xmlapi/statelist.cgi +++ b/xmlapi/statelist.cgi @@ -9,6 +9,7 @@ if {[info exists sid] && [check_session $sid]} { set ise_id 0 set show_internal 0 + set show_remote 0 catch { set input $env(QUERY_STRING) set pairs [split $input &] @@ -21,11 +22,16 @@ if {[info exists sid] && [check_session $sid]} { set show_internal $val continue } + if {0 != [regexp "^show_remote=(.*)$" $pair dummy val]} { + set show_remote $val + continue + } } } set comm "var ise_id=$ise_id;\n" append comm "var show_internal=$show_internal;\n" + append comm "var show_remote=$show_remote;\n" if { $ise_id != 0 } then { @@ -64,7 +70,9 @@ if {[info exists sid] && [check_session $sid]} { { object oDevice = dom.GetObject(sDevId); - if( oDevice.ReadyConfig() && (oDevice.Name() != "Zentrale") && (oDevice.Name() != "HMW-RCV-50 BidCoS-Wir") ) + boolean isRemote = ( ("HMW-RCV-50" == oDevice.HssType()) || ("HM-RCV-50" == oDevice.HssType() ) ); + + if( oDevice.ReadyConfig() && ( ( isRemote == false ) || ( show_remote == 1 ) ) ) { Write(" Date: Fri, 22 Sep 2023 14:54:18 +0200 Subject: [PATCH 3/3] modified index.cgi --- xmlapi/index.cgi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xmlapi/index.cgi b/xmlapi/index.cgi index bb055ae..d7deeb2 100755 --- a/xmlapi/index.cgi +++ b/xmlapi/index.cgi @@ -32,7 +32,8 @@ if {[info exists sid] && [check_session $sid]} { checkuptodate.cgi???? devicelist.cgiLists all devices with channels. Contain names, serial number, device type and ids.
sid=string - security access token id
- show_internal=0/1 - adds internal channels also (default=0) + show_internal=0/1 - adds internal channels also (default=0)
+ show_remote=0/1 - adds output of virtual remote channels (default=0) devicetypelist.cgiLists all possible device types with their possible meta data.
sid=string - security access token id
@@ -101,7 +102,8 @@ if {[info exists sid] && [check_session $sid]} { statelist.cgiOutputs all devices with channels and their current values.
sid=string - security access token id
ise_id=int - output only channels and values of device with specified id (e.g. "1234")
- show_internal=0/1 - adds internal channels also (default=0) + show_internal=0/1 - adds internal channels also (default=0)
+ show_remote=0/1 - adds output of virtual remote channels (default=0) systemNotification.cgiOutputs the currently existing system notifications.
sid=string - security access token id