From d0e975b4c1435809ca01bc429df1a3c71cd7b53f Mon Sep 17 00:00:00 2001 From: delmar <> Date: Mon, 22 Mar 2021 09:23:36 +0000 Subject: [PATCH] 72_TA_CMI_JSON: added internal NODEID_HEX git-svn-id: https://svn.fhem.de/fhem/trunk@24054 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/72_TA_CMI_JSON.pm | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 7265e3511..4cfcbf0a4 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: 72_TA_CMI_JSON: added internal NODEID_HEX - change: 48_BlinkCamera: Support for SMS Pins in verifyPin - feature: 72_TA_CMI_JSON: added set fixwertImpuls and setList - feature: 72_TA_CMI_JSON: added set fixwertAnalog fixwertDigital diff --git a/fhem/FHEM/72_TA_CMI_JSON.pm b/fhem/FHEM/72_TA_CMI_JSON.pm index 619e473c6..f5c7b2d76 100755 --- a/fhem/FHEM/72_TA_CMI_JSON.pm +++ b/fhem/FHEM/72_TA_CMI_JSON.pm @@ -167,6 +167,10 @@ sub Define($$) { $hash->{NODEID} = $nodeId; $hash->{QUERYPARAM} = $queryParams; + my $hexNodeId = sprintf('%1x',$nodeId); + $hexNodeId = "0$hexNodeId" unless length($hexNodeId) == 2; + $hash->{NODEID_HEX} = $hexNodeId; + Log3 $name, 3, "TA_CMI_JSON ($name) - Define ... module=$module, CMI-URL=$cmiUrl, nodeId=$nodeId"; readingsSingleUpdate($hash, 'state', 'defined', 1); @@ -443,9 +447,7 @@ sub FixwertChangeRequest($$$$) { my $name = $hash->{NAME}; my $nodeId = $hash->{NODEID}; my $cmiIp = $hash->{CMIURL}; - - my $hexNodeId = sprintf('%1x',$nodeId); - $hexNodeId = "0$hexNodeId" unless length($hexNodeId) == 2; + my $hexNodeId = $hash->{NODEID_HEX}; $index--; #1 on the Web UI is index 0. 2 is 1, etc. my $hexIndex = sprintf('%1x',$index); @@ -507,8 +509,7 @@ sub RequestOutputStates($) { my ($hash) = @_; my $name = $hash->{NAME}; my $nodeId = $hash->{NODEID}; - my $hexNodeId = sprintf('%1x',$nodeId); - $hexNodeId = "0$hexNodeId" unless length($hexNodeId) == 2; + my $hexNodeId = $hash->{NODEID_HEX}; my $url = "http://$hash->{CMIURL}/INCLUDE/agx2.cgi?nodex2=$hexNodeId"."&_=".gettimeofday(); my $username = AttrVal($name, 'username', 'admin');