From 24568def07053fe3787f5d72fc337423c39f0e88 Mon Sep 17 00:00:00 2001 From: StefanStrobel <> Date: Tue, 31 May 2022 18:23:01 +0000 Subject: [PATCH] 98_Modbus: updated tests and TestUtils.pm git-svn-id: https://svn.fhem.de/fhem/trunk@26104 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/lib/FHEM/Modbus/TestUtils.pm | 618 ++++++++++---------- fhem/lib/FHEM/Modbus/modTemplate | 84 +-- fhem/t/FHEM/98_Modbus/10_Timer.cfg | 6 +- fhem/t/FHEM/98_Modbus/12_Delays.cfg | 472 +++++++-------- fhem/t/FHEM/98_Modbus/13_OpenDelays.cfg | 244 ++++---- fhem/t/FHEM/98_Modbus/14_QDelay.cfg | 470 +++++++-------- fhem/t/FHEM/98_Modbus/20_Hints.cfg | 18 +- fhem/t/FHEM/98_Modbus/31_Register.cfg | 14 +- fhem/t/FHEM/98_Modbus/41_Passive.cfg | 500 ++++++++-------- fhem/t/FHEM/98_Modbus/42_MasterRTU-Perf.cfg | 101 ++++ fhem/t/FHEM/98_Modbus/42_MasterRTU-Perf.t | 210 +++++++ fhem/t/FHEM/98_Modbus/42_MasterRTU.cfg | 170 +++--- fhem/t/FHEM/98_Modbus/43_SlaveRTU.cfg | 270 ++++----- fhem/t/FHEM/98_Modbus/50_MasterSlave0.cfg | 267 +++++---- fhem/t/FHEM/98_Modbus/50_MasterSlave0.t | 47 +- fhem/t/FHEM/98_Modbus/50_MasterSlave1.cfg | 42 +- fhem/t/FHEM/98_Modbus/50_MasterSlave2.cfg | 34 ++ fhem/t/FHEM/98_Modbus/50_MasterSlave2.t | 75 +++ fhem/t/FHEM/98_Modbus/50_MasterSlaveDI.cfg | 24 + fhem/t/FHEM/98_Modbus/50_MasterSlaveDI.t | 55 ++ fhem/t/FHEM/98_Modbus/51_Combine.cfg | 272 ++++----- fhem/t/FHEM/98_Modbus/52_Combine2.cfg | 212 +++---- fhem/t/FHEM/98_Modbus/53_Relay.cfg | 268 ++++----- fhem/t/FHEM/98_Modbus/54_RelayProto.cfg | 274 ++++----- fhem/t/FHEM/98_Modbus/56_Scan.cfg | 106 ++-- fhem/t/FHEM/98_Modbus/58_Profiler.cfg | 254 ++++---- fhem/t/FHEM/98_Modbus/60_OverrideFC.cfg | 77 +++ fhem/t/FHEM/98_Modbus/60_OverrideFC.t | 109 ++++ 28 files changed, 3016 insertions(+), 2277 deletions(-) create mode 100644 fhem/t/FHEM/98_Modbus/42_MasterRTU-Perf.cfg create mode 100644 fhem/t/FHEM/98_Modbus/42_MasterRTU-Perf.t create mode 100644 fhem/t/FHEM/98_Modbus/50_MasterSlave2.cfg create mode 100644 fhem/t/FHEM/98_Modbus/50_MasterSlave2.t create mode 100644 fhem/t/FHEM/98_Modbus/50_MasterSlaveDI.cfg create mode 100644 fhem/t/FHEM/98_Modbus/50_MasterSlaveDI.t create mode 100644 fhem/t/FHEM/98_Modbus/60_OverrideFC.cfg create mode 100644 fhem/t/FHEM/98_Modbus/60_OverrideFC.t diff --git a/fhem/lib/FHEM/Modbus/TestUtils.pm b/fhem/lib/FHEM/Modbus/TestUtils.pm index c949573ab..47e53e300 100644 --- a/fhem/lib/FHEM/Modbus/TestUtils.pm +++ b/fhem/lib/FHEM/Modbus/TestUtils.pm @@ -1,310 +1,310 @@ -######################################################################### -# $Id$ -# Utility functions for testing Modbus that can be uses by other Fhem modules -# -# This file is part of fhem. -# -# Fhem is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# Fhem is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with fhem. If not, see . -# -############################################################################## - -package FHEM::Modbus::TestUtils; - -use strict; -use warnings; -use GPUtils qw(:all); -use Time::HiRes qw(gettimeofday); -use Test::More; - -use Exporter ('import'); -our @EXPORT_OK = qw( - CallStep - NextStep - LogStep - SimRead - findTimesInLog - calcDelays - SetTestOptions - CheckAndReset - ); - -our %EXPORT_TAGS = (all => [@EXPORT_OK]); - -BEGIN { - GP_Import( qw( - fhem - Log3 - RemoveInternalTimer - InternalTimer - gettimeofday - - FmtDateTime - FmtTimeMs - ReadingsVal - ReadingsTimestamp - AttrVal - InternalVal - featurelevel - - FhemTestUtils_gotEvent - FhemTestUtils_gotLog - FhemTestUtils_getLogTime - FhemTestUtils_resetLogs - FhemTestUtils_resetEvents - - defs - modules - attr - done_testing - logInform - )); -}; - - -our $testStep = 0; -our %testOptions; -our %results; - - -##################################################################### -# -# NextStep -# - GetNextStep -# - set timer for CallStep or end Testing -# -# InternalTimer -> CallStep -# - step via eval -# - NextStep -> Timer for CallStep -# - step via eval -# - NextStep -# -# LogInform -> ReactOnLogRegex -> -# - InternalTimer for SimResponseRead -# -# InternalTimer -> SimResponseRead -# - SimResponseRead -# - NextStep -> Timer for CallStep -# - step via eval -# - send -> LogInform -> SimResponseRead ... -# - NextStep?? (don't set timer for next step in this case) -# - - -################################################################## -# find the next test step number -# internal function, called from NextStep -sub GetNextStep { - #Log3 undef, 1, "Test GetNextStep: look for next step"; - my $next = $testStep; - FINDSTEP: - while (1) { - $next++; - return 0 if ($next > 99); - #Log3 undef, 1, "Test GetNextStep: check step $next"; - next FINDSTEP if (!defined (&{"main::testStep$next"})); - return $next; - } - return; # never reached -} - - -###################################################################### -# set internalTimer to call the next test step after an optional delay -# normally in tests to have the first step called and -# also internally by CallStep and SimResponseRead -sub NextStep { - my $delay = shift // 0; - my $next = shift // GetNextStep(); - if (!$next || ($delay && $delay eq 'end')) { # done if no more steps - Log3 undef, 1, "Test NextStep: no more steps found - exiting"; - done_testing; - exit(0); - } - if (!$delay || $delay ne 'wait') { # set timer to next step unless waiting for reception of data - #Log3 undef, 1, "Test NextStep: set timer to call step $next with delay $delay"; - InternalTimer(gettimeofday() + $delay, \&CallStep, "main::testStep$next"); - $testStep = $next; - } - #Log3 undef, 1, "Test NextStep: done."; - return; -} - - -############################################################################# -# Call the Test step and then set the timer for the next one -# called by internalTimer -sub CallStep { - my $func = shift; - $func =~ /^(.*[A-Za-z]+)(\d+)$/; - my $step = $2; - Log3 undef, 1, "----------------------------------------------------"; - Log3 undef, 1, "Test step $step ($func)"; - - no strict "refs"; ## no critic - function name needs to be string - my $delay = eval { &{$func}() }; # call the next step and check for errors - if ($@) { - Log3 undef, 1, "Test step $step call created error: $@"; - } else { - Log3 undef, 1, "Test step $step ($func) done" . (defined ($delay) ? ", delay before next step is $delay" : ""); - } - # if step function returns 'wait' then do not set timer for next step but wait for ReactOnLogRegex or similar - NextStep($delay); # check for next step and set timer or end testing - return; -} - - -################################################################################ -# check if a regex is found in logs (typically the sending of a request) -# and call SmResponseRead via timer to simulate the reception of a response -# called via logInform -sub ReactOnLogRegex { - my $name = shift; - my $line = shift; - #die "line got: $line"; - if ($line =~ /$testOptions{RespondTo}/) { - my $send = $1; - my $id = substr ($send, 0, 2); - my $recv = $testOptions{ResponseHash}{$send}; # simulate broken error response by default - if (!$recv) { - $recv = ($id . '800041c0'); - Log3 undef, 1, "Test: request $send is not in Reply hash, respond with default error instead"; - } - my $delay = $testOptions{ResponseDelay} // 0.05; - Log3 undef, 1, "------------------------------------------------------------------------"; - Log3 undef, 1, "Test saw sending $send, id $id, set timer to simulate receiving $recv in $delay"; - InternalTimer(gettimeofday() + $delay, \&SimResponseRead, $recv); # set timer to simulate response and go to next step - } - return; -} - - -####################################################################################### -# simulate the reception of a response by calling SimRead -# and then setting the timer for the next step. -# todo: delay should be definable -sub SimResponseRead { - my $data = shift; - Log3 undef, 1, "Test now simulates reception of response and then checks for next step"; - SimRead($testOptions{IODevice}, $data); - NextStep($testOptions{delayAfterResponse} // 0); - return; -} - - -########################################################################## -# interface to set options hash -# used options: -# - delayAfterResponse : time in seconds to wait after a simualted response before the next step function is called -# - IODevice : name of the device for sending and receiving -# - RespondTo : Regex to be used when monitoring the Fhem log and reacting on a "sending" log with a simulated reception -# - ResponseHash : Hash that maps from data sent (as found in log) to a valid response for the simulation -# - ResponseDelay : delay before the reception of a response is sumulated -# - Time1Regex and Time1Name : name and regex to be searched in log to find the time when it was logged, used by calcDelays -# - Time2Regex and Time2Name : name and regex to be searched in log to find the time when it was logged, used by calcDelays -sub SetTestOptions { - my $opt = shift; - foreach my $k (keys %{$opt}) { - $testOptions{$k} = $opt->{$k}; - } - if ($testOptions{RespondTo}) { - $logInform{$testOptions{IODevice}} = \&ReactOnLogRegex; - } - return; -} - - -############################################################## -# simulate reading from a device. -# the device should be defined with 'none' as interface -# and the readFn should take data from $hash->{TestInput} -# in this case -sub SimRead { - my $name = shift; # Name of the io device that should read data - my $input = shift; # binary input string (coded as hex-string) to be read - my $option = shift; # further otions (so far only 'ASCII' to treat the input string as text instead of hex) - my $hash = $defs{$name}; - my $data; - Log3 undef, 1, "Test simulate reception of $input"; - if ($option && $option eq 'ASCII') { - $data = $input; # ascii - } else { - $data = pack ('H*', $input); # hex coded binary - } - $hash->{TestInput} = $data; - my $type = $defs{$name}{TYPE}; - my $modHash = $modules{$type}; - my $readFn = $modHash->{ReadFn}; - eval { &{$readFn}($hash) }; - if ($@) { - Log3 undef, 1, "Test step $testStep call to readFn created error: $@"; - } else { - Log3 undef, 1, "Test step $testStep readFn done."; - } - return; -} - - -############################################################# -# wrapper for Log3 to be used in tests -sub LogStep { - my $msg = shift // ''; - Log3 undef, 1, "Test step $testStep: $msg"; - return; -} - - -########################################################################### -# find the time of two regexes in the log -sub findTimesInLog { - $results{$testOptions{Time1Name}.$testStep} = FhemTestUtils_getLogTime($testOptions{Time1Regex}); - $results{$testOptions{Time2Name}.$testStep} = FhemTestUtils_getLogTime($testOptions{Time2Regex}); - Log3 undef, 1, "Test step $testStep: LogTime for last $testOptions{Time1Name} is " . - ($results{$testOptions{Time1Name}.$testStep} ? FmtTimeMs($results{$testOptions{Time1Name}.$testStep}) : 'unknown'); - Log3 undef, 1, "Test step $testStep: LogTime for last $testOptions{Time2Name} is " . - ($results{$testOptions{Time2Name}.$testStep} ? FmtTimeMs($results{$testOptions{Time2Name}.$testStep}) : 'unknown'); - return; -} - - -################################################################################ -# calculate and log the time differences found by calling findTimesInLog -sub calcDelays { - my ($lastDelay, $commDelay, $sendDelay); - if (defined ($results{$testOptions{Time1Name} . $testStep}) && - defined ($results{$testOptions{Time2Name} . $testStep})) { - $lastDelay = sprintf '%.3f', ($results{$testOptions{Time2Name} . $testStep} // 0) - ($results{$testOptions{Time1Name} . ($testStep)} // 0); - Log3 undef, 1, "Test step $testStep: delay between $testOptions{Time1Name} in step " . ($testStep) . " and $testOptions{Time2Name} in step $testStep is $lastDelay"; - } - if (defined ($results{$testOptions{Time1Name} . ($testStep - 1)}) && - defined ($results{$testOptions{Time2Name} . ($testStep - 1)})) { - $commDelay = sprintf '%.3f', ($results{$testOptions{Time1Name} . $testStep} // 0) - ($results{$testOptions{Time2Name} . ($testStep - 1)} // 0); - $sendDelay = sprintf '%.3f', ($results{$testOptions{Time1Name} . $testStep} // 0) - ($results{$testOptions{Time1Name} . ($testStep - 1)} // 0); - - Log3 undef, 1, "Test step $testStep: delay between $testOptions{Time2Name} in step " . ($testStep - 1) . " and $testOptions{Time1Name} in step $testStep is $commDelay, between each $testOptions{Time1Name} $sendDelay"; - } - return ($commDelay, $sendDelay, $lastDelay); -} - - -################################################################################ -# Reset Logs and Events and check for Warnings -sub CheckAndReset { - is(FhemTestUtils_gotLog('PERL WARNING'), 0, "no Perl Warnings so far"); - FhemTestUtils_resetLogs(); - FhemTestUtils_resetEvents(); - return; -} - - +######################################################################### +# $Id$ +# Utility functions for testing Modbus that can be uses by other Fhem modules +# +# This file is part of fhem. +# +# Fhem is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# Fhem is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with fhem. If not, see . +# +############################################################################## + +package FHEM::Modbus::TestUtils; + +use strict; +use warnings; +use GPUtils qw(:all); +use Time::HiRes qw(gettimeofday); +use Test::More; + +use Exporter ('import'); +our @EXPORT_OK = qw( + CallStep + NextStep + LogStep + SimRead + findTimesInLog + calcDelays + SetTestOptions + CheckAndReset + ); + +our %EXPORT_TAGS = (all => [@EXPORT_OK]); + +BEGIN { + GP_Import( qw( + fhem + Log3 + RemoveInternalTimer + InternalTimer + gettimeofday + + FmtDateTime + FmtTimeMs + ReadingsVal + ReadingsTimestamp + AttrVal + InternalVal + featurelevel + + FhemTestUtils_gotEvent + FhemTestUtils_gotLog + FhemTestUtils_getLogTime + FhemTestUtils_resetLogs + FhemTestUtils_resetEvents + + defs + modules + attr + done_testing + logInform + )); +}; + + +our $testStep = 0; +our %testOptions; +our %results; + + +##################################################################### +# +# NextStep +# - GetNextStep +# - set timer for CallStep or end Testing +# +# InternalTimer -> CallStep +# - step via eval +# - NextStep -> Timer for CallStep +# - step via eval +# - NextStep +# +# LogInform -> ReactOnLogRegex -> +# - InternalTimer for SimResponseRead +# +# InternalTimer -> SimResponseRead +# - SimResponseRead +# - NextStep -> Timer for CallStep +# - step via eval +# - send -> LogInform -> SimResponseRead ... +# - NextStep?? (don't set timer for next step in this case) +# + + +################################################################## +# find the next test step number +# internal function, called from NextStep +sub GetNextStep { + #Log3 undef, 1, "Test GetNextStep: look for next step"; + my $next = $testStep; + FINDSTEP: + while (1) { + $next++; + return 0 if ($next > 99); + #Log3 undef, 1, "Test GetNextStep: check step $next"; + next FINDSTEP if (!defined (&{"main::testStep$next"})); + return $next; + } + return; # never reached +} + + +###################################################################### +# set internalTimer to call the next test step after an optional delay +# normally in tests to have the first step called and +# also internally by CallStep and SimResponseRead +sub NextStep { + my $delay = shift // 0; + my $next = shift // GetNextStep(); + if (!$next || ($delay && $delay eq 'end')) { # done if no more steps + Log3 undef, 1, "Test NextStep: no more steps found - exiting"; + done_testing; + exit(0); + } + if (!$delay || $delay ne 'wait') { # set timer to next step unless waiting for reception of data + #Log3 undef, 1, "Test NextStep: set timer to call step $next with delay $delay"; + InternalTimer(gettimeofday() + $delay, \&CallStep, "main::testStep$next"); + $testStep = $next; + } + #Log3 undef, 1, "Test NextStep: done."; + return; +} + + +############################################################################# +# Call the Test step and then set the timer for the next one +# called by internalTimer +sub CallStep { + my $func = shift; + $func =~ /^(.*[A-Za-z]+)(\d+)$/; + my $step = $2; + Log3 undef, 1, "----------------------------------------------------"; + Log3 undef, 1, "Test step $step ($func)"; + + no strict "refs"; ## no critic - function name needs to be string + my $delay = eval { &{$func}() }; # call the next step and check for errors + if ($@) { + Log3 undef, 1, "Test step $step call created error: $@"; + } else { + Log3 undef, 1, "Test step $step ($func) done" . (defined ($delay) ? ", delay before next step is $delay" : ""); + } + # if step function returns 'wait' then do not set timer for next step but wait for ReactOnLogRegex or similar + NextStep($delay); # check for next step and set timer or end testing + return; +} + + +################################################################################ +# check if a regex is found in logs (typically the sending of a request) +# and call SmResponseRead via timer to simulate the reception of a response +# called via logInform +sub ReactOnLogRegex { + my $name = shift; + my $line = shift; + #die "line got: $line"; + if ($line =~ /$testOptions{RespondTo}/) { + my $send = $1; + my $id = substr ($send, 0, 2); + my $recv = $testOptions{ResponseHash}{$send}; # simulate broken error response by default + if (!$recv) { + $recv = ($id . '800041c0'); + Log3 undef, 1, "Test: request $send is not in Reply hash, respond with default error instead"; + } + my $delay = $testOptions{ResponseDelay} // 0.05; + Log3 undef, 1, "------------------------------------------------------------------------"; + Log3 undef, 1, "Test saw sending $send, id $id, set timer to simulate receiving $recv in $delay"; + InternalTimer(gettimeofday() + $delay, \&SimResponseRead, $recv); # set timer to simulate response and go to next step + } + return; +} + + +####################################################################################### +# simulate the reception of a response by calling SimRead +# and then setting the timer for the next step. +# todo: delay should be definable +sub SimResponseRead { + my $data = shift; + Log3 undef, 1, "Test now simulates reception of response and then checks for next step"; + SimRead($testOptions{IODevice}, $data); + NextStep($testOptions{delayAfterResponse} // 0); + return; +} + + +########################################################################## +# interface to set options hash +# used options: +# - delayAfterResponse : time in seconds to wait after a simualted response before the next step function is called +# - IODevice : name of the device for sending and receiving +# - RespondTo : Regex to be used when monitoring the Fhem log and reacting on a "sending" log with a simulated reception +# - ResponseHash : Hash that maps from data sent (as found in log) to a valid response for the simulation +# - ResponseDelay : delay before the reception of a response is sumulated +# - Time1Regex and Time1Name : name and regex to be searched in log to find the time when it was logged, used by calcDelays +# - Time2Regex and Time2Name : name and regex to be searched in log to find the time when it was logged, used by calcDelays +sub SetTestOptions { + my $opt = shift; + foreach my $k (keys %{$opt}) { + $testOptions{$k} = $opt->{$k}; + } + if ($testOptions{RespondTo}) { + $logInform{$testOptions{IODevice}} = \&ReactOnLogRegex; + } + return; +} + + +############################################################## +# simulate reading from a device. +# the device should be defined with 'none' as interface +# and the readFn should take data from $hash->{TestInput} +# in this case +sub SimRead { + my $name = shift; # Name of the io device that should read data + my $input = shift; # binary input string (coded as hex-string) to be read + my $option = shift; # further otions (so far only 'ASCII' to treat the input string as text instead of hex) + my $hash = $defs{$name}; + my $data; + Log3 undef, 1, "Test simulate reception of $input"; + if ($option && $option eq 'ASCII') { + $data = $input; # ascii + } else { + $data = pack ('H*', $input); # hex coded binary + } + $hash->{TestInput} = $data; + my $type = $defs{$name}{TYPE}; + my $modHash = $modules{$type}; + my $readFn = $modHash->{ReadFn}; + eval { &{$readFn}($hash) }; + if ($@) { + Log3 undef, 1, "Test step $testStep call to readFn created error: $@"; + } else { + Log3 undef, 1, "Test step $testStep readFn done."; + } + return; +} + + +############################################################# +# wrapper for Log3 to be used in tests +sub LogStep { + my $msg = shift // ''; + Log3 undef, 1, "Test step $testStep: $msg"; + return; +} + + +########################################################################### +# find the time of two regexes in the log +sub findTimesInLog { + $results{$testOptions{Time1Name}.$testStep} = FhemTestUtils_getLogTime($testOptions{Time1Regex}); + $results{$testOptions{Time2Name}.$testStep} = FhemTestUtils_getLogTime($testOptions{Time2Regex}); + Log3 undef, 1, "Test step $testStep: LogTime for last $testOptions{Time1Name} is " . + ($results{$testOptions{Time1Name}.$testStep} ? FmtTimeMs($results{$testOptions{Time1Name}.$testStep}) : 'unknown'); + Log3 undef, 1, "Test step $testStep: LogTime for last $testOptions{Time2Name} is " . + ($results{$testOptions{Time2Name}.$testStep} ? FmtTimeMs($results{$testOptions{Time2Name}.$testStep}) : 'unknown'); + return; +} + + +################################################################################ +# calculate and log the time differences found by calling findTimesInLog +sub calcDelays { + my ($lastDelay, $commDelay, $sendDelay); + if (defined ($results{$testOptions{Time1Name} . $testStep}) && + defined ($results{$testOptions{Time2Name} . $testStep})) { + $lastDelay = sprintf '%.3f', ($results{$testOptions{Time2Name} . $testStep} // 0) - ($results{$testOptions{Time1Name} . ($testStep)} // 0); + Log3 undef, 1, "Test step $testStep: delay between $testOptions{Time1Name} in step " . ($testStep) . " and $testOptions{Time2Name} in step $testStep is $lastDelay"; + } + if (defined ($results{$testOptions{Time1Name} . ($testStep - 1)}) && + defined ($results{$testOptions{Time2Name} . ($testStep - 1)})) { + $commDelay = sprintf '%.3f', ($results{$testOptions{Time1Name} . $testStep} // 0) - ($results{$testOptions{Time2Name} . ($testStep - 1)} // 0); + $sendDelay = sprintf '%.3f', ($results{$testOptions{Time1Name} . $testStep} // 0) - ($results{$testOptions{Time1Name} . ($testStep - 1)} // 0); + + Log3 undef, 1, "Test step $testStep: delay between $testOptions{Time2Name} in step " . ($testStep - 1) . " and $testOptions{Time1Name} in step $testStep is $commDelay, between each $testOptions{Time1Name} $sendDelay"; + } + return ($commDelay, $sendDelay, $lastDelay); +} + + +################################################################################ +# Reset Logs and Events and check for Warnings +sub CheckAndReset { + is(FhemTestUtils_gotLog('PERL WARNING'), 0, "no Perl Warnings so far"); + FhemTestUtils_resetLogs(); + FhemTestUtils_resetEvents(); + return; +} + + 1; \ No newline at end of file diff --git a/fhem/lib/FHEM/Modbus/modTemplate b/fhem/lib/FHEM/Modbus/modTemplate index 971afd03d..a5cda1fcc 100644 --- a/fhem/lib/FHEM/Modbus/modTemplate +++ b/fhem/lib/FHEM/Modbus/modTemplate @@ -1,42 +1,42 @@ -############################################## -# $Id: 98_ModbusGen${fName}.pm automatically generated by ModbusAttr $ -# module generated automatically by ModbusAttr - -package ModbusGen${fName}; -use strict; -use warnings; -use GPUtils qw(:all); - -use Exporter ('import'); -our @EXPORT_OK = qw(); -our %EXPORT_TAGS = (all => [@EXPORT_OK]); - -BEGIN { - GP_Import( qw( - LoadModule - )); - GP_Export( qw( - Initialize - )); -}; - - -my %ModbusGen${fName}parseInfo = ( -${t} - - -##################################### -sub Initialize { - my $modHash = shift; - $modHash->{parseInfo} = \%ModbusGen${fName}parseInfo; # defines registers, inputs, coils etc. for this Modbus Defive - $modHash->{deviceInfo} = \%ModbusGen${fName}deviceInfo; # defines properties of the device like defaults and supported function codes - - LoadModule "Modbus"; - Modbus::InitializeLD($modHash); # Generic function of the Modbus module does the rest - - $modHash->{AttrList} = $modHash->{AttrList} . " " . # Standard Attributes like IODEv etc - $modHash->{ObjAttrList} . " " . # Attributes to add or overwrite parseInfo definitions - $modHash->{DevAttrList} . " " . # Attributes to add or overwrite devInfo definitions - "poll-.* " . # overwrite poll with poll-ReadingName - "polldelay-.* "; # overwrite polldelay with polldelay-ReadingName -} +############################################## +# $Id: 98_ModbusGen${fName}.pm automatically generated by ModbusAttr $ +# module generated automatically by ModbusAttr + +package ModbusGen${fName}; +use strict; +use warnings; +use GPUtils qw(:all); + +use Exporter ('import'); +our @EXPORT_OK = qw(); +our %EXPORT_TAGS = (all => [@EXPORT_OK]); + +BEGIN { + GP_Import( qw( + LoadModule + )); + GP_Export( qw( + Initialize + )); +}; + + +my %ModbusGen${fName}parseInfo = ( +${t} + + +##################################### +sub Initialize { + my $modHash = shift; + $modHash->{parseInfo} = \%ModbusGen${fName}parseInfo; # defines registers, inputs, coils etc. for this Modbus Defive + $modHash->{deviceInfo} = \%ModbusGen${fName}deviceInfo; # defines properties of the device like defaults and supported function codes + + LoadModule "Modbus"; + Modbus::InitializeLD($modHash); # Generic function of the Modbus module does the rest + + $modHash->{AttrList} = $modHash->{AttrList} . " " . # Standard Attributes like IODEv etc + $modHash->{ObjAttrList} . " " . # Attributes to add or overwrite parseInfo definitions + $modHash->{DevAttrList} . " " . # Attributes to add or overwrite devInfo definitions + "poll-.* " . # overwrite poll with poll-ReadingName + "polldelay-.* "; # overwrite polldelay with polldelay-ReadingName +} diff --git a/fhem/t/FHEM/98_Modbus/10_Timer.cfg b/fhem/t/FHEM/98_Modbus/10_Timer.cfg index 7ba6b0eaa..b0a3d96b9 100644 --- a/fhem/t/FHEM/98_Modbus/10_Timer.cfg +++ b/fhem/t/FHEM/98_Modbus/10_Timer.cfg @@ -1,3 +1,3 @@ -define M1 ModbusAttr 1 1 -attr M1 verbose 5 -define MS Modbus none +define M1 ModbusAttr 1 1 +attr M1 verbose 5 +define MS Modbus none diff --git a/fhem/t/FHEM/98_Modbus/12_Delays.cfg b/fhem/t/FHEM/98_Modbus/12_Delays.cfg index b4de7ae6d..15467cd11 100644 --- a/fhem/t/FHEM/98_Modbus/12_Delays.cfg +++ b/fhem/t/FHEM/98_Modbus/12_Delays.cfg @@ -1,236 +1,236 @@ -attr global mseclog 1 - -define MS Modbus none -attr MS verbose 4 -attr MS clientSwitchDelay 0 -attr MS busDelay 0 - - -define M5 ModbusAttr 5 0 -attr M5 verbose 3 -attr M5 dev-timing-sendDelay 0 -attr M5 dev-timing-commDelay 0 -attr M5 nonPrioritizedGet 1 - -attr M5 obj-h256-reading TempWasserEin -attr M5 obj-h258-reading TempWasserAus - -attr M5 obj-h10-reading o1 -attr M5 obj-h10-map 0:off, 1:on -attr M5 obj-h10-set 1 -attr M5 obj-h11-reading o2 -attr M5 obj-h11-hint 1,2,3 - -attr M5 dev-h-defSet 1 -attr M5 dev-h-defShowGet 1 - - -define M1 ModbusAttr 1 0 -attr M1 verbose 3 -attr M1 dev-timing-sendDelay 0 -attr M1 dev-timing-commDelay 0 -attr M1 nonPrioritizedGet 1 - -attr M1 dev-c-defPoll 1 -attr M1 dev-h-combine 5 -attr M1 dev-h-defLen 2 -attr M1 dev-h-defPoll 1 -attr M1 dev-h-defRevRegs 1 -attr M1 dev-h-write 16 -attr M1 dev-i-defFormat %.1f -attr M1 dev-i-defLen 2 -attr M1 dev-i-defPoll 1 -attr M1 dev-i-defRevRegs 1 -attr M1 dev-i-defUnpack f> -attr M1 dev-type-VT_Date-expr sprintf("%02d.%02d",($val >> 8),($val & 0xff)) -attr M1 dev-type-VT_Date-len 1 -attr M1 dev-type-VT_Date-unpack n -attr M1 dev-type-VT_R4-format %.1f -attr M1 dev-type-VT_R4-len 2 -attr M1 dev-type-VT_R4-revRegs 1 -attr M1 dev-type-VT_R4-unpack f> -attr M1 dev-type-VT_String-bswapRegs 1 -attr M1 dev-type-VT_String-decode cp850 -attr M1 dev-type-VT_String-encode utf8 -attr M1 dev-type-VT_String-expr $val =~ s/[\00]+//gr -attr M1 dev-type-VT_String-len 8 -attr M1 dev-type-VT_String-revRegs 0 -attr M1 dev-type-VT_String-unpack a* -attr M1 dev-type-VT_Time-expr sprintf("%02d:%02d",($val >> 8),($val & 0xff)) -attr M1 dev-type-VT_Time-len 1 -attr M1 dev-type-VT_Time-unpack n - -attr M1 obj-c1009-map 0:false, 1:true -attr M1 obj-c1009-polldelay 3600 -attr M1 obj-c1009-reading HeatOff -attr M1 obj-c1329-map 0:false, 1:true -attr M1 obj-c1329-polldelay 300 -attr M1 obj-c1329-reading HeatIncreaseOff -attr M1 obj-c1409-map 0:0, 1:1=2, 2:1->2, 3:1->2->3 -attr M1 obj-c1409-polldelay 60 -attr M1 obj-c1409-reading AuxilaryModeHeating -attr M1 obj-c1457-map 0:false, 1:true -attr M1 obj-c1457-reading CoolOff -attr M1 obj-c1633-map 0:false, 1:true -attr M1 obj-c1633-reading DomesticWaterOff -attr M1 obj-h1-len 13 -attr M1 obj-h1-poll 0 -attr M1 obj-h1-reading RTCTime -attr M1 obj-h1-unpack H* -attr M1 obj-h1025-polldelay 86400 -attr M1 obj-h1025-reading HeatTimeOn -attr M1 obj-h1025-type VT_Time -attr M1 obj-h1041-polldelay 86400 -attr M1 obj-h1041-reading HeatTimeOff -attr M1 obj-h1041-type VT_Time -attr M1 obj-h1057-max 30 -attr M1 obj-h1057-min 10 -attr M1 obj-h1057-reading HeatCharacteristicSetPoint -attr M1 obj-h1057-type VT_R4 -attr M1 obj-h1089-max 65 -attr M1 obj-h1089-min 15 -attr M1 obj-h1089-reading HeatCharacteristicSetPointBaseTemp -attr M1 obj-h1089-set 1 -attr M1 obj-h1089-type VT_R4 -attr M1 obj-h1121-max 100 -attr M1 obj-h1121-min 0 -attr M1 obj-h1121-reading HeatCharacteristicGradient -attr M1 obj-h1121-type VT_R4 -attr M1 obj-h1153-max 72 -attr M1 obj-h1153-min 10 -attr M1 obj-h1153-reading HeatCharacteristicLimit -attr M1 obj-h1153-type VT_R4 -attr M1 obj-h1185-reading HeatReturnTemp -attr M1 obj-h1185-type VT_R4 -attr M1 obj-h1249-max 3 -attr M1 obj-h1249-min 1 -attr M1 obj-h1249-reading HeatTempHyst -attr M1 obj-h1249-type VT_R4 -attr M1 obj-h1281-reading RoomTempNominal -attr M1 obj-h1281-type VT_R4 -attr M1 obj-h1313-len 1 -attr M1 obj-h1313-max 200 -attr M1 obj-h1313-min 0 -attr M1 obj-h1313-reading RoomTempFactor -attr M1 obj-h1313-unpack S> -attr M1 obj-h1345-polldelay 86400 -attr M1 obj-h1345-reading HeatIncreaseTimeOn -attr M1 obj-h1345-type VT_Time -attr M1 obj-h1361-polldelay 86400 -attr M1 obj-h1361-reading HeatIncreaseTimeOff -attr M1 obj-h1361-type VT_Time -attr M1 obj-h1377-max 5 -attr M1 obj-h1377-min -5 -attr M1 obj-h1377-reading HeatIncreaseSetPtOffset -attr M1 obj-h1377-type VT_R4 -attr M1 obj-h1425-max 5 -attr M1 obj-h1425-min 0 -attr M1 obj-h1425-reading AuxilaryMaxDifference -attr M1 obj-h1425-type VT_R4 -attr M1 obj-h1473-polldelay 86400 -attr M1 obj-h1473-reading CoolTimeOn -attr M1 obj-h1473-type VT_Time -attr M1 obj-h1489-polldelay 86400 -attr M1 obj-h1489-reading CoolTimeOff -attr M1 obj-h1489-type VT_Time -attr M1 obj-h1505-max 30 -attr M1 obj-h1505-min 18 -attr M1 obj-h1505-reading CoolCharacteristicSetPoint -attr M1 obj-h1505-type VT_R4 -attr M1 obj-h1569-reading CoolReturnTempNominal -attr M1 obj-h1569-type VT_R4 -attr M1 obj-h1601-max 3 -attr M1 obj-h1601-min 1 -attr M1 obj-h1601-reading CoolReturnTempHyst -attr M1 obj-h1601-type VT_R4 -attr M1 obj-h1649-polldelay 86400 -attr M1 obj-h1649-reading DomesticWaterTimeOn -attr M1 obj-h1649-type VT_Time -attr M1 obj-h1665-polldelay 86400 -attr M1 obj-h1665-reading DomesticWaterTimeOff -attr M1 obj-h1665-type VT_Time -attr M1 obj-h1713-reading DomesticWaterTempNominal -attr M1 obj-h1713-set 1 -attr M1 obj-h1713-type VT_R4 -attr M1 obj-h1745-max 10 -attr M1 obj-h1745-min 5 -attr M1 obj-h1745-reading DomesticWaterTempHyst -attr M1 obj-h1745-type VT_R4 -attr M1 obj-h1777-len 16 -attr M1 obj-h1777-polldelay 86400 -attr M1 obj-h1777-reading LegionellaSchedule -attr M1 obj-h1777-unpack H* -attr M1 obj-h1793-polldelay 86400 -attr M1 obj-h1793-type VT_Time -attr M1 obj-h1809-polldelay 86400 -attr M1 obj-h1809-reading LegionellaTimeOff -attr M1 obj-h1809-type VT_Time -attr M1 obj-h209-len 13 -attr M1 obj-h209-poll 0 -attr M1 obj-h209-reading RTCDate -attr M1 obj-h209-unpack H* -attr M1 obj-h417-len 1 -attr M1 obj-h417-polldelay 86400 -attr M1 obj-h417-reading LngSelect -attr M1 obj-h4497-reading PElectric -attr M1 obj-h4497-type VT_R4 -attr M1 obj-h4529-reading PThermal -attr M1 obj-h4529-type VT_R4 -attr M1 obj-h4689-polldelay 86400 -attr M1 obj-h4689-reading FirmwareVersion -attr M1 obj-h4689-showGet 1 -attr M1 obj-h4689-type VT_String -attr M1 obj-h4689-unpack (a*) -attr M1 obj-h4817-polldelay 86400 -attr M1 obj-h4817-reading FirmwareDate -attr M1 obj-h4817-type VT_String -attr M1 obj-h4945-polldelay 86400 -attr M1 obj-h4945-reading ManufType -attr M1 obj-h4945-type VT_String -attr M1 obj-h5073-polldelay 86400 -attr M1 obj-h5073-reading ManufSerialNum -attr M1 obj-h5073-type VT_String -attr M1 obj-h5457-len 1 -attr M1 obj-h5457-map 0048:Kühlung, 0040:Idle, 0051:Warmwasser, 0052:Heizung -attr M1 obj-h5457-reading OperatingState -attr M1 obj-h5457-unpack H* -attr M1 obj-h5505-len 16 -attr M1 obj-h5505-reading ADC_Error -attr M1 obj-h5505-unpack H* -attr M1 obj-h5521-reading LCD_Display_Line_1 -attr M1 obj-h5521-type VT_String -attr M1 obj-h5649-reading LCD_Display_Line_2 -attr M1 obj-h5649-type VT_String -attr M1 obj-i1217-reading HeatReturnTempNominal -attr M1 obj-i1537-reading CoolReturnTemp -attr M1 obj-i1681-reading DomesticWaterTempActual -attr M1 obj-i2625-reading OHCompressor1 -attr M1 obj-i2657-reading OHCompressor2 -attr M1 obj-i2689-reading OHHeatingCompressor -attr M1 obj-i2721-reading OHHeatingAuxilary -attr M1 obj-i2753-reading OHCooling -attr M1 obj-i2785-reading OHDomesticWaterCompressor -attr M1 obj-i433-reading OutdoorTemp -attr M1 obj-i433-showGet 1 -attr M1 obj-i4561-reading COP -attr M1 obj-i4561-showGet 1 -attr M1 obj-i465-reading OutdoorTemp1h -attr M1 obj-i497-reading OutdoorTemp24h -attr M1 obj-i529-reading HeatSourceIn -attr M1 obj-i561-reading HeatSourceOut -attr M1 obj-i593-reading EvaporationTemp -attr M1 obj-i625-reading SuctionGasTemp -attr M1 obj-i657-reading EvaporationPress -attr M1 obj-i689-reading ReturnTempNominal -attr M1 obj-i721-reading ReturnTemp -attr M1 obj-i753-reading FlowTemp -attr M1 obj-i785-reading CondensationTemp -attr M1 obj-i817-reading CondensationPress -attr M1 obj-i849-reading RoomTemp -attr M1 obj-i881-reading RoomTemp1h -attr M1 obj-i913-reading DomesticWaterTemp -attr M1 obj-i945-reading PoolTemp -attr M1 obj-i977-reading SolarTemp - -attr M1 sortUpdate 1 - +attr global mseclog 1 + +define MS Modbus none +attr MS verbose 4 +attr MS clientSwitchDelay 0 +attr MS busDelay 0 + + +define M5 ModbusAttr 5 0 +attr M5 verbose 3 +attr M5 dev-timing-sendDelay 0 +attr M5 dev-timing-commDelay 0 +attr M5 nonPrioritizedGet 1 + +attr M5 obj-h256-reading TempWasserEin +attr M5 obj-h258-reading TempWasserAus + +attr M5 obj-h10-reading o1 +attr M5 obj-h10-map 0:off, 1:on +attr M5 obj-h10-set 1 +attr M5 obj-h11-reading o2 +attr M5 obj-h11-hint 1,2,3 + +attr M5 dev-h-defSet 1 +attr M5 dev-h-defShowGet 1 + + +define M1 ModbusAttr 1 0 +attr M1 verbose 3 +attr M1 dev-timing-sendDelay 0 +attr M1 dev-timing-commDelay 0 +attr M1 nonPrioritizedGet 1 + +attr M1 dev-c-defPoll 1 +attr M1 dev-h-combine 5 +attr M1 dev-h-defLen 2 +attr M1 dev-h-defPoll 1 +attr M1 dev-h-defRevRegs 1 +attr M1 dev-h-write 16 +attr M1 dev-i-defFormat %.1f +attr M1 dev-i-defLen 2 +attr M1 dev-i-defPoll 1 +attr M1 dev-i-defRevRegs 1 +attr M1 dev-i-defUnpack f> +attr M1 dev-type-VT_Date-expr sprintf("%02d.%02d",($val >> 8),($val & 0xff)) +attr M1 dev-type-VT_Date-len 1 +attr M1 dev-type-VT_Date-unpack n +attr M1 dev-type-VT_R4-format %.1f +attr M1 dev-type-VT_R4-len 2 +attr M1 dev-type-VT_R4-revRegs 1 +attr M1 dev-type-VT_R4-unpack f> +attr M1 dev-type-VT_String-bswapRegs 1 +attr M1 dev-type-VT_String-decode cp850 +attr M1 dev-type-VT_String-encode utf8 +attr M1 dev-type-VT_String-expr $val =~ s/[\00]+//gr +attr M1 dev-type-VT_String-len 8 +attr M1 dev-type-VT_String-revRegs 0 +attr M1 dev-type-VT_String-unpack a* +attr M1 dev-type-VT_Time-expr sprintf("%02d:%02d",($val >> 8),($val & 0xff)) +attr M1 dev-type-VT_Time-len 1 +attr M1 dev-type-VT_Time-unpack n + +attr M1 obj-c1009-map 0:false, 1:true +attr M1 obj-c1009-polldelay 3600 +attr M1 obj-c1009-reading HeatOff +attr M1 obj-c1329-map 0:false, 1:true +attr M1 obj-c1329-polldelay 300 +attr M1 obj-c1329-reading HeatIncreaseOff +attr M1 obj-c1409-map 0:0, 1:1=2, 2:1->2, 3:1->2->3 +attr M1 obj-c1409-polldelay 60 +attr M1 obj-c1409-reading AuxilaryModeHeating +attr M1 obj-c1457-map 0:false, 1:true +attr M1 obj-c1457-reading CoolOff +attr M1 obj-c1633-map 0:false, 1:true +attr M1 obj-c1633-reading DomesticWaterOff +attr M1 obj-h1-len 13 +attr M1 obj-h1-poll 0 +attr M1 obj-h1-reading RTCTime +attr M1 obj-h1-unpack H* +attr M1 obj-h1025-polldelay 86400 +attr M1 obj-h1025-reading HeatTimeOn +attr M1 obj-h1025-type VT_Time +attr M1 obj-h1041-polldelay 86400 +attr M1 obj-h1041-reading HeatTimeOff +attr M1 obj-h1041-type VT_Time +attr M1 obj-h1057-max 30 +attr M1 obj-h1057-min 10 +attr M1 obj-h1057-reading HeatCharacteristicSetPoint +attr M1 obj-h1057-type VT_R4 +attr M1 obj-h1089-max 65 +attr M1 obj-h1089-min 15 +attr M1 obj-h1089-reading HeatCharacteristicSetPointBaseTemp +attr M1 obj-h1089-set 1 +attr M1 obj-h1089-type VT_R4 +attr M1 obj-h1121-max 100 +attr M1 obj-h1121-min 0 +attr M1 obj-h1121-reading HeatCharacteristicGradient +attr M1 obj-h1121-type VT_R4 +attr M1 obj-h1153-max 72 +attr M1 obj-h1153-min 10 +attr M1 obj-h1153-reading HeatCharacteristicLimit +attr M1 obj-h1153-type VT_R4 +attr M1 obj-h1185-reading HeatReturnTemp +attr M1 obj-h1185-type VT_R4 +attr M1 obj-h1249-max 3 +attr M1 obj-h1249-min 1 +attr M1 obj-h1249-reading HeatTempHyst +attr M1 obj-h1249-type VT_R4 +attr M1 obj-h1281-reading RoomTempNominal +attr M1 obj-h1281-type VT_R4 +attr M1 obj-h1313-len 1 +attr M1 obj-h1313-max 200 +attr M1 obj-h1313-min 0 +attr M1 obj-h1313-reading RoomTempFactor +attr M1 obj-h1313-unpack S> +attr M1 obj-h1345-polldelay 86400 +attr M1 obj-h1345-reading HeatIncreaseTimeOn +attr M1 obj-h1345-type VT_Time +attr M1 obj-h1361-polldelay 86400 +attr M1 obj-h1361-reading HeatIncreaseTimeOff +attr M1 obj-h1361-type VT_Time +attr M1 obj-h1377-max 5 +attr M1 obj-h1377-min -5 +attr M1 obj-h1377-reading HeatIncreaseSetPtOffset +attr M1 obj-h1377-type VT_R4 +attr M1 obj-h1425-max 5 +attr M1 obj-h1425-min 0 +attr M1 obj-h1425-reading AuxilaryMaxDifference +attr M1 obj-h1425-type VT_R4 +attr M1 obj-h1473-polldelay 86400 +attr M1 obj-h1473-reading CoolTimeOn +attr M1 obj-h1473-type VT_Time +attr M1 obj-h1489-polldelay 86400 +attr M1 obj-h1489-reading CoolTimeOff +attr M1 obj-h1489-type VT_Time +attr M1 obj-h1505-max 30 +attr M1 obj-h1505-min 18 +attr M1 obj-h1505-reading CoolCharacteristicSetPoint +attr M1 obj-h1505-type VT_R4 +attr M1 obj-h1569-reading CoolReturnTempNominal +attr M1 obj-h1569-type VT_R4 +attr M1 obj-h1601-max 3 +attr M1 obj-h1601-min 1 +attr M1 obj-h1601-reading CoolReturnTempHyst +attr M1 obj-h1601-type VT_R4 +attr M1 obj-h1649-polldelay 86400 +attr M1 obj-h1649-reading DomesticWaterTimeOn +attr M1 obj-h1649-type VT_Time +attr M1 obj-h1665-polldelay 86400 +attr M1 obj-h1665-reading DomesticWaterTimeOff +attr M1 obj-h1665-type VT_Time +attr M1 obj-h1713-reading DomesticWaterTempNominal +attr M1 obj-h1713-set 1 +attr M1 obj-h1713-type VT_R4 +attr M1 obj-h1745-max 10 +attr M1 obj-h1745-min 5 +attr M1 obj-h1745-reading DomesticWaterTempHyst +attr M1 obj-h1745-type VT_R4 +attr M1 obj-h1777-len 16 +attr M1 obj-h1777-polldelay 86400 +attr M1 obj-h1777-reading LegionellaSchedule +attr M1 obj-h1777-unpack H* +attr M1 obj-h1793-polldelay 86400 +attr M1 obj-h1793-type VT_Time +attr M1 obj-h1809-polldelay 86400 +attr M1 obj-h1809-reading LegionellaTimeOff +attr M1 obj-h1809-type VT_Time +attr M1 obj-h209-len 13 +attr M1 obj-h209-poll 0 +attr M1 obj-h209-reading RTCDate +attr M1 obj-h209-unpack H* +attr M1 obj-h417-len 1 +attr M1 obj-h417-polldelay 86400 +attr M1 obj-h417-reading LngSelect +attr M1 obj-h4497-reading PElectric +attr M1 obj-h4497-type VT_R4 +attr M1 obj-h4529-reading PThermal +attr M1 obj-h4529-type VT_R4 +attr M1 obj-h4689-polldelay 86400 +attr M1 obj-h4689-reading FirmwareVersion +attr M1 obj-h4689-showGet 1 +attr M1 obj-h4689-type VT_String +attr M1 obj-h4689-unpack (a*) +attr M1 obj-h4817-polldelay 86400 +attr M1 obj-h4817-reading FirmwareDate +attr M1 obj-h4817-type VT_String +attr M1 obj-h4945-polldelay 86400 +attr M1 obj-h4945-reading ManufType +attr M1 obj-h4945-type VT_String +attr M1 obj-h5073-polldelay 86400 +attr M1 obj-h5073-reading ManufSerialNum +attr M1 obj-h5073-type VT_String +attr M1 obj-h5457-len 1 +attr M1 obj-h5457-map 0048:Kühlung, 0040:Idle, 0051:Warmwasser, 0052:Heizung +attr M1 obj-h5457-reading OperatingState +attr M1 obj-h5457-unpack H* +attr M1 obj-h5505-len 16 +attr M1 obj-h5505-reading ADC_Error +attr M1 obj-h5505-unpack H* +attr M1 obj-h5521-reading LCD_Display_Line_1 +attr M1 obj-h5521-type VT_String +attr M1 obj-h5649-reading LCD_Display_Line_2 +attr M1 obj-h5649-type VT_String +attr M1 obj-i1217-reading HeatReturnTempNominal +attr M1 obj-i1537-reading CoolReturnTemp +attr M1 obj-i1681-reading DomesticWaterTempActual +attr M1 obj-i2625-reading OHCompressor1 +attr M1 obj-i2657-reading OHCompressor2 +attr M1 obj-i2689-reading OHHeatingCompressor +attr M1 obj-i2721-reading OHHeatingAuxilary +attr M1 obj-i2753-reading OHCooling +attr M1 obj-i2785-reading OHDomesticWaterCompressor +attr M1 obj-i433-reading OutdoorTemp +attr M1 obj-i433-showGet 1 +attr M1 obj-i4561-reading COP +attr M1 obj-i4561-showGet 1 +attr M1 obj-i465-reading OutdoorTemp1h +attr M1 obj-i497-reading OutdoorTemp24h +attr M1 obj-i529-reading HeatSourceIn +attr M1 obj-i561-reading HeatSourceOut +attr M1 obj-i593-reading EvaporationTemp +attr M1 obj-i625-reading SuctionGasTemp +attr M1 obj-i657-reading EvaporationPress +attr M1 obj-i689-reading ReturnTempNominal +attr M1 obj-i721-reading ReturnTemp +attr M1 obj-i753-reading FlowTemp +attr M1 obj-i785-reading CondensationTemp +attr M1 obj-i817-reading CondensationPress +attr M1 obj-i849-reading RoomTemp +attr M1 obj-i881-reading RoomTemp1h +attr M1 obj-i913-reading DomesticWaterTemp +attr M1 obj-i945-reading PoolTemp +attr M1 obj-i977-reading SolarTemp + +attr M1 sortUpdate 1 + diff --git a/fhem/t/FHEM/98_Modbus/13_OpenDelays.cfg b/fhem/t/FHEM/98_Modbus/13_OpenDelays.cfg index aff244bf4..389ff93e0 100644 --- a/fhem/t/FHEM/98_Modbus/13_OpenDelays.cfg +++ b/fhem/t/FHEM/98_Modbus/13_OpenDelays.cfg @@ -1,123 +1,123 @@ -attr global mseclog 1 - -define D1 dummy - -define Slave ModbusAttr 5 slave global:5501 -attr Slave obj-h256-reading TempWasserEin -attr Slave obj-h258-reading TempWasserAus - -attr Slave obj-h100-reading Test1 -attr Slave obj-h100-setexpr $val * 4 - -attr Slave obj-h101-reading Test2 -attr Slave obj-h101-unpack f> -attr Slave obj-h101-len 2 - -attr Slave obj-h103-reading Test3 -attr Slave obj-h103-unpack a8 -attr Slave obj-h103-len 4 - -attr Slave obj-h120-reading Test4 -attr Slave obj-h120-unpack f> -attr Slave obj-h120-len 2 - -attr Slave obj-h130-reading Test5 -attr Slave obj-h130-unpack a* -attr Slave obj-h130-len 2 - -attr Slave obj-c400-reading c0 -attr Slave obj-c401-reading c1 -attr Slave obj-c402-reading c2 -attr Slave obj-c403-reading c3 -attr Slave obj-c404-reading c4 -attr Slave obj-c405-reading c5 -attr Slave obj-c406-reading c6 -attr Slave obj-c407-reading c7 -attr Slave obj-c408-reading c8 -attr Slave obj-c409-reading c9 -attr Slave obj-c410-reading c10 -attr Slave obj-c411-reading c11 -attr Slave obj-c412-reading c12 -attr Slave obj-c413-reading c13 -attr Slave obj-c414-reading c14 -attr Slave obj-c415-reading c15 -attr Slave obj-c416-reading c16 -attr Slave obj-c417-reading c17 -attr Slave obj-c418-reading c18 - -define Master ModbusAttr 5 0 localhost:5501 -attr Master disable 1 -attr Master verbose 3 -attr Master nonPrioritizedGet 1 -attr Master nonPrioritizedSet 1 - -attr Master dev-timing-sendDelay 0 -attr Master dev-timing-commDelay 0 - -attr Master obj-h256-reading TempWasserEin -attr Master obj-h258-reading TempWasserAus - -attr Master obj-h100-reading Test1 -attr Master obj-h100-expr $val + 2 -attr Master obj-h100-poll 1 - -attr Master obj-h101-reading Test2 -attr Master obj-h101-unpack f> -attr Master obj-h101-len 2 -attr Master obj-h101-format %.2f -attr Master obj-h101-poll 1 - -attr Master obj-h103-reading Test3 -attr Master obj-h103-unpack a8 -attr Master obj-h103-len 4 -attr Master obj-h103-poll 1 - -attr Master obj-h120-reading Test4 -attr Master obj-h120-unpack f> -attr Master obj-h120-len 2 -attr Master obj-h120-format %.2f -attr Master obj-h120-poll 1 -attr Master obj-h120-ignoreExpr $val > 10 - -attr Master obj-h130-reading Test5 -attr Master obj-h130-unpack a* -attr Master obj-h130-len 2 -attr Master obj-h130-encode utf8 - -attr Master obj-h10-reading o1 -attr Master obj-h10-map 0:off, 1:on - -attr Master obj-h11-reading o2 -attr Master obj-h11-min 1 -attr Master obj-h11-max 3 -attr Master dev-h-defSet 1 -attr Master dev-c-defSet 1 -attr Master dev-h-defShowGet 1 - -attr Master obj-c400-reading c0 -attr Master obj-c401-reading c1 -attr Master obj-c402-reading c2 -attr Master obj-c403-reading c3 -attr Master obj-c404-reading c4 -attr Master obj-c405-reading c5 -attr Master obj-c406-reading c6 -attr Master obj-c407-reading c7 -attr Master obj-c408-reading c8 -attr Master obj-c409-reading c9 -attr Master obj-c410-reading c10 -attr Master obj-c411-reading c11 -attr Master obj-c412-reading c12 -attr Master obj-c413-reading c13 -attr Master obj-c414-reading c14 -attr Master obj-c415-reading c15 -attr Master obj-c416-reading c16 -attr Master obj-c417-reading c17 -attr Master obj-c418-reading c18 - -attr Master obj-c400-poll 1 -attr Master obj-c405-poll 1 -attr Master obj-c406-poll 1 -attr Master obj-c417-poll 1 - -attr Master dev-h-combine 19 +attr global mseclog 1 + +define D1 dummy + +define Slave ModbusAttr 5 slave global:5501 +attr Slave obj-h256-reading TempWasserEin +attr Slave obj-h258-reading TempWasserAus + +attr Slave obj-h100-reading Test1 +attr Slave obj-h100-setexpr $val * 4 + +attr Slave obj-h101-reading Test2 +attr Slave obj-h101-unpack f> +attr Slave obj-h101-len 2 + +attr Slave obj-h103-reading Test3 +attr Slave obj-h103-unpack a8 +attr Slave obj-h103-len 4 + +attr Slave obj-h120-reading Test4 +attr Slave obj-h120-unpack f> +attr Slave obj-h120-len 2 + +attr Slave obj-h130-reading Test5 +attr Slave obj-h130-unpack a* +attr Slave obj-h130-len 2 + +attr Slave obj-c400-reading c0 +attr Slave obj-c401-reading c1 +attr Slave obj-c402-reading c2 +attr Slave obj-c403-reading c3 +attr Slave obj-c404-reading c4 +attr Slave obj-c405-reading c5 +attr Slave obj-c406-reading c6 +attr Slave obj-c407-reading c7 +attr Slave obj-c408-reading c8 +attr Slave obj-c409-reading c9 +attr Slave obj-c410-reading c10 +attr Slave obj-c411-reading c11 +attr Slave obj-c412-reading c12 +attr Slave obj-c413-reading c13 +attr Slave obj-c414-reading c14 +attr Slave obj-c415-reading c15 +attr Slave obj-c416-reading c16 +attr Slave obj-c417-reading c17 +attr Slave obj-c418-reading c18 + +define Master ModbusAttr 5 0 localhost:5501 +attr Master disable 1 +attr Master verbose 3 +attr Master nonPrioritizedGet 1 +attr Master nonPrioritizedSet 1 + +attr Master dev-timing-sendDelay 0 +attr Master dev-timing-commDelay 0 + +attr Master obj-h256-reading TempWasserEin +attr Master obj-h258-reading TempWasserAus + +attr Master obj-h100-reading Test1 +attr Master obj-h100-expr $val + 2 +attr Master obj-h100-poll 1 + +attr Master obj-h101-reading Test2 +attr Master obj-h101-unpack f> +attr Master obj-h101-len 2 +attr Master obj-h101-format %.2f +attr Master obj-h101-poll 1 + +attr Master obj-h103-reading Test3 +attr Master obj-h103-unpack a8 +attr Master obj-h103-len 4 +attr Master obj-h103-poll 1 + +attr Master obj-h120-reading Test4 +attr Master obj-h120-unpack f> +attr Master obj-h120-len 2 +attr Master obj-h120-format %.2f +attr Master obj-h120-poll 1 +attr Master obj-h120-ignoreExpr $val > 10 + +attr Master obj-h130-reading Test5 +attr Master obj-h130-unpack a* +attr Master obj-h130-len 2 +attr Master obj-h130-encode utf8 + +attr Master obj-h10-reading o1 +attr Master obj-h10-map 0:off, 1:on + +attr Master obj-h11-reading o2 +attr Master obj-h11-min 1 +attr Master obj-h11-max 3 +attr Master dev-h-defSet 1 +attr Master dev-c-defSet 1 +attr Master dev-h-defShowGet 1 + +attr Master obj-c400-reading c0 +attr Master obj-c401-reading c1 +attr Master obj-c402-reading c2 +attr Master obj-c403-reading c3 +attr Master obj-c404-reading c4 +attr Master obj-c405-reading c5 +attr Master obj-c406-reading c6 +attr Master obj-c407-reading c7 +attr Master obj-c408-reading c8 +attr Master obj-c409-reading c9 +attr Master obj-c410-reading c10 +attr Master obj-c411-reading c11 +attr Master obj-c412-reading c12 +attr Master obj-c413-reading c13 +attr Master obj-c414-reading c14 +attr Master obj-c415-reading c15 +attr Master obj-c416-reading c16 +attr Master obj-c417-reading c17 +attr Master obj-c418-reading c18 + +attr Master obj-c400-poll 1 +attr Master obj-c405-poll 1 +attr Master obj-c406-poll 1 +attr Master obj-c417-poll 1 + +attr Master dev-h-combine 19 attr Master dev-c-combine 32 \ No newline at end of file diff --git a/fhem/t/FHEM/98_Modbus/14_QDelay.cfg b/fhem/t/FHEM/98_Modbus/14_QDelay.cfg index c8d2ead79..44d89cb7a 100644 --- a/fhem/t/FHEM/98_Modbus/14_QDelay.cfg +++ b/fhem/t/FHEM/98_Modbus/14_QDelay.cfg @@ -1,235 +1,235 @@ -define MS Modbus none -attr MS verbose 5 -attr MS clientSwitchDelay 0 -attr MS busDelay 0 -attr MS queueDelay 0.4 - - -define M5 ModbusAttr 5 0 -attr M5 verbose 5 -attr M5 dev-timing-sendDelay 0 -attr M5 dev-timing-commDelay 0 -attr M5 nonPrioritizedGet 1 - -attr M5 obj-h256-reading TempWasserEin -attr M5 obj-h258-reading TempWasserAus - -attr M5 obj-h10-reading o1 -attr M5 obj-h10-map 0:off, 1:on -attr M5 obj-h10-set 1 -attr M5 obj-h11-reading o2 -attr M5 obj-h11-hint 1,2,3 - -attr M5 dev-h-defSet 1 -attr M5 dev-h-defShowGet 1 - - -define M1 ModbusAttr 1 0 -attr M1 verbose 5 -attr M1 dev-timing-sendDelay 0 -attr M1 dev-timing-commDelay 0 -attr M1 nonPrioritizedGet 1 - -attr M1 dev-c-defPoll 1 -attr M1 dev-h-combine 5 -attr M1 dev-h-defLen 2 -attr M1 dev-h-defPoll 1 -attr M1 dev-h-defRevRegs 1 -attr M1 dev-h-write 16 -attr M1 dev-i-defFormat %.1f -attr M1 dev-i-defLen 2 -attr M1 dev-i-defPoll 1 -attr M1 dev-i-defRevRegs 1 -attr M1 dev-i-defUnpack f> -attr M1 dev-type-VT_Date-expr sprintf("%02d.%02d",($val >> 8),($val & 0xff)) -attr M1 dev-type-VT_Date-len 1 -attr M1 dev-type-VT_Date-unpack n -attr M1 dev-type-VT_R4-format %.1f -attr M1 dev-type-VT_R4-len 2 -attr M1 dev-type-VT_R4-revRegs 1 -attr M1 dev-type-VT_R4-unpack f> -attr M1 dev-type-VT_String-bswapRegs 1 -attr M1 dev-type-VT_String-decode cp850 -attr M1 dev-type-VT_String-encode utf8 -attr M1 dev-type-VT_String-expr $val =~ s/[\00]+//gr -attr M1 dev-type-VT_String-len 8 -attr M1 dev-type-VT_String-revRegs 0 -attr M1 dev-type-VT_String-unpack a* -attr M1 dev-type-VT_Time-expr sprintf("%02d:%02d",($val >> 8),($val & 0xff)) -attr M1 dev-type-VT_Time-len 1 -attr M1 dev-type-VT_Time-unpack n - -attr M1 obj-c1009-map 0:false, 1:true -attr M1 obj-c1009-polldelay 3600 -attr M1 obj-c1009-reading HeatOff -attr M1 obj-c1329-map 0:false, 1:true -attr M1 obj-c1329-polldelay 300 -attr M1 obj-c1329-reading HeatIncreaseOff -attr M1 obj-c1409-map 0:0, 1:1=2, 2:1->2, 3:1->2->3 -attr M1 obj-c1409-polldelay 60 -attr M1 obj-c1409-reading AuxilaryModeHeating -attr M1 obj-c1457-map 0:false, 1:true -attr M1 obj-c1457-reading CoolOff -attr M1 obj-c1633-map 0:false, 1:true -attr M1 obj-c1633-reading DomesticWaterOff -attr M1 obj-h1-len 13 -attr M1 obj-h1-poll 0 -attr M1 obj-h1-reading RTCTime -attr M1 obj-h1-unpack H* -attr M1 obj-h1025-polldelay 86400 -attr M1 obj-h1025-reading HeatTimeOn -attr M1 obj-h1025-type VT_Time -attr M1 obj-h1041-polldelay 86400 -attr M1 obj-h1041-reading HeatTimeOff -attr M1 obj-h1041-type VT_Time -attr M1 obj-h1057-max 30 -attr M1 obj-h1057-min 10 -attr M1 obj-h1057-reading HeatCharacteristicSetPoint -attr M1 obj-h1057-type VT_R4 -attr M1 obj-h1089-max 65 -attr M1 obj-h1089-min 15 -attr M1 obj-h1089-reading HeatCharacteristicSetPointBaseTemp -attr M1 obj-h1089-set 1 -attr M1 obj-h1089-type VT_R4 -attr M1 obj-h1121-max 100 -attr M1 obj-h1121-min 0 -attr M1 obj-h1121-reading HeatCharacteristicGradient -attr M1 obj-h1121-type VT_R4 -attr M1 obj-h1153-max 72 -attr M1 obj-h1153-min 10 -attr M1 obj-h1153-reading HeatCharacteristicLimit -attr M1 obj-h1153-type VT_R4 -attr M1 obj-h1185-reading HeatReturnTemp -attr M1 obj-h1185-type VT_R4 -attr M1 obj-h1249-max 3 -attr M1 obj-h1249-min 1 -attr M1 obj-h1249-reading HeatTempHyst -attr M1 obj-h1249-type VT_R4 -attr M1 obj-h1281-reading RoomTempNominal -attr M1 obj-h1281-type VT_R4 -attr M1 obj-h1313-len 1 -attr M1 obj-h1313-max 200 -attr M1 obj-h1313-min 0 -attr M1 obj-h1313-reading RoomTempFactor -attr M1 obj-h1313-unpack S> -attr M1 obj-h1345-polldelay 86400 -attr M1 obj-h1345-reading HeatIncreaseTimeOn -attr M1 obj-h1345-type VT_Time -attr M1 obj-h1361-polldelay 86400 -attr M1 obj-h1361-reading HeatIncreaseTimeOff -attr M1 obj-h1361-type VT_Time -attr M1 obj-h1377-max 5 -attr M1 obj-h1377-min -5 -attr M1 obj-h1377-reading HeatIncreaseSetPtOffset -attr M1 obj-h1377-type VT_R4 -attr M1 obj-h1425-max 5 -attr M1 obj-h1425-min 0 -attr M1 obj-h1425-reading AuxilaryMaxDifference -attr M1 obj-h1425-type VT_R4 -attr M1 obj-h1473-polldelay 86400 -attr M1 obj-h1473-reading CoolTimeOn -attr M1 obj-h1473-type VT_Time -attr M1 obj-h1489-polldelay 86400 -attr M1 obj-h1489-reading CoolTimeOff -attr M1 obj-h1489-type VT_Time -attr M1 obj-h1505-max 30 -attr M1 obj-h1505-min 18 -attr M1 obj-h1505-reading CoolCharacteristicSetPoint -attr M1 obj-h1505-type VT_R4 -attr M1 obj-h1569-reading CoolReturnTempNominal -attr M1 obj-h1569-type VT_R4 -attr M1 obj-h1601-max 3 -attr M1 obj-h1601-min 1 -attr M1 obj-h1601-reading CoolReturnTempHyst -attr M1 obj-h1601-type VT_R4 -attr M1 obj-h1649-polldelay 86400 -attr M1 obj-h1649-reading DomesticWaterTimeOn -attr M1 obj-h1649-type VT_Time -attr M1 obj-h1665-polldelay 86400 -attr M1 obj-h1665-reading DomesticWaterTimeOff -attr M1 obj-h1665-type VT_Time -attr M1 obj-h1713-reading DomesticWaterTempNominal -attr M1 obj-h1713-set 1 -attr M1 obj-h1713-type VT_R4 -attr M1 obj-h1745-max 10 -attr M1 obj-h1745-min 5 -attr M1 obj-h1745-reading DomesticWaterTempHyst -attr M1 obj-h1745-type VT_R4 -attr M1 obj-h1777-len 16 -attr M1 obj-h1777-polldelay 86400 -attr M1 obj-h1777-reading LegionellaSchedule -attr M1 obj-h1777-unpack H* -attr M1 obj-h1793-polldelay 86400 -attr M1 obj-h1793-type VT_Time -attr M1 obj-h1809-polldelay 86400 -attr M1 obj-h1809-reading LegionellaTimeOff -attr M1 obj-h1809-type VT_Time -attr M1 obj-h209-len 13 -attr M1 obj-h209-poll 0 -attr M1 obj-h209-reading RTCDate -attr M1 obj-h209-unpack H* -attr M1 obj-h417-len 1 -attr M1 obj-h417-polldelay 86400 -attr M1 obj-h417-reading LngSelect -attr M1 obj-h4497-reading PElectric -attr M1 obj-h4497-type VT_R4 -attr M1 obj-h4529-reading PThermal -attr M1 obj-h4529-type VT_R4 -attr M1 obj-h4689-polldelay 86400 -attr M1 obj-h4689-reading FirmwareVersion -attr M1 obj-h4689-showGet 1 -attr M1 obj-h4689-type VT_String -attr M1 obj-h4689-unpack (a*) -attr M1 obj-h4817-polldelay 86400 -attr M1 obj-h4817-reading FirmwareDate -attr M1 obj-h4817-type VT_String -attr M1 obj-h4945-polldelay 86400 -attr M1 obj-h4945-reading ManufType -attr M1 obj-h4945-type VT_String -attr M1 obj-h5073-polldelay 86400 -attr M1 obj-h5073-reading ManufSerialNum -attr M1 obj-h5073-type VT_String -attr M1 obj-h5457-len 1 -attr M1 obj-h5457-map 0048:Kühlung, 0040:Idle, 0051:Warmwasser, 0052:Heizung -attr M1 obj-h5457-reading OperatingState -attr M1 obj-h5457-unpack H* -attr M1 obj-h5505-len 16 -attr M1 obj-h5505-reading ADC_Error -attr M1 obj-h5505-unpack H* -attr M1 obj-h5521-reading LCD_Display_Line_1 -attr M1 obj-h5521-type VT_String -attr M1 obj-h5649-reading LCD_Display_Line_2 -attr M1 obj-h5649-type VT_String -attr M1 obj-i1217-reading HeatReturnTempNominal -attr M1 obj-i1537-reading CoolReturnTemp -attr M1 obj-i1681-reading DomesticWaterTempActual -attr M1 obj-i2625-reading OHCompressor1 -attr M1 obj-i2657-reading OHCompressor2 -attr M1 obj-i2689-reading OHHeatingCompressor -attr M1 obj-i2721-reading OHHeatingAuxilary -attr M1 obj-i2753-reading OHCooling -attr M1 obj-i2785-reading OHDomesticWaterCompressor -attr M1 obj-i433-reading OutdoorTemp -attr M1 obj-i433-showGet 1 -attr M1 obj-i4561-reading COP -attr M1 obj-i4561-showGet 1 -attr M1 obj-i465-reading OutdoorTemp1h -attr M1 obj-i497-reading OutdoorTemp24h -attr M1 obj-i529-reading HeatSourceIn -attr M1 obj-i561-reading HeatSourceOut -attr M1 obj-i593-reading EvaporationTemp -attr M1 obj-i625-reading SuctionGasTemp -attr M1 obj-i657-reading EvaporationPress -attr M1 obj-i689-reading ReturnTempNominal -attr M1 obj-i721-reading ReturnTemp -attr M1 obj-i753-reading FlowTemp -attr M1 obj-i785-reading CondensationTemp -attr M1 obj-i817-reading CondensationPress -attr M1 obj-i849-reading RoomTemp -attr M1 obj-i881-reading RoomTemp1h -attr M1 obj-i913-reading DomesticWaterTemp -attr M1 obj-i945-reading PoolTemp -attr M1 obj-i977-reading SolarTemp - -attr M1 sortUpdate 1 - +define MS Modbus none +attr MS verbose 5 +attr MS clientSwitchDelay 0 +attr MS busDelay 0 +attr MS queueDelay 0.4 + + +define M5 ModbusAttr 5 0 +attr M5 verbose 5 +attr M5 dev-timing-sendDelay 0 +attr M5 dev-timing-commDelay 0 +attr M5 nonPrioritizedGet 1 + +attr M5 obj-h256-reading TempWasserEin +attr M5 obj-h258-reading TempWasserAus + +attr M5 obj-h10-reading o1 +attr M5 obj-h10-map 0:off, 1:on +attr M5 obj-h10-set 1 +attr M5 obj-h11-reading o2 +attr M5 obj-h11-hint 1,2,3 + +attr M5 dev-h-defSet 1 +attr M5 dev-h-defShowGet 1 + + +define M1 ModbusAttr 1 0 +attr M1 verbose 5 +attr M1 dev-timing-sendDelay 0 +attr M1 dev-timing-commDelay 0 +attr M1 nonPrioritizedGet 1 + +attr M1 dev-c-defPoll 1 +attr M1 dev-h-combine 5 +attr M1 dev-h-defLen 2 +attr M1 dev-h-defPoll 1 +attr M1 dev-h-defRevRegs 1 +attr M1 dev-h-write 16 +attr M1 dev-i-defFormat %.1f +attr M1 dev-i-defLen 2 +attr M1 dev-i-defPoll 1 +attr M1 dev-i-defRevRegs 1 +attr M1 dev-i-defUnpack f> +attr M1 dev-type-VT_Date-expr sprintf("%02d.%02d",($val >> 8),($val & 0xff)) +attr M1 dev-type-VT_Date-len 1 +attr M1 dev-type-VT_Date-unpack n +attr M1 dev-type-VT_R4-format %.1f +attr M1 dev-type-VT_R4-len 2 +attr M1 dev-type-VT_R4-revRegs 1 +attr M1 dev-type-VT_R4-unpack f> +attr M1 dev-type-VT_String-bswapRegs 1 +attr M1 dev-type-VT_String-decode cp850 +attr M1 dev-type-VT_String-encode utf8 +attr M1 dev-type-VT_String-expr $val =~ s/[\00]+//gr +attr M1 dev-type-VT_String-len 8 +attr M1 dev-type-VT_String-revRegs 0 +attr M1 dev-type-VT_String-unpack a* +attr M1 dev-type-VT_Time-expr sprintf("%02d:%02d",($val >> 8),($val & 0xff)) +attr M1 dev-type-VT_Time-len 1 +attr M1 dev-type-VT_Time-unpack n + +attr M1 obj-c1009-map 0:false, 1:true +attr M1 obj-c1009-polldelay 3600 +attr M1 obj-c1009-reading HeatOff +attr M1 obj-c1329-map 0:false, 1:true +attr M1 obj-c1329-polldelay 300 +attr M1 obj-c1329-reading HeatIncreaseOff +attr M1 obj-c1409-map 0:0, 1:1=2, 2:1->2, 3:1->2->3 +attr M1 obj-c1409-polldelay 60 +attr M1 obj-c1409-reading AuxilaryModeHeating +attr M1 obj-c1457-map 0:false, 1:true +attr M1 obj-c1457-reading CoolOff +attr M1 obj-c1633-map 0:false, 1:true +attr M1 obj-c1633-reading DomesticWaterOff +attr M1 obj-h1-len 13 +attr M1 obj-h1-poll 0 +attr M1 obj-h1-reading RTCTime +attr M1 obj-h1-unpack H* +attr M1 obj-h1025-polldelay 86400 +attr M1 obj-h1025-reading HeatTimeOn +attr M1 obj-h1025-type VT_Time +attr M1 obj-h1041-polldelay 86400 +attr M1 obj-h1041-reading HeatTimeOff +attr M1 obj-h1041-type VT_Time +attr M1 obj-h1057-max 30 +attr M1 obj-h1057-min 10 +attr M1 obj-h1057-reading HeatCharacteristicSetPoint +attr M1 obj-h1057-type VT_R4 +attr M1 obj-h1089-max 65 +attr M1 obj-h1089-min 15 +attr M1 obj-h1089-reading HeatCharacteristicSetPointBaseTemp +attr M1 obj-h1089-set 1 +attr M1 obj-h1089-type VT_R4 +attr M1 obj-h1121-max 100 +attr M1 obj-h1121-min 0 +attr M1 obj-h1121-reading HeatCharacteristicGradient +attr M1 obj-h1121-type VT_R4 +attr M1 obj-h1153-max 72 +attr M1 obj-h1153-min 10 +attr M1 obj-h1153-reading HeatCharacteristicLimit +attr M1 obj-h1153-type VT_R4 +attr M1 obj-h1185-reading HeatReturnTemp +attr M1 obj-h1185-type VT_R4 +attr M1 obj-h1249-max 3 +attr M1 obj-h1249-min 1 +attr M1 obj-h1249-reading HeatTempHyst +attr M1 obj-h1249-type VT_R4 +attr M1 obj-h1281-reading RoomTempNominal +attr M1 obj-h1281-type VT_R4 +attr M1 obj-h1313-len 1 +attr M1 obj-h1313-max 200 +attr M1 obj-h1313-min 0 +attr M1 obj-h1313-reading RoomTempFactor +attr M1 obj-h1313-unpack S> +attr M1 obj-h1345-polldelay 86400 +attr M1 obj-h1345-reading HeatIncreaseTimeOn +attr M1 obj-h1345-type VT_Time +attr M1 obj-h1361-polldelay 86400 +attr M1 obj-h1361-reading HeatIncreaseTimeOff +attr M1 obj-h1361-type VT_Time +attr M1 obj-h1377-max 5 +attr M1 obj-h1377-min -5 +attr M1 obj-h1377-reading HeatIncreaseSetPtOffset +attr M1 obj-h1377-type VT_R4 +attr M1 obj-h1425-max 5 +attr M1 obj-h1425-min 0 +attr M1 obj-h1425-reading AuxilaryMaxDifference +attr M1 obj-h1425-type VT_R4 +attr M1 obj-h1473-polldelay 86400 +attr M1 obj-h1473-reading CoolTimeOn +attr M1 obj-h1473-type VT_Time +attr M1 obj-h1489-polldelay 86400 +attr M1 obj-h1489-reading CoolTimeOff +attr M1 obj-h1489-type VT_Time +attr M1 obj-h1505-max 30 +attr M1 obj-h1505-min 18 +attr M1 obj-h1505-reading CoolCharacteristicSetPoint +attr M1 obj-h1505-type VT_R4 +attr M1 obj-h1569-reading CoolReturnTempNominal +attr M1 obj-h1569-type VT_R4 +attr M1 obj-h1601-max 3 +attr M1 obj-h1601-min 1 +attr M1 obj-h1601-reading CoolReturnTempHyst +attr M1 obj-h1601-type VT_R4 +attr M1 obj-h1649-polldelay 86400 +attr M1 obj-h1649-reading DomesticWaterTimeOn +attr M1 obj-h1649-type VT_Time +attr M1 obj-h1665-polldelay 86400 +attr M1 obj-h1665-reading DomesticWaterTimeOff +attr M1 obj-h1665-type VT_Time +attr M1 obj-h1713-reading DomesticWaterTempNominal +attr M1 obj-h1713-set 1 +attr M1 obj-h1713-type VT_R4 +attr M1 obj-h1745-max 10 +attr M1 obj-h1745-min 5 +attr M1 obj-h1745-reading DomesticWaterTempHyst +attr M1 obj-h1745-type VT_R4 +attr M1 obj-h1777-len 16 +attr M1 obj-h1777-polldelay 86400 +attr M1 obj-h1777-reading LegionellaSchedule +attr M1 obj-h1777-unpack H* +attr M1 obj-h1793-polldelay 86400 +attr M1 obj-h1793-type VT_Time +attr M1 obj-h1809-polldelay 86400 +attr M1 obj-h1809-reading LegionellaTimeOff +attr M1 obj-h1809-type VT_Time +attr M1 obj-h209-len 13 +attr M1 obj-h209-poll 0 +attr M1 obj-h209-reading RTCDate +attr M1 obj-h209-unpack H* +attr M1 obj-h417-len 1 +attr M1 obj-h417-polldelay 86400 +attr M1 obj-h417-reading LngSelect +attr M1 obj-h4497-reading PElectric +attr M1 obj-h4497-type VT_R4 +attr M1 obj-h4529-reading PThermal +attr M1 obj-h4529-type VT_R4 +attr M1 obj-h4689-polldelay 86400 +attr M1 obj-h4689-reading FirmwareVersion +attr M1 obj-h4689-showGet 1 +attr M1 obj-h4689-type VT_String +attr M1 obj-h4689-unpack (a*) +attr M1 obj-h4817-polldelay 86400 +attr M1 obj-h4817-reading FirmwareDate +attr M1 obj-h4817-type VT_String +attr M1 obj-h4945-polldelay 86400 +attr M1 obj-h4945-reading ManufType +attr M1 obj-h4945-type VT_String +attr M1 obj-h5073-polldelay 86400 +attr M1 obj-h5073-reading ManufSerialNum +attr M1 obj-h5073-type VT_String +attr M1 obj-h5457-len 1 +attr M1 obj-h5457-map 0048:Kühlung, 0040:Idle, 0051:Warmwasser, 0052:Heizung +attr M1 obj-h5457-reading OperatingState +attr M1 obj-h5457-unpack H* +attr M1 obj-h5505-len 16 +attr M1 obj-h5505-reading ADC_Error +attr M1 obj-h5505-unpack H* +attr M1 obj-h5521-reading LCD_Display_Line_1 +attr M1 obj-h5521-type VT_String +attr M1 obj-h5649-reading LCD_Display_Line_2 +attr M1 obj-h5649-type VT_String +attr M1 obj-i1217-reading HeatReturnTempNominal +attr M1 obj-i1537-reading CoolReturnTemp +attr M1 obj-i1681-reading DomesticWaterTempActual +attr M1 obj-i2625-reading OHCompressor1 +attr M1 obj-i2657-reading OHCompressor2 +attr M1 obj-i2689-reading OHHeatingCompressor +attr M1 obj-i2721-reading OHHeatingAuxilary +attr M1 obj-i2753-reading OHCooling +attr M1 obj-i2785-reading OHDomesticWaterCompressor +attr M1 obj-i433-reading OutdoorTemp +attr M1 obj-i433-showGet 1 +attr M1 obj-i4561-reading COP +attr M1 obj-i4561-showGet 1 +attr M1 obj-i465-reading OutdoorTemp1h +attr M1 obj-i497-reading OutdoorTemp24h +attr M1 obj-i529-reading HeatSourceIn +attr M1 obj-i561-reading HeatSourceOut +attr M1 obj-i593-reading EvaporationTemp +attr M1 obj-i625-reading SuctionGasTemp +attr M1 obj-i657-reading EvaporationPress +attr M1 obj-i689-reading ReturnTempNominal +attr M1 obj-i721-reading ReturnTemp +attr M1 obj-i753-reading FlowTemp +attr M1 obj-i785-reading CondensationTemp +attr M1 obj-i817-reading CondensationPress +attr M1 obj-i849-reading RoomTemp +attr M1 obj-i881-reading RoomTemp1h +attr M1 obj-i913-reading DomesticWaterTemp +attr M1 obj-i945-reading PoolTemp +attr M1 obj-i977-reading SolarTemp + +attr M1 sortUpdate 1 + diff --git a/fhem/t/FHEM/98_Modbus/20_Hints.cfg b/fhem/t/FHEM/98_Modbus/20_Hints.cfg index f8c353261..fcee3b717 100644 --- a/fhem/t/FHEM/98_Modbus/20_Hints.cfg +++ b/fhem/t/FHEM/98_Modbus/20_Hints.cfg @@ -1,9 +1,9 @@ -define M1 ModbusAttr 1 1 -attr M1 verbose 5 - -attr M1 obj-h10-reading o1 -attr M1 obj-h10-map 0:off, 1:on - -attr M1 obj-h11-reading o2 -attr M1 obj-h11-hint 1,2,3 -attr M1 dev-h-defSet 1 +define M1 ModbusAttr 1 1 +attr M1 verbose 5 + +attr M1 obj-h10-reading o1 +attr M1 obj-h10-map 0:off, 1:on + +attr M1 obj-h11-reading o2 +attr M1 obj-h11-hint 1,2,3 +attr M1 dev-h-defSet 1 diff --git a/fhem/t/FHEM/98_Modbus/31_Register.cfg b/fhem/t/FHEM/98_Modbus/31_Register.cfg index 9bf491342..3b2fc28b6 100644 --- a/fhem/t/FHEM/98_Modbus/31_Register.cfg +++ b/fhem/t/FHEM/98_Modbus/31_Register.cfg @@ -1,7 +1,7 @@ -define MS Modbus none -attr Master verbose 5 -attr MS clientSwitchDelay 0 -attr MS busDelay 0 -attr MS verbose 5 -attr global mseclog 1 - +define MS Modbus none +attr Master verbose 5 +attr MS clientSwitchDelay 0 +attr MS busDelay 0 +attr MS verbose 5 +attr global mseclog 1 + diff --git a/fhem/t/FHEM/98_Modbus/41_Passive.cfg b/fhem/t/FHEM/98_Modbus/41_Passive.cfg index 4356d8eaa..376549a86 100644 --- a/fhem/t/FHEM/98_Modbus/41_Passive.cfg +++ b/fhem/t/FHEM/98_Modbus/41_Passive.cfg @@ -1,250 +1,250 @@ -define MS Modbus none -attr MS verbose 5 -attr MS clientSwitchDelay 0 -attr MS busDelay 0 -attr MS skipGarbage 1 - - -define M5 ModbusAttr 5 passive -attr M5 verbose 5 -attr M5 dev-timing-sendDelay 0 -attr M5 dev-timing-commDelay 0 -attr M5 nonPrioritizedGet 1 -attr M5 obj-h256-reading TempWasserEin -attr M5 obj-h258-reading TempWasserAus -attr M5 obj-h10-reading o1 -attr M5 obj-h10-map 0:off, 1:on -attr M5 obj-h10-set 1 -attr M5 obj-h11-reading o2 -attr M5 obj-h11-hint 1,2,3 - -attr M5 dev-h-defSet 1 -attr M5 dev-h-defShowGet 1 - - -define M254 ModbusAttr 254 passive -attr M254 verbose 5 -attr M254 dev-timing-sendDelay 0 -attr M254 dev-timing-commDelay 0 -attr M254 nonPrioritizedGet 1 -attr M254 obj-h256-reading TempWasserEin -attr M254 obj-h258-reading TempWasserAus -attr M254 obj-h10-reading o1 -attr M254 obj-h10-map 0:off, 1:on -attr M254 obj-h10-set 1 -attr M254 obj-h11-reading o2 -attr M254 obj-h11-hint 1,2,3 -attr M254 dev-h-defSet 1 -attr M254 dev-h-defShowGet 1 - - - -define M1 ModbusAttr 1 passive -attr M1 verbose 5 -attr M1 dev-timing-sendDelay 0 -attr M1 dev-timing-commDelay 0 -attr M1 nonPrioritizedGet 1 - -attr M1 dev-c-defPoll 1 -attr M1 dev-h-combine 5 -attr M1 dev-h-defLen 2 -attr M1 dev-h-defPoll 1 -attr M1 dev-h-defRevRegs 1 -attr M1 dev-h-write 16 -attr M1 dev-i-defFormat %.1f -attr M1 dev-i-defLen 2 -attr M1 dev-i-defPoll 1 -attr M1 dev-i-defRevRegs 1 -attr M1 dev-i-defUnpack f> -attr M1 dev-type-VT_Date-expr sprintf("%02d.%02d",($val >> 8),($val & 0xff)) -attr M1 dev-type-VT_Date-len 1 -attr M1 dev-type-VT_Date-unpack n -attr M1 dev-type-VT_R4-format %.1f -attr M1 dev-type-VT_R4-len 2 -attr M1 dev-type-VT_R4-revRegs 1 -attr M1 dev-type-VT_R4-unpack f> -attr M1 dev-type-VT_String-bswapRegs 1 -attr M1 dev-type-VT_String-decode cp850 -attr M1 dev-type-VT_String-encode utf8 -attr M1 dev-type-VT_String-expr $val =~ s/[\00]+//gr -attr M1 dev-type-VT_String-len 8 -attr M1 dev-type-VT_String-revRegs 0 -attr M1 dev-type-VT_String-unpack a* -attr M1 dev-type-VT_Time-expr sprintf("%02d:%02d",($val >> 8),($val & 0xff)) -attr M1 dev-type-VT_Time-len 1 -attr M1 dev-type-VT_Time-unpack n - -attr M1 obj-c1009-map 0:false, 1:true -attr M1 obj-c1009-polldelay 3600 -attr M1 obj-c1009-reading HeatOff -attr M1 obj-c1329-map 0:false, 1:true -attr M1 obj-c1329-polldelay 300 -attr M1 obj-c1329-reading HeatIncreaseOff -attr M1 obj-c1409-map 0:0, 1:1=2, 2:1->2, 3:1->2->3 -attr M1 obj-c1409-polldelay 60 -attr M1 obj-c1409-reading AuxilaryModeHeating -attr M1 obj-c1457-map 0:false, 1:true -attr M1 obj-c1457-reading CoolOff -attr M1 obj-c1633-map 0:false, 1:true -attr M1 obj-c1633-reading DomesticWaterOff -attr M1 obj-h1-len 13 -attr M1 obj-h1-poll 0 -attr M1 obj-h1-reading RTCTime -attr M1 obj-h1-unpack H* -attr M1 obj-h1025-polldelay 86400 -attr M1 obj-h1025-reading HeatTimeOn -attr M1 obj-h1025-type VT_Time -attr M1 obj-h1041-polldelay 86400 -attr M1 obj-h1041-reading HeatTimeOff -attr M1 obj-h1041-type VT_Time -attr M1 obj-h1057-max 30 -attr M1 obj-h1057-min 10 -attr M1 obj-h1057-reading HeatCharacteristicSetPoint -attr M1 obj-h1057-type VT_R4 -attr M1 obj-h1089-max 65 -attr M1 obj-h1089-min 15 -attr M1 obj-h1089-reading HeatCharacteristicSetPointBaseTemp -attr M1 obj-h1089-set 1 -attr M1 obj-h1089-type VT_R4 -attr M1 obj-h1121-max 100 -attr M1 obj-h1121-min 0 -attr M1 obj-h1121-reading HeatCharacteristicGradient -attr M1 obj-h1121-type VT_R4 -attr M1 obj-h1153-max 72 -attr M1 obj-h1153-min 10 -attr M1 obj-h1153-reading HeatCharacteristicLimit -attr M1 obj-h1153-type VT_R4 -attr M1 obj-h1185-reading HeatReturnTemp -attr M1 obj-h1185-type VT_R4 -attr M1 obj-h1249-max 3 -attr M1 obj-h1249-min 1 -attr M1 obj-h1249-reading HeatTempHyst -attr M1 obj-h1249-type VT_R4 -attr M1 obj-h1281-reading RoomTempNominal -attr M1 obj-h1281-type VT_R4 -attr M1 obj-h1313-len 1 -attr M1 obj-h1313-max 200 -attr M1 obj-h1313-min 0 -attr M1 obj-h1313-reading RoomTempFactor -attr M1 obj-h1313-unpack S> -attr M1 obj-h1345-polldelay 86400 -attr M1 obj-h1345-reading HeatIncreaseTimeOn -attr M1 obj-h1345-type VT_Time -attr M1 obj-h1361-polldelay 86400 -attr M1 obj-h1361-reading HeatIncreaseTimeOff -attr M1 obj-h1361-type VT_Time -attr M1 obj-h1377-max 5 -attr M1 obj-h1377-min -5 -attr M1 obj-h1377-reading HeatIncreaseSetPtOffset -attr M1 obj-h1377-type VT_R4 -attr M1 obj-h1425-max 5 -attr M1 obj-h1425-min 0 -attr M1 obj-h1425-reading AuxilaryMaxDifference -attr M1 obj-h1425-type VT_R4 -attr M1 obj-h1473-polldelay 86400 -attr M1 obj-h1473-reading CoolTimeOn -attr M1 obj-h1473-type VT_Time -attr M1 obj-h1489-polldelay 86400 -attr M1 obj-h1489-reading CoolTimeOff -attr M1 obj-h1489-type VT_Time -attr M1 obj-h1505-max 30 -attr M1 obj-h1505-min 18 -attr M1 obj-h1505-reading CoolCharacteristicSetPoint -attr M1 obj-h1505-type VT_R4 -attr M1 obj-h1569-reading CoolReturnTempNominal -attr M1 obj-h1569-type VT_R4 -attr M1 obj-h1601-max 3 -attr M1 obj-h1601-min 1 -attr M1 obj-h1601-reading CoolReturnTempHyst -attr M1 obj-h1601-type VT_R4 -attr M1 obj-h1649-polldelay 86400 -attr M1 obj-h1649-reading DomesticWaterTimeOn -attr M1 obj-h1649-type VT_Time -attr M1 obj-h1665-polldelay 86400 -attr M1 obj-h1665-reading DomesticWaterTimeOff -attr M1 obj-h1665-type VT_Time -attr M1 obj-h1713-reading DomesticWaterTempNominal -attr M1 obj-h1713-set 1 -attr M1 obj-h1713-type VT_R4 -attr M1 obj-h1745-max 10 -attr M1 obj-h1745-min 5 -attr M1 obj-h1745-reading DomesticWaterTempHyst -attr M1 obj-h1745-type VT_R4 -attr M1 obj-h1777-len 16 -attr M1 obj-h1777-polldelay 86400 -attr M1 obj-h1777-reading LegionellaSchedule -attr M1 obj-h1777-unpack H* -attr M1 obj-h1793-polldelay 86400 -attr M1 obj-h1793-type VT_Time -attr M1 obj-h1809-polldelay 86400 -attr M1 obj-h1809-reading LegionellaTimeOff -attr M1 obj-h1809-type VT_Time -attr M1 obj-h209-len 13 -attr M1 obj-h209-poll 0 -attr M1 obj-h209-reading RTCDate -attr M1 obj-h209-unpack H* -attr M1 obj-h417-len 1 -attr M1 obj-h417-polldelay 86400 -attr M1 obj-h417-reading LngSelect -attr M1 obj-h4497-reading PElectric -attr M1 obj-h4497-type VT_R4 -attr M1 obj-h4529-reading PThermal -attr M1 obj-h4529-type VT_R4 -attr M1 obj-h4689-polldelay 86400 -attr M1 obj-h4689-reading FirmwareVersion -attr M1 obj-h4689-showGet 1 -attr M1 obj-h4689-type VT_String -attr M1 obj-h4689-unpack (a*) -attr M1 obj-h4817-polldelay 86400 -attr M1 obj-h4817-reading FirmwareDate -attr M1 obj-h4817-type VT_String -attr M1 obj-h4945-polldelay 86400 -attr M1 obj-h4945-reading ManufType -attr M1 obj-h4945-type VT_String -attr M1 obj-h5073-polldelay 86400 -attr M1 obj-h5073-reading ManufSerialNum -attr M1 obj-h5073-type VT_String -attr M1 obj-h5457-len 1 -attr M1 obj-h5457-map 0048:Kühlung, 0040:Idle, 0051:Warmwasser, 0052:Heizung -attr M1 obj-h5457-reading OperatingState -attr M1 obj-h5457-unpack H* -attr M1 obj-h5505-len 16 -attr M1 obj-h5505-reading ADC_Error -attr M1 obj-h5505-unpack H* -attr M1 obj-h5521-reading LCD_Display_Line_1 -attr M1 obj-h5521-type VT_String -attr M1 obj-h5649-reading LCD_Display_Line_2 -attr M1 obj-h5649-type VT_String -attr M1 obj-i1217-reading HeatReturnTempNominal -attr M1 obj-i1537-reading CoolReturnTemp -attr M1 obj-i1681-reading DomesticWaterTempActual -attr M1 obj-i2625-reading OHCompressor1 -attr M1 obj-i2657-reading OHCompressor2 -attr M1 obj-i2689-reading OHHeatingCompressor -attr M1 obj-i2721-reading OHHeatingAuxilary -attr M1 obj-i2753-reading OHCooling -attr M1 obj-i2785-reading OHDomesticWaterCompressor -attr M1 obj-i433-reading OutdoorTemp -attr M1 obj-i433-showGet 1 -attr M1 obj-i4561-reading COP -attr M1 obj-i4561-showGet 1 -attr M1 obj-i465-reading OutdoorTemp1h -attr M1 obj-i497-reading OutdoorTemp24h -attr M1 obj-i529-reading HeatSourceIn -attr M1 obj-i561-reading HeatSourceOut -attr M1 obj-i593-reading EvaporationTemp -attr M1 obj-i625-reading SuctionGasTemp -attr M1 obj-i657-reading EvaporationPress -attr M1 obj-i689-reading ReturnTempNominal -attr M1 obj-i721-reading ReturnTemp -attr M1 obj-i753-reading FlowTemp -attr M1 obj-i785-reading CondensationTemp -attr M1 obj-i817-reading CondensationPress -attr M1 obj-i849-reading RoomTemp -attr M1 obj-i881-reading RoomTemp1h -attr M1 obj-i913-reading DomesticWaterTemp -attr M1 obj-i945-reading PoolTemp -attr M1 obj-i977-reading SolarTemp - -attr M1 sortUpdate 1 - +define MS Modbus none +attr MS verbose 5 +attr MS clientSwitchDelay 0 +attr MS busDelay 0 +attr MS skipGarbage 1 + + +define M5 ModbusAttr 5 passive +attr M5 verbose 5 +attr M5 dev-timing-sendDelay 0 +attr M5 dev-timing-commDelay 0 +attr M5 nonPrioritizedGet 1 +attr M5 obj-h256-reading TempWasserEin +attr M5 obj-h258-reading TempWasserAus +attr M5 obj-h10-reading o1 +attr M5 obj-h10-map 0:off, 1:on +attr M5 obj-h10-set 1 +attr M5 obj-h11-reading o2 +attr M5 obj-h11-hint 1,2,3 + +attr M5 dev-h-defSet 1 +attr M5 dev-h-defShowGet 1 + + +define M254 ModbusAttr 254 passive +attr M254 verbose 5 +attr M254 dev-timing-sendDelay 0 +attr M254 dev-timing-commDelay 0 +attr M254 nonPrioritizedGet 1 +attr M254 obj-h256-reading TempWasserEin +attr M254 obj-h258-reading TempWasserAus +attr M254 obj-h10-reading o1 +attr M254 obj-h10-map 0:off, 1:on +attr M254 obj-h10-set 1 +attr M254 obj-h11-reading o2 +attr M254 obj-h11-hint 1,2,3 +attr M254 dev-h-defSet 1 +attr M254 dev-h-defShowGet 1 + + + +define M1 ModbusAttr 1 passive +attr M1 verbose 5 +attr M1 dev-timing-sendDelay 0 +attr M1 dev-timing-commDelay 0 +attr M1 nonPrioritizedGet 1 + +attr M1 dev-c-defPoll 1 +attr M1 dev-h-combine 5 +attr M1 dev-h-defLen 2 +attr M1 dev-h-defPoll 1 +attr M1 dev-h-defRevRegs 1 +attr M1 dev-h-write 16 +attr M1 dev-i-defFormat %.1f +attr M1 dev-i-defLen 2 +attr M1 dev-i-defPoll 1 +attr M1 dev-i-defRevRegs 1 +attr M1 dev-i-defUnpack f> +attr M1 dev-type-VT_Date-expr sprintf("%02d.%02d",($val >> 8),($val & 0xff)) +attr M1 dev-type-VT_Date-len 1 +attr M1 dev-type-VT_Date-unpack n +attr M1 dev-type-VT_R4-format %.1f +attr M1 dev-type-VT_R4-len 2 +attr M1 dev-type-VT_R4-revRegs 1 +attr M1 dev-type-VT_R4-unpack f> +attr M1 dev-type-VT_String-bswapRegs 1 +attr M1 dev-type-VT_String-decode cp850 +attr M1 dev-type-VT_String-encode utf8 +attr M1 dev-type-VT_String-expr $val =~ s/[\00]+//gr +attr M1 dev-type-VT_String-len 8 +attr M1 dev-type-VT_String-revRegs 0 +attr M1 dev-type-VT_String-unpack a* +attr M1 dev-type-VT_Time-expr sprintf("%02d:%02d",($val >> 8),($val & 0xff)) +attr M1 dev-type-VT_Time-len 1 +attr M1 dev-type-VT_Time-unpack n + +attr M1 obj-c1009-map 0:false, 1:true +attr M1 obj-c1009-polldelay 3600 +attr M1 obj-c1009-reading HeatOff +attr M1 obj-c1329-map 0:false, 1:true +attr M1 obj-c1329-polldelay 300 +attr M1 obj-c1329-reading HeatIncreaseOff +attr M1 obj-c1409-map 0:0, 1:1=2, 2:1->2, 3:1->2->3 +attr M1 obj-c1409-polldelay 60 +attr M1 obj-c1409-reading AuxilaryModeHeating +attr M1 obj-c1457-map 0:false, 1:true +attr M1 obj-c1457-reading CoolOff +attr M1 obj-c1633-map 0:false, 1:true +attr M1 obj-c1633-reading DomesticWaterOff +attr M1 obj-h1-len 13 +attr M1 obj-h1-poll 0 +attr M1 obj-h1-reading RTCTime +attr M1 obj-h1-unpack H* +attr M1 obj-h1025-polldelay 86400 +attr M1 obj-h1025-reading HeatTimeOn +attr M1 obj-h1025-type VT_Time +attr M1 obj-h1041-polldelay 86400 +attr M1 obj-h1041-reading HeatTimeOff +attr M1 obj-h1041-type VT_Time +attr M1 obj-h1057-max 30 +attr M1 obj-h1057-min 10 +attr M1 obj-h1057-reading HeatCharacteristicSetPoint +attr M1 obj-h1057-type VT_R4 +attr M1 obj-h1089-max 65 +attr M1 obj-h1089-min 15 +attr M1 obj-h1089-reading HeatCharacteristicSetPointBaseTemp +attr M1 obj-h1089-set 1 +attr M1 obj-h1089-type VT_R4 +attr M1 obj-h1121-max 100 +attr M1 obj-h1121-min 0 +attr M1 obj-h1121-reading HeatCharacteristicGradient +attr M1 obj-h1121-type VT_R4 +attr M1 obj-h1153-max 72 +attr M1 obj-h1153-min 10 +attr M1 obj-h1153-reading HeatCharacteristicLimit +attr M1 obj-h1153-type VT_R4 +attr M1 obj-h1185-reading HeatReturnTemp +attr M1 obj-h1185-type VT_R4 +attr M1 obj-h1249-max 3 +attr M1 obj-h1249-min 1 +attr M1 obj-h1249-reading HeatTempHyst +attr M1 obj-h1249-type VT_R4 +attr M1 obj-h1281-reading RoomTempNominal +attr M1 obj-h1281-type VT_R4 +attr M1 obj-h1313-len 1 +attr M1 obj-h1313-max 200 +attr M1 obj-h1313-min 0 +attr M1 obj-h1313-reading RoomTempFactor +attr M1 obj-h1313-unpack S> +attr M1 obj-h1345-polldelay 86400 +attr M1 obj-h1345-reading HeatIncreaseTimeOn +attr M1 obj-h1345-type VT_Time +attr M1 obj-h1361-polldelay 86400 +attr M1 obj-h1361-reading HeatIncreaseTimeOff +attr M1 obj-h1361-type VT_Time +attr M1 obj-h1377-max 5 +attr M1 obj-h1377-min -5 +attr M1 obj-h1377-reading HeatIncreaseSetPtOffset +attr M1 obj-h1377-type VT_R4 +attr M1 obj-h1425-max 5 +attr M1 obj-h1425-min 0 +attr M1 obj-h1425-reading AuxilaryMaxDifference +attr M1 obj-h1425-type VT_R4 +attr M1 obj-h1473-polldelay 86400 +attr M1 obj-h1473-reading CoolTimeOn +attr M1 obj-h1473-type VT_Time +attr M1 obj-h1489-polldelay 86400 +attr M1 obj-h1489-reading CoolTimeOff +attr M1 obj-h1489-type VT_Time +attr M1 obj-h1505-max 30 +attr M1 obj-h1505-min 18 +attr M1 obj-h1505-reading CoolCharacteristicSetPoint +attr M1 obj-h1505-type VT_R4 +attr M1 obj-h1569-reading CoolReturnTempNominal +attr M1 obj-h1569-type VT_R4 +attr M1 obj-h1601-max 3 +attr M1 obj-h1601-min 1 +attr M1 obj-h1601-reading CoolReturnTempHyst +attr M1 obj-h1601-type VT_R4 +attr M1 obj-h1649-polldelay 86400 +attr M1 obj-h1649-reading DomesticWaterTimeOn +attr M1 obj-h1649-type VT_Time +attr M1 obj-h1665-polldelay 86400 +attr M1 obj-h1665-reading DomesticWaterTimeOff +attr M1 obj-h1665-type VT_Time +attr M1 obj-h1713-reading DomesticWaterTempNominal +attr M1 obj-h1713-set 1 +attr M1 obj-h1713-type VT_R4 +attr M1 obj-h1745-max 10 +attr M1 obj-h1745-min 5 +attr M1 obj-h1745-reading DomesticWaterTempHyst +attr M1 obj-h1745-type VT_R4 +attr M1 obj-h1777-len 16 +attr M1 obj-h1777-polldelay 86400 +attr M1 obj-h1777-reading LegionellaSchedule +attr M1 obj-h1777-unpack H* +attr M1 obj-h1793-polldelay 86400 +attr M1 obj-h1793-type VT_Time +attr M1 obj-h1809-polldelay 86400 +attr M1 obj-h1809-reading LegionellaTimeOff +attr M1 obj-h1809-type VT_Time +attr M1 obj-h209-len 13 +attr M1 obj-h209-poll 0 +attr M1 obj-h209-reading RTCDate +attr M1 obj-h209-unpack H* +attr M1 obj-h417-len 1 +attr M1 obj-h417-polldelay 86400 +attr M1 obj-h417-reading LngSelect +attr M1 obj-h4497-reading PElectric +attr M1 obj-h4497-type VT_R4 +attr M1 obj-h4529-reading PThermal +attr M1 obj-h4529-type VT_R4 +attr M1 obj-h4689-polldelay 86400 +attr M1 obj-h4689-reading FirmwareVersion +attr M1 obj-h4689-showGet 1 +attr M1 obj-h4689-type VT_String +attr M1 obj-h4689-unpack (a*) +attr M1 obj-h4817-polldelay 86400 +attr M1 obj-h4817-reading FirmwareDate +attr M1 obj-h4817-type VT_String +attr M1 obj-h4945-polldelay 86400 +attr M1 obj-h4945-reading ManufType +attr M1 obj-h4945-type VT_String +attr M1 obj-h5073-polldelay 86400 +attr M1 obj-h5073-reading ManufSerialNum +attr M1 obj-h5073-type VT_String +attr M1 obj-h5457-len 1 +attr M1 obj-h5457-map 0048:Kühlung, 0040:Idle, 0051:Warmwasser, 0052:Heizung +attr M1 obj-h5457-reading OperatingState +attr M1 obj-h5457-unpack H* +attr M1 obj-h5505-len 16 +attr M1 obj-h5505-reading ADC_Error +attr M1 obj-h5505-unpack H* +attr M1 obj-h5521-reading LCD_Display_Line_1 +attr M1 obj-h5521-type VT_String +attr M1 obj-h5649-reading LCD_Display_Line_2 +attr M1 obj-h5649-type VT_String +attr M1 obj-i1217-reading HeatReturnTempNominal +attr M1 obj-i1537-reading CoolReturnTemp +attr M1 obj-i1681-reading DomesticWaterTempActual +attr M1 obj-i2625-reading OHCompressor1 +attr M1 obj-i2657-reading OHCompressor2 +attr M1 obj-i2689-reading OHHeatingCompressor +attr M1 obj-i2721-reading OHHeatingAuxilary +attr M1 obj-i2753-reading OHCooling +attr M1 obj-i2785-reading OHDomesticWaterCompressor +attr M1 obj-i433-reading OutdoorTemp +attr M1 obj-i433-showGet 1 +attr M1 obj-i4561-reading COP +attr M1 obj-i4561-showGet 1 +attr M1 obj-i465-reading OutdoorTemp1h +attr M1 obj-i497-reading OutdoorTemp24h +attr M1 obj-i529-reading HeatSourceIn +attr M1 obj-i561-reading HeatSourceOut +attr M1 obj-i593-reading EvaporationTemp +attr M1 obj-i625-reading SuctionGasTemp +attr M1 obj-i657-reading EvaporationPress +attr M1 obj-i689-reading ReturnTempNominal +attr M1 obj-i721-reading ReturnTemp +attr M1 obj-i753-reading FlowTemp +attr M1 obj-i785-reading CondensationTemp +attr M1 obj-i817-reading CondensationPress +attr M1 obj-i849-reading RoomTemp +attr M1 obj-i881-reading RoomTemp1h +attr M1 obj-i913-reading DomesticWaterTemp +attr M1 obj-i945-reading PoolTemp +attr M1 obj-i977-reading SolarTemp + +attr M1 sortUpdate 1 + diff --git a/fhem/t/FHEM/98_Modbus/42_MasterRTU-Perf.cfg b/fhem/t/FHEM/98_Modbus/42_MasterRTU-Perf.cfg new file mode 100644 index 000000000..b4a360c6c --- /dev/null +++ b/fhem/t/FHEM/98_Modbus/42_MasterRTU-Perf.cfg @@ -0,0 +1,101 @@ +attr global mseclog 1 + +define MS Modbus none +attr MS verbose 5 +attr MS clientSwitchDelay 0 +attr MS busDelay 0 + +define PWP ModbusAttr 5 0 +attr PWP verbose 5 +attr PWP dev-timing-sendDelay 0 +attr PWP dev-timing-commDelay 0 +attr PWP dev-timing-timeout 1 +attr PWP cacheUpdateHash 1 +attr PWP cacheParseInfo 1 + +attr PWP dev-h-defSet 1 +attr PWP dev-h-defShowGet 1 +attr PWP dev-h-combine 5 +attr PWP dev-defPolldelay 0 + +attr M5 nonPrioritizedGet 1 + +attr PWP obj-h256-reading Temp_Wasser_Ein +attr PWP obj-h256-expr $val / 10 +attr PWP obj-h256-poll 1 +#attr PWP obj-h256-polldelay 0 + +attr PWP obj-h258-reading Temp_Wasser_Aus +attr PWP obj-h258-expr $val / 10 +attr PWP obj-h258-poll 1 +#attr PWP obj-h258-polldelay 0 + +attr PWP obj-h260-reading Temp_Verdampfer +attr PWP obj-h260-expr $val / 10 +attr PWP obj-h260-poll 1 +#attr PWP obj-h260-polldelay 0 + +attr PWP obj-h262-reading Temp_Luft +attr PWP obj-h262-expr $val / 10 +attr PWP obj-h262-poll 1 +#attr PWP obj-h262-polldelay 0 + +attr PWP obj-h770-reading Temp_Soll +attr PWP obj-h770-expr $val / 10 +attr PWP obj-h770-hint 8,10,20,25,28,29,30,30.5,31,31.5,32 +attr PWP obj-h770-max 32 +attr PWP obj-h770-min 10 +attr PWP obj-h770-set 1 +attr PWP obj-h770-setexpr $val * 10 +attr PWP obj-h770-poll 1 +attr PWP obj-h770-polldelay 0 + +attr PWP obj-h771-reading Hysterese +attr PWP obj-h771-expr $val / 10 +attr PWP obj-h771-max 3 +attr PWP obj-h771-min 0.5 +attr PWP obj-h771-set 1 +attr PWP obj-h771-setexpr $val * 10 +attr PWP obj-h771-poll 1 +attr PWP obj-h771-polldelay 0 + +attr PWP obj-h777-reading Hyst_Mode +attr PWP obj-h777-map 0:mittig, 1:über, 2:unterhalb +attr PWP obj-h777-set 1 +attr PWP obj-h777-poll 1 +attr PWP obj-h777-polldelay 0 + + +attr PWP obj-h801-reading Temp_Wasser_Ein_Off +attr PWP obj-h801-expr $val / 10 +attr PWP obj-h801-name CF24 +attr PWP obj-h801-poll 1 +attr PWP obj-h801-set 1 +attr PWP obj-h801-setexpr $val * 10 +attr PWP obj-h801-polldelay 0 + +attr PWP obj-h802-reading Temp_Wasser_Aus_Off +attr PWP obj-h802-expr $val / 10 +attr PWP obj-h802-name CF25 +attr PWP obj-h802-poll 1 +attr PWP obj-h802-set 1 +attr PWP obj-h802-setexpr $val * 10 +attr PWP obj-h802-polldelay 0 + +attr PWP obj-h803-reading Temp_Verdampfer_Off +attr PWP obj-h803-expr $val / 10 +attr PWP obj-h803-name CF26 +attr PWP obj-h803-poll 1 +attr PWP obj-h803-set 1 +attr PWP obj-h803-setexpr $val * 10 +attr PWP obj-h803-polldelay 0 + +attr PWP obj-h804-reading Temp_Luft_Off +attr PWP obj-h804-expr $val / 10 +attr PWP obj-h804-name CF27 +attr PWP obj-h804-poll 1 +attr PWP obj-h804-set 1 +attr PWP obj-h804-setexpr $val * 10 +attr PWP obj-h804-polldelay 0 + + diff --git a/fhem/t/FHEM/98_Modbus/42_MasterRTU-Perf.t b/fhem/t/FHEM/98_Modbus/42_MasterRTU-Perf.t new file mode 100644 index 000000000..35012dc36 --- /dev/null +++ b/fhem/t/FHEM/98_Modbus/42_MasterRTU-Perf.t @@ -0,0 +1,210 @@ +############################################## +# test modbus RTU Master +############################################## + +package main; + +use strict; +use warnings; +use Test::More; +use Time::HiRes qw( gettimeofday tv_interval); # return time as float, not just full seconds +use FHEM::HTTPMOD::Utils qw(:all); +use FHEM::Modbus::TestUtils qw(:all); + +my $prepTime = 0; +my $parseTime = 0; + +NextStep(); + +sub CheckTimes { + my $t1 = FhemTestUtils_getLogTime('GetUpdate.*called from ControlSet'); + if (!$t1) { + $t1 = FhemTestUtils_getLogTime('ProcessRequestQueue.*sending'); + } + my $t2 = FhemTestUtils_getLogTime('Simulate sending to none'); + Log3 undef, 1, "Test: Time to prepare request: " . sprintf('%.3f seconds', ($t2 - $t1)); + my $t3 = FhemTestUtils_getLogTime('simulate reception of'); + my $t4 = FhemTestUtils_getLogTime('HandleResponse done'); + Log3 undef, 1, "Test: Time to parse request: " . sprintf('%.3f seconds', ($t4 - $t3)); + Log3 undef, 1, "Test: Time inbetween: " . sprintf('%.3f seconds', ($t3 - $t2)); + $prepTime += ($t2 - $t1); + $parseTime += ($t4 - $t3); + return; +} + +sub testStep1 { + fhem 'attr MS verbose 5'; + fhem 'attr PWP verbose 5'; + LogStep('start reread'); + FhemTestUtils_resetLogs(); + fhem('set PWP reread'); + return; +} + + + +sub testStep2 { + LogStep('check send timing an simulate first normal reception'); + + SimRead('MS', '05030a'); # first normal response + SimRead('MS', '012e11'); + SimRead('MS', '00012f11'); + SimRead('MS', '0000db'); + SimRead('MS', 'ffe6'); + + ok(ReadingsVal('PWP', 'Temp_Wasser_Ein', 0) > 25, "Parse TempEin"); + ok(ReadingsVal('PWP', 'Temp_Verdampfer', 0) > 10, "Parse TempVerdampfer"); + CheckTimes(); + CheckAndReset(); + return; +} + +sub testStep3 { + LogStep('check send timing an simulate second normal reception'); + SimRead('MS', '0503'); # second normal response + SimRead('MS', '0200'); + SimRead('MS', 'bac8'); + SimRead('MS', '37'); + ok(ReadingsVal('PWP', 'Temp_Luft', 0) > 10, "Parse TempLuft"); + CheckTimes(); + CheckAndReset(); + return; +} + + +sub testStep4 { + LogStep('check send timing an simulate third normal reception'); + SimRead('MS', '05'); # third normal response + SimRead('MS', '0304'); + SimRead('MS', '0122'); + SimRead('MS', '000a'); + SimRead('MS', '9e02'); + ok(ReadingsVal('PWP', 'Temp_Soll', 0) > 10, "Parse TempSoll"); + CheckTimes(); + CheckAndReset(); + return; +} + + +sub testStep5 { + LogStep('check send timing an simulate fourth normal reception'); + SimRead('MS', '05'); # fourth normal response + SimRead('MS', '03'); + SimRead('MS', '0200'); + SimRead('MS', '0049'); + SimRead('MS', '84'); + ok(ReadingsVal('PWP', 'Hyst_Mode', '') eq 'mittig', "Parse Hyst_Mode"); + CheckTimes(); + CheckAndReset(); + return; +} + + +sub testStep6 { + LogStep('check send timing an simulate fifth normal reception'); + SimRead('MS', '0503'); # fifth normal response + SimRead('MS', '08ff'); + SimRead('MS', 'fd00'); + SimRead('MS', '0000'); + SimRead('MS', '0000'); + SimRead('MS', '00e3'); + SimRead('MS', '2c'); + ok(ReadingsVal('PWP', 'Temp_Luft_Off', 99) < 2, "Parse TempLuftOff"); + CheckTimes(); + CheckAndReset(); + Log3 undef, 1, "Test: so far cumulated total time: " . sprintf('%.3f seconds', $prepTime + $parseTime); + return; +} + + +sub testStep10 { + LogStep('second round reread'); + fhem('set PWP reread'); + return; +} + + + +sub testStep11 { + LogStep('check send timing an simulate first normal reception'); + + SimRead('MS', '05030a'); # first normal response + SimRead('MS', '012e11'); + SimRead('MS', '00012f11'); + SimRead('MS', '0000db'); + SimRead('MS', 'ffe6'); + + ok(ReadingsVal('PWP', 'Temp_Wasser_Ein', 0) > 25, "Parse TempEin"); + ok(ReadingsVal('PWP', 'Temp_Verdampfer', 0) > 10, "Parse TempVerdampfer"); + CheckTimes(); + CheckAndReset(); + return; +} + +sub testStep12 { + LogStep('check send timing an simulate second normal reception'); + SimRead('MS', '0503'); # second normal response + SimRead('MS', '0200'); + SimRead('MS', 'bac8'); + SimRead('MS', '37'); + ok(ReadingsVal('PWP', 'Temp_Luft', 0) > 10, "Parse TempLuft"); + CheckTimes(); + CheckAndReset(); + return; +} + + +sub testStep13 { + LogStep('check send timing an simulate third normal reception'); + SimRead('MS', '05'); # third normal response + SimRead('MS', '0304'); + SimRead('MS', '0122'); + SimRead('MS', '000a'); + SimRead('MS', '9e02'); + ok(ReadingsVal('PWP', 'Temp_Soll', 0) > 10, "Parse TempSoll"); + CheckTimes(); + CheckAndReset(); + return; +} + + +sub testStep14 { + LogStep('check send timing an simulate fourth normal reception'); + SimRead('MS', '05'); # fourth normal response + SimRead('MS', '03'); + SimRead('MS', '0200'); + SimRead('MS', '0049'); + SimRead('MS', '84'); + ok(ReadingsVal('PWP', 'Hyst_Mode', '') eq 'mittig', "Parse Hyst_Mode"); + CheckTimes(); + CheckAndReset(); + return; +} + + +sub testStep15 { + LogStep('check send timing an simulate fifth normal reception'); + SimRead('MS', '0503'); # fifth normal response + SimRead('MS', '08ff'); + SimRead('MS', 'fd00'); + SimRead('MS', '0000'); + SimRead('MS', '0000'); + SimRead('MS', '00e3'); + SimRead('MS', '2c'); + ok(ReadingsVal('PWP', 'Temp_Luft_Off', 99) < 2, "Parse TempLuftOff"); + CheckTimes(); + CheckAndReset(); + return; +} + + +sub testStep90 { + LogStep('done'); + Log3 undef, 1, "Test: cumulated time to prepare requests: " . sprintf('%.3f seconds', $prepTime); + Log3 undef, 1, "Test: cumulated time to parse requests: " . sprintf('%.3f seconds', $parseTime); + Log3 undef, 1, "Test: cumulated total time: " . sprintf('%.3f seconds', $prepTime + $parseTime); + return; +} + + +1; diff --git a/fhem/t/FHEM/98_Modbus/42_MasterRTU.cfg b/fhem/t/FHEM/98_Modbus/42_MasterRTU.cfg index 5c1837c23..5dd23fef0 100644 --- a/fhem/t/FHEM/98_Modbus/42_MasterRTU.cfg +++ b/fhem/t/FHEM/98_Modbus/42_MasterRTU.cfg @@ -1,85 +1,85 @@ -attr global mseclog 1 - -define MS Modbus none -attr MS verbose 5 -attr MS clientSwitchDelay 0 -attr MS busDelay 0 - -define PWP ModbusAttr 5 0 -attr PWP verbose 5 -attr PWP dev-timing-sendDelay 0 -attr PWP dev-timing-commDelay 0 -attr PWP dev-timing-timeout 1 -attr PWP dev-h-defSet 1 -attr PWP dev-h-defShowGet 1 -attr PWP dev-h-combine 16 - -attr M5 nonPrioritizedGet 1 - -attr PWP obj-h256-reading Temp_Wasser_Ein -attr PWP obj-h256-expr $val / 10 -attr PWP obj-h256-poll 1 -attr PWP obj-h256-polldelay 0 - -attr PWP obj-h258-reading Temp_Wasser_Aus -attr PWP obj-h258-expr $val / 10 -attr PWP obj-h258-poll 1 -attr PWP obj-h258-polldelay 0 - -attr PWP obj-h260-reading Temp_Verdampfer -attr PWP obj-h260-expr $val / 10 -attr PWP obj-h260-poll 1 -attr PWP obj-h260-polldelay 0 - -attr PWP obj-h262-reading Temp_Luft -attr PWP obj-h262-expr $val / 10 -attr PWP obj-h262-poll 0 - -attr PWP obj-h770-reading Temp_Soll -attr PWP obj-h770-expr $val / 10 -attr PWP obj-h770-hint 8,10,20,25,28,29,30,30.5,31,31.5,32 -attr PWP obj-h770-max 32 -attr PWP obj-h770-min 10 -attr PWP obj-h770-set 1 -attr PWP obj-h770-setexpr $val * 10 - -attr PWP obj-h771-reading Hysterese -attr PWP obj-h771-expr $val / 10 -attr PWP obj-h771-max 3 -attr PWP obj-h771-min 0.5 -attr PWP obj-h771-set 1 -attr PWP obj-h771-setexpr $val * 10 - -attr PWP obj-h777-reading Hyst_Mode -attr PWP obj-h777-map 0:mittig, 1:über, 2:unterhalb -attr PWP obj-h777-set 1 - -attr PWP obj-h801-reading Temp_Wasser_Ein_Off -attr PWP obj-h801-expr $val / 10 -attr PWP obj-h801-name CF24 -attr PWP obj-h801-poll 0 -attr PWP obj-h801-set 1 -attr PWP obj-h801-setexpr $val * 10 - -attr PWP obj-h802-reading Temp_Wasser_Aus_Off -attr PWP obj-h802-expr $val / 10 -attr PWP obj-h802-name CF25 -attr PWP obj-h802-poll 0 -attr PWP obj-h802-set 1 -attr PWP obj-h802-setexpr $val * 10 - -attr PWP obj-h803-reading Temp_Verdampfer_Off -attr PWP obj-h803-expr $val / 10 -attr PWP obj-h803-name CF26 -attr PWP obj-h803-poll 0 -attr PWP obj-h803-set 1 -attr PWP obj-h803-setexpr $val * 10 - -attr PWP obj-h804-reading Temp_Luft_Off -attr PWP obj-h804-expr $val / 10 -attr PWP obj-h804-name CF27 -attr PWP obj-h804-poll 0 -attr PWP obj-h804-set 1 -attr PWP obj-h804-setexpr $val * 10 - - +attr global mseclog 1 + +define MS Modbus none +attr MS verbose 5 +attr MS clientSwitchDelay 0 +attr MS busDelay 0 + +define PWP ModbusAttr 5 0 +attr PWP verbose 5 +attr PWP dev-timing-sendDelay 0 +attr PWP dev-timing-commDelay 0 +attr PWP dev-timing-timeout 1 +attr PWP dev-h-defSet 1 +attr PWP dev-h-defShowGet 1 +attr PWP dev-h-combine 16 + +attr M5 nonPrioritizedGet 1 + +attr PWP obj-h256-reading Temp_Wasser_Ein +attr PWP obj-h256-expr $val / 10 +attr PWP obj-h256-poll 1 +attr PWP obj-h256-polldelay 0 + +attr PWP obj-h258-reading Temp_Wasser_Aus +attr PWP obj-h258-expr $val / 10 +attr PWP obj-h258-poll 1 +attr PWP obj-h258-polldelay 0 + +attr PWP obj-h260-reading Temp_Verdampfer +attr PWP obj-h260-expr $val / 10 +attr PWP obj-h260-poll 1 +attr PWP obj-h260-polldelay 0 + +attr PWP obj-h262-reading Temp_Luft +attr PWP obj-h262-expr $val / 10 +attr PWP obj-h262-poll 0 + +attr PWP obj-h770-reading Temp_Soll +attr PWP obj-h770-expr $val / 10 +attr PWP obj-h770-hint 8,10,20,25,28,29,30,30.5,31,31.5,32 +attr PWP obj-h770-max 32 +attr PWP obj-h770-min 10 +attr PWP obj-h770-set 1 +attr PWP obj-h770-setexpr $val * 10 + +attr PWP obj-h771-reading Hysterese +attr PWP obj-h771-expr $val / 10 +attr PWP obj-h771-max 3 +attr PWP obj-h771-min 0.5 +attr PWP obj-h771-set 1 +attr PWP obj-h771-setexpr $val * 10 + +attr PWP obj-h777-reading Hyst_Mode +attr PWP obj-h777-map 0:mittig, 1:über, 2:unterhalb +attr PWP obj-h777-set 1 + +attr PWP obj-h801-reading Temp_Wasser_Ein_Off +attr PWP obj-h801-expr $val / 10 +attr PWP obj-h801-name CF24 +attr PWP obj-h801-poll 0 +attr PWP obj-h801-set 1 +attr PWP obj-h801-setexpr $val * 10 + +attr PWP obj-h802-reading Temp_Wasser_Aus_Off +attr PWP obj-h802-expr $val / 10 +attr PWP obj-h802-name CF25 +attr PWP obj-h802-poll 0 +attr PWP obj-h802-set 1 +attr PWP obj-h802-setexpr $val * 10 + +attr PWP obj-h803-reading Temp_Verdampfer_Off +attr PWP obj-h803-expr $val / 10 +attr PWP obj-h803-name CF26 +attr PWP obj-h803-poll 0 +attr PWP obj-h803-set 1 +attr PWP obj-h803-setexpr $val * 10 + +attr PWP obj-h804-reading Temp_Luft_Off +attr PWP obj-h804-expr $val / 10 +attr PWP obj-h804-name CF27 +attr PWP obj-h804-poll 0 +attr PWP obj-h804-set 1 +attr PWP obj-h804-setexpr $val * 10 + + diff --git a/fhem/t/FHEM/98_Modbus/43_SlaveRTU.cfg b/fhem/t/FHEM/98_Modbus/43_SlaveRTU.cfg index acbd6a93a..34ec15c5f 100644 --- a/fhem/t/FHEM/98_Modbus/43_SlaveRTU.cfg +++ b/fhem/t/FHEM/98_Modbus/43_SlaveRTU.cfg @@ -1,136 +1,136 @@ -attr global mseclog 1 - -define D1 dummy - -define ModbusIO1 Modbus none -attr ModbusIO1 verbose 5 - -define ModbusIO2 Modbus none -attr ModbusIO2 verbose 5 - -define Slave ModbusAttr 5 slave -attr Slave IODev ModbusIO1 -attr Slave obj-h256-reading TempWasserEin -attr Slave obj-h258-reading D1:TempWasserAus - -attr Slave obj-h100-reading Test1 -attr Slave obj-h100-setexpr $val * 4 - -attr Slave obj-h101-reading Test2 -attr Slave obj-h101-unpack f> -attr Slave obj-h101-len 2 - -attr Slave obj-h103-reading Test3 -attr Slave obj-h103-unpack a8 -attr Slave obj-h103-len 4 - -attr Slave obj-h120-reading Test4 -attr Slave obj-h120-unpack f> -attr Slave obj-h120-len 2 - -attr Slave obj-h130-reading Test5 -attr Slave obj-h130-unpack a* -attr Slave obj-h130-len 2 - -attr Slave obj-c400-reading c0 -attr Slave obj-c401-reading c1 -attr Slave obj-c402-reading c2 -attr Slave obj-c403-reading c3 -attr Slave obj-c404-reading c4 -attr Slave obj-c405-reading c5 -attr Slave obj-c406-reading c6 -attr Slave obj-c407-reading c7 -attr Slave obj-c408-reading c8 -attr Slave obj-c409-reading c9 -attr Slave obj-c410-reading c10 -attr Slave obj-c411-reading c11 -attr Slave obj-c412-reading c12 -attr Slave obj-c413-reading c13 -attr Slave obj-c414-reading c14 -attr Slave obj-c415-reading c15 -attr Slave obj-c416-reading c16 -attr Slave obj-c417-reading c17 -attr Slave obj-c418-reading c18 - - -define Master ModbusAttr 5 0 -attr Master IODev ModbusIO2 -attr Master disable 1 -attr Master verbose 3 -attr Master nonPrioritizedGet 1 -attr Master nonPrioritizedSet 1 - -attr Master dev-timing-sendDelay 0 -attr Master dev-timing-commDelay 0 - -attr Master obj-h256-reading TempWasserEin -attr Master obj-h258-reading TempWasserAus - -attr Master obj-h100-reading Test1 -attr Master obj-h100-expr $val + 2 -attr Master obj-h100-poll 1 -attr Master obj-h100-polldelay 0 - -attr Master obj-h101-reading Test2 -attr Master obj-h101-unpack f> -attr Master obj-h101-len 2 -attr Master obj-h101-format %.2f -attr Master obj-h101-poll 1 -attr Master obj-h101-polldelay 0 - -attr Master obj-h103-reading Test3 -attr Master obj-h103-unpack a8 -attr Master obj-h103-len 4 -attr Master obj-h103-poll 1 -attr Master obj-h103-polldelay 0 - -attr Master obj-h120-reading Test4 -attr Master obj-h120-unpack f> -attr Master obj-h120-len 2 -attr Master obj-h120-format %.2f -attr Master obj-h120-poll 1 -attr Master obj-h120-ignoreExpr $val > 10 -attr Master obj-h120-polldelay 0 - -attr Master obj-h130-reading Test5 -attr Master obj-h130-unpack a* -attr Master obj-h130-len 2 -attr Master obj-h130-encode utf8 - -attr Master obj-h10-reading o1 -attr Master obj-h10-map 0:off, 1:on - -attr Master obj-h11-reading o2 -attr Master obj-h11-min 1 -attr Master obj-h11-max 3 -attr Master dev-h-defSet 1 -attr Master dev-c-defSet 1 -attr Master dev-h-defShowGet 1 - -attr Master obj-c400-reading c0 -attr Master obj-c401-reading c1 -attr Master obj-c402-reading c2 -attr Master obj-c403-reading c3 -attr Master obj-c404-reading c4 -attr Master obj-c405-reading c5 -attr Master obj-c406-reading c6 -attr Master obj-c407-reading c7 -attr Master obj-c408-reading c8 -attr Master obj-c409-reading c9 -attr Master obj-c410-reading c10 -attr Master obj-c411-reading c11 -attr Master obj-c412-reading c12 -attr Master obj-c413-reading c13 -attr Master obj-c414-reading c14 -attr Master obj-c415-reading c15 -attr Master obj-c416-reading c16 -attr Master obj-c417-reading c17 -attr Master obj-c418-reading c18 - -attr Master obj-c400-poll 1 -attr Master obj-c405-poll 1 -attr Master obj-c406-poll 1 -attr Master obj-c417-poll 1 - -attr Master dev-h-combine 19 +attr global mseclog 1 + +define D1 dummy + +define ModbusIO1 Modbus none +attr ModbusIO1 verbose 5 + +define ModbusIO2 Modbus none +attr ModbusIO2 verbose 5 + +define Slave ModbusAttr 5 slave +attr Slave IODev ModbusIO1 +attr Slave obj-h256-reading TempWasserEin +attr Slave obj-h258-reading D1:TempWasserAus + +attr Slave obj-h100-reading Test1 +attr Slave obj-h100-setexpr $val * 4 + +attr Slave obj-h101-reading Test2 +attr Slave obj-h101-unpack f> +attr Slave obj-h101-len 2 + +attr Slave obj-h103-reading Test3 +attr Slave obj-h103-unpack a8 +attr Slave obj-h103-len 4 + +attr Slave obj-h120-reading Test4 +attr Slave obj-h120-unpack f> +attr Slave obj-h120-len 2 + +attr Slave obj-h130-reading Test5 +attr Slave obj-h130-unpack a* +attr Slave obj-h130-len 2 + +attr Slave obj-c400-reading c0 +attr Slave obj-c401-reading c1 +attr Slave obj-c402-reading c2 +attr Slave obj-c403-reading c3 +attr Slave obj-c404-reading c4 +attr Slave obj-c405-reading c5 +attr Slave obj-c406-reading c6 +attr Slave obj-c407-reading c7 +attr Slave obj-c408-reading c8 +attr Slave obj-c409-reading c9 +attr Slave obj-c410-reading c10 +attr Slave obj-c411-reading c11 +attr Slave obj-c412-reading c12 +attr Slave obj-c413-reading c13 +attr Slave obj-c414-reading c14 +attr Slave obj-c415-reading c15 +attr Slave obj-c416-reading c16 +attr Slave obj-c417-reading c17 +attr Slave obj-c418-reading c18 + + +define Master ModbusAttr 5 0 +attr Master IODev ModbusIO2 +attr Master disable 1 +attr Master verbose 3 +attr Master nonPrioritizedGet 1 +attr Master nonPrioritizedSet 1 + +attr Master dev-timing-sendDelay 0 +attr Master dev-timing-commDelay 0 + +attr Master obj-h256-reading TempWasserEin +attr Master obj-h258-reading TempWasserAus + +attr Master obj-h100-reading Test1 +attr Master obj-h100-expr $val + 2 +attr Master obj-h100-poll 1 +attr Master obj-h100-polldelay 0 + +attr Master obj-h101-reading Test2 +attr Master obj-h101-unpack f> +attr Master obj-h101-len 2 +attr Master obj-h101-format %.2f +attr Master obj-h101-poll 1 +attr Master obj-h101-polldelay 0 + +attr Master obj-h103-reading Test3 +attr Master obj-h103-unpack a8 +attr Master obj-h103-len 4 +attr Master obj-h103-poll 1 +attr Master obj-h103-polldelay 0 + +attr Master obj-h120-reading Test4 +attr Master obj-h120-unpack f> +attr Master obj-h120-len 2 +attr Master obj-h120-format %.2f +attr Master obj-h120-poll 1 +attr Master obj-h120-ignoreExpr $val > 10 +attr Master obj-h120-polldelay 0 + +attr Master obj-h130-reading Test5 +attr Master obj-h130-unpack a* +attr Master obj-h130-len 2 +attr Master obj-h130-encode utf8 + +attr Master obj-h10-reading o1 +attr Master obj-h10-map 0:off, 1:on + +attr Master obj-h11-reading o2 +attr Master obj-h11-min 1 +attr Master obj-h11-max 3 +attr Master dev-h-defSet 1 +attr Master dev-c-defSet 1 +attr Master dev-h-defShowGet 1 + +attr Master obj-c400-reading c0 +attr Master obj-c401-reading c1 +attr Master obj-c402-reading c2 +attr Master obj-c403-reading c3 +attr Master obj-c404-reading c4 +attr Master obj-c405-reading c5 +attr Master obj-c406-reading c6 +attr Master obj-c407-reading c7 +attr Master obj-c408-reading c8 +attr Master obj-c409-reading c9 +attr Master obj-c410-reading c10 +attr Master obj-c411-reading c11 +attr Master obj-c412-reading c12 +attr Master obj-c413-reading c13 +attr Master obj-c414-reading c14 +attr Master obj-c415-reading c15 +attr Master obj-c416-reading c16 +attr Master obj-c417-reading c17 +attr Master obj-c418-reading c18 + +attr Master obj-c400-poll 1 +attr Master obj-c405-poll 1 +attr Master obj-c406-poll 1 +attr Master obj-c417-poll 1 + +attr Master dev-h-combine 19 attr Master dev-c-combine 32 \ No newline at end of file diff --git a/fhem/t/FHEM/98_Modbus/50_MasterSlave0.cfg b/fhem/t/FHEM/98_Modbus/50_MasterSlave0.cfg index a6a0806ad..62c056172 100644 --- a/fhem/t/FHEM/98_Modbus/50_MasterSlave0.cfg +++ b/fhem/t/FHEM/98_Modbus/50_MasterSlave0.cfg @@ -1,130 +1,139 @@ -attr global mseclog 1 - -define D1 dummy - -define Slave ModbusAttr 5 slave global:5501 -attr Slave obj-h256-reading TempWasserEin -attr Slave obj-h258-reading D1:TempWasserAus - -attr Slave obj-h100-reading Test1 -attr Slave obj-h100-setexpr $val * 4 - -attr Slave obj-h101-reading Test2 -attr Slave obj-h101-unpack f> -attr Slave obj-h101-len 2 - -attr Slave obj-h103-reading Test3 -attr Slave obj-h103-unpack a8 -attr Slave obj-h103-len 4 - -attr Slave obj-h120-reading Test4 -attr Slave obj-h120-unpack f> -attr Slave obj-h120-len 2 - -attr Slave obj-h130-reading Test5 -attr Slave obj-h130-unpack a* -attr Slave obj-h130-len 2 - -attr Slave obj-c400-reading c0 -attr Slave obj-c401-reading c1 -attr Slave obj-c402-reading c2 -attr Slave obj-c403-reading c3 -attr Slave obj-c404-reading c4 -attr Slave obj-c405-reading c5 -attr Slave obj-c406-reading c6 -attr Slave obj-c407-reading c7 -attr Slave obj-c408-reading c8 -attr Slave obj-c409-reading c9 -attr Slave obj-c410-reading c10 -attr Slave obj-c411-reading c11 -attr Slave obj-c412-reading c12 -attr Slave obj-c413-reading c13 -attr Slave obj-c414-reading c14 -attr Slave obj-c415-reading c15 -attr Slave obj-c416-reading c16 -attr Slave obj-c417-reading c17 -attr Slave obj-c418-reading c18 - -define Master ModbusAttr 5 0 localhost:5501 -attr Master disable 1 -attr Master verbose 3 -attr Master nonPrioritizedGet 1 -attr Master nonPrioritizedSet 1 - -attr Master dev-timing-sendDelay 0 -attr Master dev-timing-commDelay 0 - -attr Master obj-h256-reading TempWasserEin -attr Master obj-h258-reading TempWasserAus - -attr Master obj-h100-reading Test1 -attr Master obj-h100-expr $val + 2 -attr Master obj-h100-poll 1 -attr Master obj-h100-polldelay 0 - -attr Master obj-h101-reading Test2 -attr Master obj-h101-unpack f> -attr Master obj-h101-len 2 -attr Master obj-h101-format %.2f -attr Master obj-h101-poll 1 -attr Master obj-h101-polldelay 0 - -attr Master obj-h103-reading Test3 -attr Master obj-h103-unpack a8 -attr Master obj-h103-len 4 -attr Master obj-h103-poll 1 -attr Master obj-h103-polldelay 0 - -attr Master obj-h120-reading Test4 -attr Master obj-h120-unpack f> -attr Master obj-h120-len 2 -attr Master obj-h120-format %.2f -attr Master obj-h120-poll 1 -attr Master obj-h120-ignoreExpr $val > 10 -attr Master obj-h120-polldelay 0 - -attr Master obj-h130-reading Test5 -attr Master obj-h130-unpack a* -attr Master obj-h130-len 2 -attr Master obj-h130-encode utf8 - -attr Master obj-h10-reading o1 -attr Master obj-h10-map 0:off, 1:on - -attr Master obj-h11-reading o2 -attr Master obj-h11-min 1 -attr Master obj-h11-max 3 - -attr Master obj-h999-reading NoReading - -attr Master dev-h-defSet 1 -attr Master dev-c-defSet 1 -attr Master dev-h-defShowGet 1 - -attr Master obj-c400-reading c0 -attr Master obj-c401-reading c1 -attr Master obj-c402-reading c2 -attr Master obj-c403-reading c3 -attr Master obj-c404-reading c4 -attr Master obj-c405-reading c5 -attr Master obj-c406-reading c6 -attr Master obj-c407-reading c7 -attr Master obj-c408-reading c8 -attr Master obj-c409-reading c9 -attr Master obj-c410-reading c10 -attr Master obj-c411-reading c11 -attr Master obj-c412-reading c12 -attr Master obj-c413-reading c13 -attr Master obj-c414-reading c14 -attr Master obj-c415-reading c15 -attr Master obj-c416-reading c16 -attr Master obj-c417-reading c17 -attr Master obj-c418-reading c18 - -attr Master obj-c400-poll 1 -attr Master obj-c405-poll 1 -attr Master obj-c406-poll 1 -attr Master obj-c417-poll 1 - -attr Master dev-h-combine 19 +attr global mseclog 1 + +define D1 dummy + +define Slave ModbusAttr 5 slave global:5501 +attr Slave obj-h256-reading TempWasserEin +attr Slave obj-h258-reading D1:TempWasserAus + +attr Slave obj-h100-reading Test1 +attr Slave obj-h100-setexpr $val * 4 + +attr Slave obj-h101-reading Test2 +attr Slave obj-h101-unpack f> +attr Slave obj-h101-len 2 + +attr Slave obj-h103-reading Test3 +attr Slave obj-h103-unpack a8 +attr Slave obj-h103-len 4 + +attr Slave obj-h120-reading Test4 +attr Slave obj-h120-unpack f> +attr Slave obj-h120-len 2 + +attr Slave obj-h130-reading Test5 +attr Slave obj-h130-unpack a* +attr Slave obj-h130-len 2 + +attr Slave obj-c400-reading c0 +attr Slave obj-c401-reading c1 +attr Slave obj-c402-reading c2 +attr Slave obj-c403-reading c3 +attr Slave obj-c404-reading c4 +attr Slave obj-c405-reading c5 +attr Slave obj-c406-reading c6 +attr Slave obj-c407-reading c7 +attr Slave obj-c408-reading c8 +attr Slave obj-c409-reading c9 +attr Slave obj-c410-reading c10 +attr Slave obj-c411-reading c11 +attr Slave obj-c412-reading c12 +attr Slave obj-c413-reading c13 +attr Slave obj-c414-reading c14 +attr Slave obj-c415-reading c15 +attr Slave obj-c416-reading c16 +attr Slave obj-c417-reading c17 +attr Slave obj-c418-reading c18 + + +define Master ModbusAttr 5 0 localhost:5501 +attr Master disable 1 +attr Master verbose 3 +attr Master nonPrioritizedGet 1 +attr Master nonPrioritizedSet 1 + +attr Master dev-timing-sendDelay 0 +attr Master dev-timing-commDelay 0 + +attr Master obj-h256-reading TempWasserEin +attr Master obj-h258-reading TempWasserAus + +attr Master obj-h100-reading Test1 +attr Master obj-h100-expr $val + 2 +attr Master obj-h100-poll 1 +attr Master obj-h100-polldelay 0 + +attr Master obj-h101-reading Test2 +attr Master obj-h101-unpack f> +attr Master obj-h101-len 2 +attr Master obj-h101-format %.2f +attr Master obj-h101-poll 1 +attr Master obj-h101-polldelay 0 + +attr Master obj-h103-reading Test3 +attr Master obj-h103-unpack a8 +attr Master obj-h103-len 4 +attr Master obj-h103-poll 1 +attr Master obj-h103-polldelay 0 + +attr Master obj-h120-reading Test4 +attr Master obj-h120-unpack f> +attr Master obj-h120-len 2 +attr Master obj-h120-format %.2f +attr Master obj-h120-poll 1 +attr Master obj-h120-ignoreExpr $val > 10 +attr Master obj-h120-polldelay 0 + +attr Master obj-h130-reading Test5 +attr Master obj-h130-unpack a* +attr Master obj-h130-len 2 +attr Master obj-h130-encode utf8 + + +attr Master obj-h10-reading o1 +attr Master obj-h10-map 0:off, 1:on + +attr Master obj-h11-reading o2 +attr Master obj-h11-min 1 +attr Master obj-h11-max 3 + +attr Master obj-h12-reading o3 +attr Master obj-h10-map 0:off, 1:on + +attr Master obj-h13-reading o4 +attr Master obj-h13-map 0:off, 1:on +attr Master obj-h13-rmapDefault 5 + +attr Master obj-h999-reading NoReading + +attr Master dev-h-defSet 1 +attr Master dev-c-defSet 1 +attr Master dev-h-defShowGet 1 + +attr Master obj-c400-reading c0 +attr Master obj-c401-reading c1 +attr Master obj-c402-reading c2 +attr Master obj-c403-reading c3 +attr Master obj-c404-reading c4 +attr Master obj-c405-reading c5 +attr Master obj-c406-reading c6 +attr Master obj-c407-reading c7 +attr Master obj-c408-reading c8 +attr Master obj-c409-reading c9 +attr Master obj-c410-reading c10 +attr Master obj-c411-reading c11 +attr Master obj-c412-reading c12 +attr Master obj-c413-reading c13 +attr Master obj-c414-reading c14 +attr Master obj-c415-reading c15 +attr Master obj-c416-reading c16 +attr Master obj-c417-reading c17 +attr Master obj-c418-reading c18 + +attr Master obj-c400-poll 1 +attr Master obj-c405-poll 1 +attr Master obj-c406-poll 1 +attr Master obj-c417-poll 1 + +attr Master dev-h-combine 19 attr Master dev-c-combine 32 \ No newline at end of file diff --git a/fhem/t/FHEM/98_Modbus/50_MasterSlave0.t b/fhem/t/FHEM/98_Modbus/50_MasterSlave0.t index 0fa523490..aea19d44f 100644 --- a/fhem/t/FHEM/98_Modbus/50_MasterSlave0.t +++ b/fhem/t/FHEM/98_Modbus/50_MasterSlave0.t @@ -1,5 +1,6 @@ ############################################## # test master slave end to end +# also map, min max, ... ############################################## package main; @@ -249,7 +250,51 @@ sub testStep36 { sub testStep32 { #LogStep ""; #is(FhemTestUtils_gotEvent(qr/D1:TempWasserAus:\s20/xms), 1, "Write value to local slave"); - return 0.1; + CheckAndReset(); + return; } + +sub testStep40 { # check input map default + fhem ('attr Master verbose 4'); + fhem ('attr Master dev-h-write 6'); # back to standard + fhem ('attr Slave verbose 3'); + fhem ('setreading Slave Test1 1'); + fhem 'deleteattr Master obj-h100-expr'; + fhem 'attr Master obj-h100-map 1:low, 2:medium, 3:high'; + + fhem 'set Master o4 none'; + fhem 'get Master Test1'; + + return 0.2; +} + +sub testStep41 { # check write data + LogStep "check log for map with default"; + is(FhemTestUtils_gotLog('0506000d0005d98e'), 1, "set o1 5 (default) message in log"); + CheckAndReset(); + return; +} + +sub testStep45 { # check ouput map with default + fhem ('attr Master verbose 5'); + fhem ('attr Slave verbose 4'); + + fhem ('setreading Slave Test1 1'); # Slave expr will answer with 4 + fhem 'deleteattr Master obj-h100-expr'; + fhem 'attr Master obj-h100-map 1:low, 2:medium, 3:high'; + fhem 'attr Master obj-h100-mapDefault invalid'; + fhem 'get Master Test1'; + return 0.2; +} + +sub testStep46 { # check data + LogStep "check log for output map with default"; + is(FhemTestUtils_gotEvent(qr/Master:Test1:\sinvalid/xms), 1, "get map default result"); + CheckAndReset(); + return; +} + + + 1; diff --git a/fhem/t/FHEM/98_Modbus/50_MasterSlave1.cfg b/fhem/t/FHEM/98_Modbus/50_MasterSlave1.cfg index f2dad9735..c10a9acd5 100644 --- a/fhem/t/FHEM/98_Modbus/50_MasterSlave1.cfg +++ b/fhem/t/FHEM/98_Modbus/50_MasterSlave1.cfg @@ -1,21 +1,21 @@ -attr global mseclog 1 - -define Slave ModbusAttr 5 slave global:5501 -attr Slave obj-h256-reading TempWasserEin -attr Slave obj-h258-reading TempWasserAus - -define Master ModbusAttr 5 0 localhost:5501 -attr Master disable 1 -attr Master verbose 3 -attr Master nonPrioritizedGet 1 -attr Master nonPrioritizedSet 1 - -attr Master dev-timing-sendDelay 0 -attr Master dev-timing-commDelay 0 -attr Master dev-h-defSet 1 -attr Master dev-h-defShowGet 1 -attr Master dev-h-combine 19 - -attr Master obj-h256-reading TempWasserEin -attr Master obj-h258-reading TempWasserAus - +attr global mseclog 1 + +define Slave ModbusAttr 5 slave global:5501 +attr Slave obj-h256-reading TempWasserEin +attr Slave obj-h258-reading TempWasserAus + +define Master ModbusAttr 5 0 localhost:5501 +attr Master disable 1 +attr Master verbose 3 +attr Master nonPrioritizedGet 1 +attr Master nonPrioritizedSet 1 + +attr Master dev-timing-sendDelay 0 +attr Master dev-timing-commDelay 0 +attr Master dev-h-defSet 1 +attr Master dev-h-defShowGet 1 +attr Master dev-h-combine 19 + +attr Master obj-h256-reading TempWasserEin +attr Master obj-h258-reading TempWasserAus + diff --git a/fhem/t/FHEM/98_Modbus/50_MasterSlave2.cfg b/fhem/t/FHEM/98_Modbus/50_MasterSlave2.cfg new file mode 100644 index 000000000..f5eaeecfe --- /dev/null +++ b/fhem/t/FHEM/98_Modbus/50_MasterSlave2.cfg @@ -0,0 +1,34 @@ +attr global mseclog 1 + +define Slave ModbusAttr 5 slave global:5501 +attr Slave obj-h256-reading TempWasserEin +attr Slave obj-h256-len 2 +attr Slave obj-h256-unpack f> + +attr Slave obj-h258-reading TempWasserAus +attr Slave obj-h258-len 2 +attr Slave obj-h258-unpack f< + +define Master ModbusAttr 5 0 localhost:5501 +attr Master disable 1 +attr Master verbose 3 +attr Master nonPrioritizedGet 1 +attr Master nonPrioritizedSet 1 + +attr Master dev-timing-sendDelay 0 +attr Master dev-timing-commDelay 0 +attr Master dev-h-defSet 1 +attr Master dev-h-defShowGet 1 +attr Master dev-h-combine 19 + +attr Master obj-h256-reading TempWasserEin +attr Master obj-h256-len 2 +attr Master obj-h256-unpack f> +attr Master obj-h256-poll 1 +attr Master obj-h256-polldelay 0 + +attr Master obj-h258-reading TempWasserAus +attr Master obj-h258-len 2 +attr Master obj-h258-unpack f< +attr Master obj-h258-poll 1 +attr Master obj-h258-polldelay 0 diff --git a/fhem/t/FHEM/98_Modbus/50_MasterSlave2.t b/fhem/t/FHEM/98_Modbus/50_MasterSlave2.t new file mode 100644 index 000000000..8a24265a3 --- /dev/null +++ b/fhem/t/FHEM/98_Modbus/50_MasterSlave2.t @@ -0,0 +1,75 @@ +############################################## +# test master slave with setexpr +############################################## + +package main; + +use strict; +use warnings; +use Test::More; +use Time::HiRes qw( gettimeofday tv_interval); # return time as float, not just full seconds +use FHEM::HTTPMOD::Utils qw(:all); +use FHEM::Modbus::TestUtils qw(:all); + +fhem 'attr global mseclog 1'; +NextStep(); + + +sub testStep1 { # preparation of slave content, enable devices + CheckAndReset(); + LogStep "enable Master and set value at Slave"; + fhem ('attr Master disable 0'); + fhem ('setreading Slave TempWasserEin 12.123'); + fhem ('setreading Slave TempWasserAus 32.999'); + + return 0.1; +} + +sub testStep2 { # get holding registers + LogStep "retrieve normal values"; + fhem ('attr Master verbose 5'); + fhem ('attr Slave verbose 5'); + fhem ('set Master reread'); + return 0.3; +} + +sub testStep3 { # check results + LogStep "check result for normal values"; + is(FhemTestUtils_gotEvent(qr/Master:TempWasserEin:\s12.123/xms), 1, "Retrieve float 1 from local slave"); + is(FhemTestUtils_gotEvent(qr/Master:TempWasserAus:\s32.999/xms), 1, "Retrieve float 2 from local slave"); + CheckAndReset(); + return; +} + +sub testStep10 { # get holding registers with revregs + LogStep "retrieve values with revRegs"; + fhem ('attr Master obj-h258-revRegs 1'); + fhem ('attr Slave obj-h258-revRegs 1'); + fhem ('set Master reread'); + return 0.3; +} + +sub testStep11 { # check results 2 + LogStep "check result with revRegs"; + is(FhemTestUtils_gotEvent(qr/Master:TempWasserEin:\s12.123/xms), 1, "Retrieve float 1 from local slave"); + is(FhemTestUtils_gotEvent(qr/Master:TempWasserAus:\s32.999/xms), 1, "Retrieve float 2 from local slave"); + CheckAndReset(); + return; +} + +sub testStep20 { # get holding registers with revregs + LogStep "retrieve values with wrong revRegs"; + fhem ('attr Master obj-h258-revRegs 0'); + fhem ('attr Slave obj-h258-revRegs 1'); + fhem ('set Master reread'); + return 0.3; +} + +sub testStep21 { # check results 2 + LogStep "check result with wrong revRegs"; + is(FhemTestUtils_gotEvent(qr/Master:TempWasserEin:\s12.123/xms), 1, "Retrieve float 1 from local slave"); + is(FhemTestUtils_gotEvent(qr/Master:TempWasserAus:\s32.999/xms), 0, "no valid retrieve float 2 from local slave"); + return; +} + +1; diff --git a/fhem/t/FHEM/98_Modbus/50_MasterSlaveDI.cfg b/fhem/t/FHEM/98_Modbus/50_MasterSlaveDI.cfg new file mode 100644 index 000000000..29983a152 --- /dev/null +++ b/fhem/t/FHEM/98_Modbus/50_MasterSlaveDI.cfg @@ -0,0 +1,24 @@ +attr global mseclog 1 + +define Slave ModbusAttr 5 slave global:5501 +attr Slave obj-d100-reading Lampe +attr Slave dev-d-addressErrCode 0 + +define Master ModbusAttr 5 0 localhost:5501 +attr Master disable 1 +attr Master verbose 3 +attr Master nonPrioritizedGet 1 +attr Master nonPrioritizedSet 1 + +attr Master dev-timing-sendDelay 0 +attr Master dev-timing-commDelay 0 +attr Master dev-d-defSet 1 +attr Master dev-d-defShowGet 1 + +attr Master obj-d100-reading Lampe +attr Master obj-d100-poll 1 +attr Master obj-d100-polldelay 0 +attr Master obj-d108-reading dummy +attr Master obj-d108-poll 1 +attr Master obj-d108-polldelay 0 +attr Master dev-d-combine 16 \ No newline at end of file diff --git a/fhem/t/FHEM/98_Modbus/50_MasterSlaveDI.t b/fhem/t/FHEM/98_Modbus/50_MasterSlaveDI.t new file mode 100644 index 000000000..2ff54011e --- /dev/null +++ b/fhem/t/FHEM/98_Modbus/50_MasterSlaveDI.t @@ -0,0 +1,55 @@ +############################################## +# test master slave with setexpr +############################################## + +package main; + +use strict; +use warnings; +use Test::More; +use Time::HiRes qw( gettimeofday tv_interval); # return time as float, not just full seconds +use FHEM::HTTPMOD::Utils qw(:all); +use FHEM::Modbus::TestUtils qw(:all); + +fhem 'attr global mseclog 1'; +NextStep(); + + +sub testStep1 { # preparation of slave content, enable devices + CheckAndReset(); + LogStep "enable Master and set value at Slave"; + fhem ('attr Master disable 0'); + fhem ('setreading Slave Lampe 1'); + return 0.1; +} + +sub testStep2 { # get digital input + LogStep "retrieve normal values"; + fhem 'attr Master verbose 5'; + fhem 'attr Slave verbose 5'; + fhem 'get Master Lampe'; + return 0.3; +} + +sub testStep3 { # check results + LogStep "check result for normal values"; + is(FhemTestUtils_gotEvent(qr/Master:Lampe:\s1/xms), 1, "Retrieve value 1 from local slave"); + CheckAndReset(); + return; +} + +sub testStep10 { # check doepke fix + LogStep "use doepke fix"; + fhem 'attr Master dev-d-brokenFC2 doepke'; + fhem 'set Master reread'; + return 0.2; +} + +sub testStep11 { # check results + LogStep "check result for combined inputs with doepke fix sumulation"; + is(FhemTestUtils_gotEvent(qr/Master:Lampe:\s0/xms), 1, "Retrieve value 0 from local slave"); + CheckAndReset(); + return; +} + +1; diff --git a/fhem/t/FHEM/98_Modbus/51_Combine.cfg b/fhem/t/FHEM/98_Modbus/51_Combine.cfg index 1c2fa65dc..509382043 100644 --- a/fhem/t/FHEM/98_Modbus/51_Combine.cfg +++ b/fhem/t/FHEM/98_Modbus/51_Combine.cfg @@ -1,136 +1,136 @@ -attr global mseclog 1 - -define Slave ModbusAttr 5 slave global:5501 -attr Slave dev-addressErrCode 0 -attr Slave obj-h256-reading TempWasserEin -attr Slave obj-h258-reading TempWasserAus - -attr Slave obj-h100-reading Test1 -attr Slave obj-h100-setexpr $val * 4 - -attr Slave obj-h101-reading Test2 -attr Slave obj-h101-unpack f> -attr Slave obj-h101-len 2 - -attr Slave obj-h103-reading Test3 -attr Slave obj-h103-unpack a8 -attr Slave obj-h103-len 4 - -attr Slave obj-h120-reading Test4 -attr Slave obj-h120-unpack f> -attr Slave obj-h120-len 2 - -attr Slave obj-h130-reading Test5 -attr Slave obj-h130-unpack f< -attr Slave obj-h130-len 2 - -attr Slave obj-h132-reading Test6 -attr Slave obj-h132-poll 1 -attr Slave obj-h132-unpack n -attr Slave obj-h132-polldelay 0 - -attr Slave obj-c400-reading c0 -attr Slave obj-c401-reading c1 -attr Slave obj-c402-reading c2 -attr Slave obj-c403-reading c3 -attr Slave obj-c404-reading c4 -attr Slave obj-c405-reading c5 -attr Slave obj-c406-reading c6 -attr Slave obj-c407-reading c7 -attr Slave obj-c408-reading c8 -attr Slave obj-c409-reading c9 -attr Slave obj-c410-reading c10 -attr Slave obj-c411-reading c11 -attr Slave obj-c412-reading c12 -attr Slave obj-c413-reading c13 -attr Slave obj-c414-reading c14 -attr Slave obj-c415-reading c15 -attr Slave obj-c416-reading c16 -attr Slave obj-c417-reading c17 -attr Slave obj-c418-reading c18 - -define Master ModbusAttr 5 0 localhost:5501 -attr Master disable 1 -attr Master verbose 3 -attr Master nonPrioritizedGet 1 -attr Master nonPrioritizedSet 1 - -attr Master dev-timing-sendDelay 0 -attr Master dev-timing-commDelay 0 -attr Master dev-timing-timeout 0.5 - -attr Master obj-h256-reading TempWasserEin -attr Master obj-h258-reading TempWasserAus - -attr Master obj-h100-reading Test1 -attr Master obj-h100-expr $val + 2 -attr Master obj-h100-poll 1 -attr Master obj-h100-polldelay 0 - -attr Master obj-h101-reading Test2 -attr Master obj-h101-unpack f> -attr Master obj-h101-len 2 -attr Master obj-h101-format %.2f -attr Master obj-h101-poll 1 -attr Master obj-h101-polldelay 0 - -attr Master obj-h103-reading Test3 -attr Master obj-h103-unpack a8 -attr Master obj-h103-len 4 -attr Master obj-h103-poll 1 -attr Master obj-h103-polldelay 0 - -attr Master obj-h120-reading Test4 -attr Master obj-h120-unpack f> -attr Master obj-h120-len 2 -attr Master obj-h120-format %.2f -attr Master obj-h120-poll 1 -attr Master obj-h120-ignoreExpr $val > 10 -attr Master obj-h120-polldelay 0 - -attr Master obj-h130-reading Test5 -attr Master obj-h130-unpack f< -attr Master obj-h130-len 2 - -attr Master obj-h132-reading Test6 -attr Master obj-h132-poll 1 -attr Master obj-h132-unpack n -attr Master obj-h132-polldelay 0 - -attr Master obj-h10-reading o1 -attr Master obj-h10-map 0:off, 1:on - -attr Master obj-h11-reading o2 -attr Master obj-h11-min 1 -attr Master obj-h11-max 3 -attr Master dev-h-defSet 1 -attr Master dev-c-defSet 1 -attr Master dev-h-defShowGet 1 - -attr Master obj-c400-reading c0 -attr Master obj-c401-reading c1 -attr Master obj-c402-reading c2 -attr Master obj-c403-reading c3 -attr Master obj-c404-reading c4 -attr Master obj-c405-reading c5 -attr Master obj-c406-reading c6 -attr Master obj-c407-reading c7 -attr Master obj-c408-reading c8 -attr Master obj-c409-reading c9 -attr Master obj-c410-reading c10 -attr Master obj-c411-reading c11 -attr Master obj-c412-reading c12 -attr Master obj-c413-reading c13 -attr Master obj-c414-reading c14 -attr Master obj-c415-reading c15 -attr Master obj-c416-reading c16 -attr Master obj-c417-reading c17 -attr Master obj-c418-reading c18 - -attr Master obj-c400-poll 1 -attr Master obj-c405-poll 1 -attr Master obj-c406-poll 1 -attr Master obj-c417-poll 1 - -attr Master dev-h-combine 19 -attr Master dev-c-combine 32 +attr global mseclog 1 + +define Slave ModbusAttr 5 slave global:5501 +attr Slave dev-addressErrCode 0 +attr Slave obj-h256-reading TempWasserEin +attr Slave obj-h258-reading TempWasserAus + +attr Slave obj-h100-reading Test1 +attr Slave obj-h100-setexpr $val * 4 + +attr Slave obj-h101-reading Test2 +attr Slave obj-h101-unpack f> +attr Slave obj-h101-len 2 + +attr Slave obj-h103-reading Test3 +attr Slave obj-h103-unpack a8 +attr Slave obj-h103-len 4 + +attr Slave obj-h120-reading Test4 +attr Slave obj-h120-unpack f> +attr Slave obj-h120-len 2 + +attr Slave obj-h130-reading Test5 +attr Slave obj-h130-unpack f< +attr Slave obj-h130-len 2 + +attr Slave obj-h132-reading Test6 +attr Slave obj-h132-poll 1 +attr Slave obj-h132-unpack n +attr Slave obj-h132-polldelay 0 + +attr Slave obj-c400-reading c0 +attr Slave obj-c401-reading c1 +attr Slave obj-c402-reading c2 +attr Slave obj-c403-reading c3 +attr Slave obj-c404-reading c4 +attr Slave obj-c405-reading c5 +attr Slave obj-c406-reading c6 +attr Slave obj-c407-reading c7 +attr Slave obj-c408-reading c8 +attr Slave obj-c409-reading c9 +attr Slave obj-c410-reading c10 +attr Slave obj-c411-reading c11 +attr Slave obj-c412-reading c12 +attr Slave obj-c413-reading c13 +attr Slave obj-c414-reading c14 +attr Slave obj-c415-reading c15 +attr Slave obj-c416-reading c16 +attr Slave obj-c417-reading c17 +attr Slave obj-c418-reading c18 + +define Master ModbusAttr 5 0 localhost:5501 +attr Master disable 1 +attr Master verbose 3 +attr Master nonPrioritizedGet 1 +attr Master nonPrioritizedSet 1 + +attr Master dev-timing-sendDelay 0 +attr Master dev-timing-commDelay 0 +attr Master dev-timing-timeout 0.5 + +attr Master obj-h256-reading TempWasserEin +attr Master obj-h258-reading TempWasserAus + +attr Master obj-h100-reading Test1 +attr Master obj-h100-expr $val + 2 +attr Master obj-h100-poll 1 +attr Master obj-h100-polldelay 0 + +attr Master obj-h101-reading Test2 +attr Master obj-h101-unpack f> +attr Master obj-h101-len 2 +attr Master obj-h101-format %.2f +attr Master obj-h101-poll 1 +attr Master obj-h101-polldelay 0 + +attr Master obj-h103-reading Test3 +attr Master obj-h103-unpack a8 +attr Master obj-h103-len 4 +attr Master obj-h103-poll 1 +attr Master obj-h103-polldelay 0 + +attr Master obj-h120-reading Test4 +attr Master obj-h120-unpack f> +attr Master obj-h120-len 2 +attr Master obj-h120-format %.2f +attr Master obj-h120-poll 1 +attr Master obj-h120-ignoreExpr $val > 10 +attr Master obj-h120-polldelay 0 + +attr Master obj-h130-reading Test5 +attr Master obj-h130-unpack f< +attr Master obj-h130-len 2 + +attr Master obj-h132-reading Test6 +attr Master obj-h132-poll 1 +attr Master obj-h132-unpack n +attr Master obj-h132-polldelay 0 + +attr Master obj-h10-reading o1 +attr Master obj-h10-map 0:off, 1:on + +attr Master obj-h11-reading o2 +attr Master obj-h11-min 1 +attr Master obj-h11-max 3 +attr Master dev-h-defSet 1 +attr Master dev-c-defSet 1 +attr Master dev-h-defShowGet 1 + +attr Master obj-c400-reading c0 +attr Master obj-c401-reading c1 +attr Master obj-c402-reading c2 +attr Master obj-c403-reading c3 +attr Master obj-c404-reading c4 +attr Master obj-c405-reading c5 +attr Master obj-c406-reading c6 +attr Master obj-c407-reading c7 +attr Master obj-c408-reading c8 +attr Master obj-c409-reading c9 +attr Master obj-c410-reading c10 +attr Master obj-c411-reading c11 +attr Master obj-c412-reading c12 +attr Master obj-c413-reading c13 +attr Master obj-c414-reading c14 +attr Master obj-c415-reading c15 +attr Master obj-c416-reading c16 +attr Master obj-c417-reading c17 +attr Master obj-c418-reading c18 + +attr Master obj-c400-poll 1 +attr Master obj-c405-poll 1 +attr Master obj-c406-poll 1 +attr Master obj-c417-poll 1 + +attr Master dev-h-combine 19 +attr Master dev-c-combine 32 diff --git a/fhem/t/FHEM/98_Modbus/52_Combine2.cfg b/fhem/t/FHEM/98_Modbus/52_Combine2.cfg index b2ffe56b1..19ffd0dd2 100644 --- a/fhem/t/FHEM/98_Modbus/52_Combine2.cfg +++ b/fhem/t/FHEM/98_Modbus/52_Combine2.cfg @@ -1,106 +1,106 @@ -attr global mseclog 1 - -define Slave ModbusAttr 5 slave global:5501 -attr Slave dev-addressErrCode 0 -attr Slave obj-h256-reading TempWasserEin -attr Slave obj-h258-reading TempWasserAus - -attr Slave obj-h100-reading Test1 - -attr Slave obj-h101-reading Test2 -attr Slave obj-h101-unpack f> -attr Slave obj-h101-len 2 - -attr Slave obj-h103-reading Test2m - -attr Slave obj-h120-reading Test4a -attr Slave obj-h120-unpack f> -attr Slave obj-h120-len 2 - -attr Slave obj-h122-reading Test4b -attr Slave obj-h122-unpack f> -attr Slave obj-h122-len 2 - - -attr Slave obj-h130-reading Test5 -attr Slave obj-h130-unpack f< -attr Slave obj-h130-len 2 - -attr Slave obj-h132-reading Test5m -attr Slave obj-h132-unpack n - - -define Master ModbusAttr 5 0 localhost:5501 -attr Master disable 1 -attr Master verbose 3 -attr Master nonPrioritizedGet 1 -attr Master nonPrioritizedSet 1 - -attr Master dev-timing-sendDelay 0 -attr Master dev-timing-commDelay 0 -attr Master dev-timing-timeout 0.5 - -attr Master obj-h256-reading TempWasserEin -attr Master obj-h256-poll 1 -attr Master obj-h258-reading TempWasserAus -attr Master obj-h258-poll 1 - -attr Master obj-h100-reading Test1 -attr Master obj-h100-expr $val + 2 -attr Master obj-h100-poll 1 -attr Master obj-h100-polldelay 0 - -attr Master obj-h101-reading Test2 -attr Master obj-h101-unpack f> -attr Master obj-h101-len 2 -attr Master obj-h101-format %.2f -attr Master obj-h101-poll 1 -attr Master obj-h101-polldelay 0 -attr Master obj-h101-group 2-2 -attr Master obj-h101-expr ReadingsVal($name, 'Test2m', 0) * $val - -attr Master obj-h103-reading Test2m -attr Master obj-h103-poll 1 -attr Master obj-h103-polldelay 0 -attr Master obj-h103-group 2-1 - -attr Master obj-h120-reading Test4a -attr Master obj-h120-unpack f> -attr Master obj-h120-len 2 -attr Master obj-h120-format %.2f -attr Master obj-h120-poll 1 -attr Master obj-h120-polldelay 0 -attr Master obj-h120-group 3-1 - -attr Master obj-h122-reading Test4b -attr Master obj-h122-unpack f> -attr Master obj-h122-len 2 -attr Master obj-h122-format %.2f -attr Master obj-h122-poll 1 -attr Master obj-h122-polldelay 0 -attr Master obj-h122-group 3-2 -attr Master obj-h122-expr ReadingsVal($name, 'Test4a', 0) + $val - -attr Master obj-h130-reading Test5 -attr Master obj-h130-unpack f< -attr Master obj-h130-len 2 -attr Master obj-h130-group 1-1 -attr Master obj-h130-poll 1 -attr Master obj-h130-expr ReadingsVal($name, 'Test5m', 0) * $val - -attr Master obj-h132-reading Test5m -attr Master obj-h132-unpack n -attr Master obj-h132-polldelay 0 -attr Master obj-h132-group 1-2 - -attr Master obj-h10-reading o1 -attr Master obj-h10-map 0:off, 1:on - -attr Master obj-h11-reading o2 -attr Master obj-h11-min 1 -attr Master obj-h11-max 3 -attr Master dev-h-defSet 1 -attr Master dev-c-defSet 1 -attr Master dev-h-defShowGet 1 - -attr Master dev-h-combine 22 +attr global mseclog 1 + +define Slave ModbusAttr 5 slave global:5501 +attr Slave dev-addressErrCode 0 +attr Slave obj-h256-reading TempWasserEin +attr Slave obj-h258-reading TempWasserAus + +attr Slave obj-h100-reading Test1 + +attr Slave obj-h101-reading Test2 +attr Slave obj-h101-unpack f> +attr Slave obj-h101-len 2 + +attr Slave obj-h103-reading Test2m + +attr Slave obj-h120-reading Test4a +attr Slave obj-h120-unpack f> +attr Slave obj-h120-len 2 + +attr Slave obj-h122-reading Test4b +attr Slave obj-h122-unpack f> +attr Slave obj-h122-len 2 + + +attr Slave obj-h130-reading Test5 +attr Slave obj-h130-unpack f< +attr Slave obj-h130-len 2 + +attr Slave obj-h132-reading Test5m +attr Slave obj-h132-unpack n + + +define Master ModbusAttr 5 0 localhost:5501 +attr Master disable 1 +attr Master verbose 3 +attr Master nonPrioritizedGet 1 +attr Master nonPrioritizedSet 1 + +attr Master dev-timing-sendDelay 0 +attr Master dev-timing-commDelay 0 +attr Master dev-timing-timeout 0.5 + +attr Master obj-h256-reading TempWasserEin +attr Master obj-h256-poll 1 +attr Master obj-h258-reading TempWasserAus +attr Master obj-h258-poll 1 + +attr Master obj-h100-reading Test1 +attr Master obj-h100-expr $val + 2 +attr Master obj-h100-poll 1 +attr Master obj-h100-polldelay 0 + +attr Master obj-h101-reading Test2 +attr Master obj-h101-unpack f> +attr Master obj-h101-len 2 +attr Master obj-h101-format %.2f +attr Master obj-h101-poll 1 +attr Master obj-h101-polldelay 0 +attr Master obj-h101-group 2-2 +attr Master obj-h101-expr ReadingsVal($name, 'Test2m', 0) * $val + +attr Master obj-h103-reading Test2m +attr Master obj-h103-poll 1 +attr Master obj-h103-polldelay 0 +attr Master obj-h103-group 2-1 + +attr Master obj-h120-reading Test4a +attr Master obj-h120-unpack f> +attr Master obj-h120-len 2 +attr Master obj-h120-format %.2f +attr Master obj-h120-poll 1 +attr Master obj-h120-polldelay 0 +attr Master obj-h120-group 3-1 + +attr Master obj-h122-reading Test4b +attr Master obj-h122-unpack f> +attr Master obj-h122-len 2 +attr Master obj-h122-format %.2f +attr Master obj-h122-poll 1 +attr Master obj-h122-polldelay 0 +attr Master obj-h122-group 3-2 +attr Master obj-h122-expr ReadingsVal($name, 'Test4a', 0) + $val + +attr Master obj-h130-reading Test5 +attr Master obj-h130-unpack f< +attr Master obj-h130-len 2 +attr Master obj-h130-group 1-1 +attr Master obj-h130-poll 1 +attr Master obj-h130-expr ReadingsVal($name, 'Test5m', 0) * $val + +attr Master obj-h132-reading Test5m +attr Master obj-h132-unpack n +attr Master obj-h132-polldelay 0 +attr Master obj-h132-group 1-2 + +attr Master obj-h10-reading o1 +attr Master obj-h10-map 0:off, 1:on + +attr Master obj-h11-reading o2 +attr Master obj-h11-min 1 +attr Master obj-h11-max 3 +attr Master dev-h-defSet 1 +attr Master dev-c-defSet 1 +attr Master dev-h-defShowGet 1 + +attr Master dev-h-combine 22 diff --git a/fhem/t/FHEM/98_Modbus/53_Relay.cfg b/fhem/t/FHEM/98_Modbus/53_Relay.cfg index 137c3329f..6a6da5ba7 100644 --- a/fhem/t/FHEM/98_Modbus/53_Relay.cfg +++ b/fhem/t/FHEM/98_Modbus/53_Relay.cfg @@ -1,135 +1,135 @@ -attr global mseclog 1 - -define D1 dummy - -define Slave ModbusAttr 50 slave global:5501 -attr Slave obj-h256-reading TempWasserEin -attr Slave obj-h258-reading D1:TempWasserAus - -attr Slave obj-h100-reading Test1 -attr Slave obj-h100-setexpr $val * 4 - -attr Slave obj-h101-reading Test2 -attr Slave obj-h101-unpack f> -attr Slave obj-h101-len 2 - -attr Slave obj-h103-reading Test3 -attr Slave obj-h103-unpack a8 -attr Slave obj-h103-len 4 - -attr Slave obj-h120-reading Test4 -attr Slave obj-h120-unpack f> -attr Slave obj-h120-len 2 - -attr Slave obj-h130-reading Test5 -attr Slave obj-h130-unpack a* -attr Slave obj-h130-len 2 - -attr Slave obj-c400-reading c0 -attr Slave obj-c401-reading c1 -attr Slave obj-c402-reading c2 -attr Slave obj-c403-reading c3 -attr Slave obj-c404-reading c4 -attr Slave obj-c405-reading c5 -attr Slave obj-c406-reading c6 -attr Slave obj-c407-reading c7 -attr Slave obj-c408-reading c8 -attr Slave obj-c409-reading c9 -attr Slave obj-c410-reading c10 -attr Slave obj-c411-reading c11 -attr Slave obj-c412-reading c12 -attr Slave obj-c413-reading c13 -attr Slave obj-c414-reading c14 -attr Slave obj-c415-reading c15 -attr Slave obj-c416-reading c16 -attr Slave obj-c417-reading c17 -attr Slave obj-c418-reading c18 - -define RM ModbusAttr 50 0 localhost:5501 -attr RM dev-timing-sendDelay 0 -attr RM dev-timing-commDelay 0 -attr RM disable 1 - -define Relay ModbusAttr 5 relay localhost:5510 to RM -attr Relay disable 1 - -define Master ModbusAttr 5 0 localhost:5510 -attr Master disable 1 -attr Master verbose 3 -attr Master nonPrioritizedGet 1 -attr Master nonPrioritizedSet 1 - -attr Master dev-timing-sendDelay 0 -attr Master dev-timing-commDelay 0 - -attr Master obj-h256-reading TempWasserEin -attr Master obj-h258-reading TempWasserAus - -attr Master obj-h100-reading Test1 -attr Master obj-h100-expr $val + 2 -attr Master obj-h100-poll 1 -attr Master obj-h100-polldelay 0 - -attr Master obj-h101-reading Test2 -attr Master obj-h101-unpack f> -attr Master obj-h101-len 2 -attr Master obj-h101-format %.2f -attr Master obj-h101-poll 1 -attr Master obj-h101-polldelay 0 - -attr Master obj-h103-reading Test3 -attr Master obj-h103-unpack a8 -attr Master obj-h103-len 4 -attr Master obj-h103-poll 1 -attr Master obj-h103-polldelay 0 - -attr Master obj-h120-reading Test4 -attr Master obj-h120-unpack f> -attr Master obj-h120-len 2 -attr Master obj-h120-format %.2f -attr Master obj-h120-poll 1 -attr Master obj-h120-ignoreExpr $val > 10 -attr Master obj-h120-polldelay 0 - -attr Master obj-h130-reading Test5 -attr Master obj-h130-unpack a* -attr Master obj-h130-len 2 -attr Master obj-h130-encode utf8 - -attr Master obj-h10-reading o1 -attr Master obj-h10-map 0:off, 1:on - -attr Master obj-h11-reading o2 -attr Master obj-h11-min 1 -attr Master obj-h11-max 3 -attr Master dev-h-defSet 1 -attr Master dev-c-defSet 1 -attr Master dev-h-defShowGet 1 - -attr Master obj-c400-reading c0 -attr Master obj-c401-reading c1 -attr Master obj-c402-reading c2 -attr Master obj-c403-reading c3 -attr Master obj-c404-reading c4 -attr Master obj-c405-reading c5 -attr Master obj-c406-reading c6 -attr Master obj-c407-reading c7 -attr Master obj-c408-reading c8 -attr Master obj-c409-reading c9 -attr Master obj-c410-reading c10 -attr Master obj-c411-reading c11 -attr Master obj-c412-reading c12 -attr Master obj-c413-reading c13 -attr Master obj-c414-reading c14 -attr Master obj-c415-reading c15 -attr Master obj-c416-reading c16 -attr Master obj-c417-reading c17 -attr Master obj-c418-reading c18 - -attr Master obj-c400-poll 1 -attr Master obj-c405-poll 1 -attr Master obj-c406-poll 1 -attr Master obj-c417-poll 1 - -attr Master dev-h-combine 19 +attr global mseclog 1 + +define D1 dummy + +define Slave ModbusAttr 50 slave global:5501 +attr Slave obj-h256-reading TempWasserEin +attr Slave obj-h258-reading D1:TempWasserAus + +attr Slave obj-h100-reading Test1 +attr Slave obj-h100-setexpr $val * 4 + +attr Slave obj-h101-reading Test2 +attr Slave obj-h101-unpack f> +attr Slave obj-h101-len 2 + +attr Slave obj-h103-reading Test3 +attr Slave obj-h103-unpack a8 +attr Slave obj-h103-len 4 + +attr Slave obj-h120-reading Test4 +attr Slave obj-h120-unpack f> +attr Slave obj-h120-len 2 + +attr Slave obj-h130-reading Test5 +attr Slave obj-h130-unpack a* +attr Slave obj-h130-len 2 + +attr Slave obj-c400-reading c0 +attr Slave obj-c401-reading c1 +attr Slave obj-c402-reading c2 +attr Slave obj-c403-reading c3 +attr Slave obj-c404-reading c4 +attr Slave obj-c405-reading c5 +attr Slave obj-c406-reading c6 +attr Slave obj-c407-reading c7 +attr Slave obj-c408-reading c8 +attr Slave obj-c409-reading c9 +attr Slave obj-c410-reading c10 +attr Slave obj-c411-reading c11 +attr Slave obj-c412-reading c12 +attr Slave obj-c413-reading c13 +attr Slave obj-c414-reading c14 +attr Slave obj-c415-reading c15 +attr Slave obj-c416-reading c16 +attr Slave obj-c417-reading c17 +attr Slave obj-c418-reading c18 + +define RM ModbusAttr 50 0 localhost:5501 +attr RM dev-timing-sendDelay 0 +attr RM dev-timing-commDelay 0 +attr RM disable 1 + +define Relay ModbusAttr 5 relay localhost:5510 to RM +attr Relay disable 1 + +define Master ModbusAttr 5 0 localhost:5510 +attr Master disable 1 +attr Master verbose 3 +attr Master nonPrioritizedGet 1 +attr Master nonPrioritizedSet 1 + +attr Master dev-timing-sendDelay 0 +attr Master dev-timing-commDelay 0 + +attr Master obj-h256-reading TempWasserEin +attr Master obj-h258-reading TempWasserAus + +attr Master obj-h100-reading Test1 +attr Master obj-h100-expr $val + 2 +attr Master obj-h100-poll 1 +attr Master obj-h100-polldelay 0 + +attr Master obj-h101-reading Test2 +attr Master obj-h101-unpack f> +attr Master obj-h101-len 2 +attr Master obj-h101-format %.2f +attr Master obj-h101-poll 1 +attr Master obj-h101-polldelay 0 + +attr Master obj-h103-reading Test3 +attr Master obj-h103-unpack a8 +attr Master obj-h103-len 4 +attr Master obj-h103-poll 1 +attr Master obj-h103-polldelay 0 + +attr Master obj-h120-reading Test4 +attr Master obj-h120-unpack f> +attr Master obj-h120-len 2 +attr Master obj-h120-format %.2f +attr Master obj-h120-poll 1 +attr Master obj-h120-ignoreExpr $val > 10 +attr Master obj-h120-polldelay 0 + +attr Master obj-h130-reading Test5 +attr Master obj-h130-unpack a* +attr Master obj-h130-len 2 +attr Master obj-h130-encode utf8 + +attr Master obj-h10-reading o1 +attr Master obj-h10-map 0:off, 1:on + +attr Master obj-h11-reading o2 +attr Master obj-h11-min 1 +attr Master obj-h11-max 3 +attr Master dev-h-defSet 1 +attr Master dev-c-defSet 1 +attr Master dev-h-defShowGet 1 + +attr Master obj-c400-reading c0 +attr Master obj-c401-reading c1 +attr Master obj-c402-reading c2 +attr Master obj-c403-reading c3 +attr Master obj-c404-reading c4 +attr Master obj-c405-reading c5 +attr Master obj-c406-reading c6 +attr Master obj-c407-reading c7 +attr Master obj-c408-reading c8 +attr Master obj-c409-reading c9 +attr Master obj-c410-reading c10 +attr Master obj-c411-reading c11 +attr Master obj-c412-reading c12 +attr Master obj-c413-reading c13 +attr Master obj-c414-reading c14 +attr Master obj-c415-reading c15 +attr Master obj-c416-reading c16 +attr Master obj-c417-reading c17 +attr Master obj-c418-reading c18 + +attr Master obj-c400-poll 1 +attr Master obj-c405-poll 1 +attr Master obj-c406-poll 1 +attr Master obj-c417-poll 1 + +attr Master dev-h-combine 19 attr Master dev-c-combine 32 \ No newline at end of file diff --git a/fhem/t/FHEM/98_Modbus/54_RelayProto.cfg b/fhem/t/FHEM/98_Modbus/54_RelayProto.cfg index b0e3b93d6..9e2a5ba9b 100644 --- a/fhem/t/FHEM/98_Modbus/54_RelayProto.cfg +++ b/fhem/t/FHEM/98_Modbus/54_RelayProto.cfg @@ -1,138 +1,138 @@ -attr global mseclog 1 - -define D1 dummy -define Slave ModbusAttr 50 slave global:5501 ASCII -define RM ModbusAttr 50 0 localhost:5501 ASCII -define Relay ModbusAttr 5 relay localhost:5510 RTU to RM -define Master ModbusAttr 5 0 localhost:5510 RTU - -attr Slave obj-h256-reading TempWasserEin -attr Slave obj-h258-reading D1:TempWasserAus - -attr Slave obj-h100-reading Test1 -attr Slave obj-h100-setexpr $val * 4 - -attr Slave obj-h101-reading Test2 -attr Slave obj-h101-unpack f> -attr Slave obj-h101-len 2 - -attr Slave obj-h103-reading Test3 -attr Slave obj-h103-unpack a8 -attr Slave obj-h103-len 4 - -attr Slave obj-h120-reading Test4 -attr Slave obj-h120-unpack f> -attr Slave obj-h120-len 2 - -attr Slave obj-h130-reading Test5 -attr Slave obj-h130-unpack a* -attr Slave obj-h130-len 2 - -attr Slave obj-c400-reading c0 -attr Slave obj-c401-reading c1 -attr Slave obj-c402-reading c2 -attr Slave obj-c403-reading c3 -attr Slave obj-c404-reading c4 -attr Slave obj-c405-reading c5 -attr Slave obj-c406-reading c6 -attr Slave obj-c407-reading c7 -attr Slave obj-c408-reading c8 -attr Slave obj-c409-reading c9 -attr Slave obj-c410-reading c10 -attr Slave obj-c411-reading c11 -attr Slave obj-c412-reading c12 -attr Slave obj-c413-reading c13 -attr Slave obj-c414-reading c14 -attr Slave obj-c415-reading c15 -attr Slave obj-c416-reading c16 -attr Slave obj-c417-reading c17 -attr Slave obj-c418-reading c18 - -define RM ModbusAttr 50 0 localhost:5501 ASCII -attr RM dev-timing-sendDelay 0 -attr RM dev-timing-commDelay 0 -attr RM disable 1 - -define Relay ModbusAttr 5 relay localhost:5510 RTU to RM -attr Relay disable 1 - -define Master ModbusAttr 5 0 localhost:5510 RTU -attr Master disable 1 -attr Master verbose 3 -attr Master nonPrioritizedGet 1 -attr Master nonPrioritizedSet 1 - -attr Master dev-timing-sendDelay 0 -attr Master dev-timing-commDelay 0 - -attr Master obj-h256-reading TempWasserEin -attr Master obj-h258-reading TempWasserAus - -attr Master obj-h100-reading Test1 -attr Master obj-h100-expr $val + 2 -attr Master obj-h100-poll 1 -attr Master obj-h100-polldelay 0 - -attr Master obj-h101-reading Test2 -attr Master obj-h101-unpack f> -attr Master obj-h101-len 2 -attr Master obj-h101-format %.2f -attr Master obj-h101-poll 1 -attr Master obj-h101-polldelay 0 - -attr Master obj-h103-reading Test3 -attr Master obj-h103-unpack a8 -attr Master obj-h103-len 4 -attr Master obj-h103-poll 1 -attr Master obj-h103-polldelay 0 - -attr Master obj-h120-reading Test4 -attr Master obj-h120-unpack f> -attr Master obj-h120-len 2 -attr Master obj-h120-format %.2f -attr Master obj-h120-poll 1 -attr Master obj-h120-ignoreExpr $val > 10 -attr Master obj-h120-polldelay 0 - -attr Master obj-h130-reading Test5 -attr Master obj-h130-unpack a* -attr Master obj-h130-len 2 -attr Master obj-h130-encode utf8 - -attr Master obj-h10-reading o1 -attr Master obj-h10-map 0:off, 1:on - -attr Master obj-h11-reading o2 -attr Master obj-h11-min 1 -attr Master obj-h11-max 3 -attr Master dev-h-defSet 1 -attr Master dev-c-defSet 1 -attr Master dev-h-defShowGet 1 - -attr Master obj-c400-reading c0 -attr Master obj-c401-reading c1 -attr Master obj-c402-reading c2 -attr Master obj-c403-reading c3 -attr Master obj-c404-reading c4 -attr Master obj-c405-reading c5 -attr Master obj-c406-reading c6 -attr Master obj-c407-reading c7 -attr Master obj-c408-reading c8 -attr Master obj-c409-reading c9 -attr Master obj-c410-reading c10 -attr Master obj-c411-reading c11 -attr Master obj-c412-reading c12 -attr Master obj-c413-reading c13 -attr Master obj-c414-reading c14 -attr Master obj-c415-reading c15 -attr Master obj-c416-reading c16 -attr Master obj-c417-reading c17 -attr Master obj-c418-reading c18 - -attr Master obj-c400-poll 1 -attr Master obj-c405-poll 1 -attr Master obj-c406-poll 1 -attr Master obj-c417-poll 1 - -attr Master dev-h-combine 19 +attr global mseclog 1 + +define D1 dummy +define Slave ModbusAttr 50 slave global:5501 ASCII +define RM ModbusAttr 50 0 localhost:5501 ASCII +define Relay ModbusAttr 5 relay localhost:5510 RTU to RM +define Master ModbusAttr 5 0 localhost:5510 RTU + +attr Slave obj-h256-reading TempWasserEin +attr Slave obj-h258-reading D1:TempWasserAus + +attr Slave obj-h100-reading Test1 +attr Slave obj-h100-setexpr $val * 4 + +attr Slave obj-h101-reading Test2 +attr Slave obj-h101-unpack f> +attr Slave obj-h101-len 2 + +attr Slave obj-h103-reading Test3 +attr Slave obj-h103-unpack a8 +attr Slave obj-h103-len 4 + +attr Slave obj-h120-reading Test4 +attr Slave obj-h120-unpack f> +attr Slave obj-h120-len 2 + +attr Slave obj-h130-reading Test5 +attr Slave obj-h130-unpack a* +attr Slave obj-h130-len 2 + +attr Slave obj-c400-reading c0 +attr Slave obj-c401-reading c1 +attr Slave obj-c402-reading c2 +attr Slave obj-c403-reading c3 +attr Slave obj-c404-reading c4 +attr Slave obj-c405-reading c5 +attr Slave obj-c406-reading c6 +attr Slave obj-c407-reading c7 +attr Slave obj-c408-reading c8 +attr Slave obj-c409-reading c9 +attr Slave obj-c410-reading c10 +attr Slave obj-c411-reading c11 +attr Slave obj-c412-reading c12 +attr Slave obj-c413-reading c13 +attr Slave obj-c414-reading c14 +attr Slave obj-c415-reading c15 +attr Slave obj-c416-reading c16 +attr Slave obj-c417-reading c17 +attr Slave obj-c418-reading c18 + +define RM ModbusAttr 50 0 localhost:5501 ASCII +attr RM dev-timing-sendDelay 0 +attr RM dev-timing-commDelay 0 +attr RM disable 1 + +define Relay ModbusAttr 5 relay localhost:5510 RTU to RM +attr Relay disable 1 + +define Master ModbusAttr 5 0 localhost:5510 RTU +attr Master disable 1 +attr Master verbose 3 +attr Master nonPrioritizedGet 1 +attr Master nonPrioritizedSet 1 + +attr Master dev-timing-sendDelay 0 +attr Master dev-timing-commDelay 0 + +attr Master obj-h256-reading TempWasserEin +attr Master obj-h258-reading TempWasserAus + +attr Master obj-h100-reading Test1 +attr Master obj-h100-expr $val + 2 +attr Master obj-h100-poll 1 +attr Master obj-h100-polldelay 0 + +attr Master obj-h101-reading Test2 +attr Master obj-h101-unpack f> +attr Master obj-h101-len 2 +attr Master obj-h101-format %.2f +attr Master obj-h101-poll 1 +attr Master obj-h101-polldelay 0 + +attr Master obj-h103-reading Test3 +attr Master obj-h103-unpack a8 +attr Master obj-h103-len 4 +attr Master obj-h103-poll 1 +attr Master obj-h103-polldelay 0 + +attr Master obj-h120-reading Test4 +attr Master obj-h120-unpack f> +attr Master obj-h120-len 2 +attr Master obj-h120-format %.2f +attr Master obj-h120-poll 1 +attr Master obj-h120-ignoreExpr $val > 10 +attr Master obj-h120-polldelay 0 + +attr Master obj-h130-reading Test5 +attr Master obj-h130-unpack a* +attr Master obj-h130-len 2 +attr Master obj-h130-encode utf8 + +attr Master obj-h10-reading o1 +attr Master obj-h10-map 0:off, 1:on + +attr Master obj-h11-reading o2 +attr Master obj-h11-min 1 +attr Master obj-h11-max 3 +attr Master dev-h-defSet 1 +attr Master dev-c-defSet 1 +attr Master dev-h-defShowGet 1 + +attr Master obj-c400-reading c0 +attr Master obj-c401-reading c1 +attr Master obj-c402-reading c2 +attr Master obj-c403-reading c3 +attr Master obj-c404-reading c4 +attr Master obj-c405-reading c5 +attr Master obj-c406-reading c6 +attr Master obj-c407-reading c7 +attr Master obj-c408-reading c8 +attr Master obj-c409-reading c9 +attr Master obj-c410-reading c10 +attr Master obj-c411-reading c11 +attr Master obj-c412-reading c12 +attr Master obj-c413-reading c13 +attr Master obj-c414-reading c14 +attr Master obj-c415-reading c15 +attr Master obj-c416-reading c16 +attr Master obj-c417-reading c17 +attr Master obj-c418-reading c18 + +attr Master obj-c400-poll 1 +attr Master obj-c405-poll 1 +attr Master obj-c406-poll 1 +attr Master obj-c417-poll 1 + +attr Master dev-h-combine 19 attr Master dev-c-combine 32 \ No newline at end of file diff --git a/fhem/t/FHEM/98_Modbus/56_Scan.cfg b/fhem/t/FHEM/98_Modbus/56_Scan.cfg index 3d1201ac3..cbe7cd2b5 100644 --- a/fhem/t/FHEM/98_Modbus/56_Scan.cfg +++ b/fhem/t/FHEM/98_Modbus/56_Scan.cfg @@ -1,53 +1,53 @@ -attr global mseclog 1 - -define Slave ModbusAttr 5 slave global:5501 -attr Slave obj-h256-reading TempWasserEin -attr Slave obj-h258-reading D1:TempWasserAus - -attr Slave obj-h100-reading Test1 -attr Slave obj-h100-setexpr $val * 4 - -attr Slave obj-h101-reading Test2 -attr Slave obj-h101-unpack f> -attr Slave obj-h101-len 2 - -attr Slave obj-h103-reading Test3 -attr Slave obj-h103-unpack a8 -attr Slave obj-h103-len 4 - -attr Slave obj-h120-reading Test4 -attr Slave obj-h120-unpack f> -attr Slave obj-h120-len 2 - -attr Slave obj-h130-reading Test5 -attr Slave obj-h130-unpack a* -attr Slave obj-h130-len 2 - -attr Slave obj-c400-reading c0 -attr Slave obj-c401-reading c1 -attr Slave obj-c402-reading c2 -attr Slave obj-c403-reading c3 -attr Slave obj-c404-reading c4 -attr Slave obj-c405-reading c5 -attr Slave obj-c406-reading c6 -attr Slave obj-c407-reading c7 -attr Slave obj-c408-reading c8 -attr Slave obj-c409-reading c9 -attr Slave obj-c410-reading c10 -attr Slave obj-c411-reading c11 -attr Slave obj-c412-reading c12 -attr Slave obj-c413-reading c13 -attr Slave obj-c414-reading c14 -attr Slave obj-c415-reading c15 -attr Slave obj-c416-reading c16 -attr Slave obj-c417-reading c17 -attr Slave obj-c418-reading c18 - -define Master ModbusAttr 5 0 localhost:5501 -attr Master disable 1 -attr Master verbose 3 -attr Master nonPrioritizedGet 1 -attr Master nonPrioritizedSet 1 - -attr Master dev-timing-sendDelay 0 -attr Master dev-timing-commDelay 0 +attr global mseclog 1 + +define Slave ModbusAttr 5 slave global:5501 +attr Slave obj-h256-reading TempWasserEin +attr Slave obj-h258-reading D1:TempWasserAus + +attr Slave obj-h100-reading Test1 +attr Slave obj-h100-setexpr $val * 4 + +attr Slave obj-h101-reading Test2 +attr Slave obj-h101-unpack f> +attr Slave obj-h101-len 2 + +attr Slave obj-h103-reading Test3 +attr Slave obj-h103-unpack a8 +attr Slave obj-h103-len 4 + +attr Slave obj-h120-reading Test4 +attr Slave obj-h120-unpack f> +attr Slave obj-h120-len 2 + +attr Slave obj-h130-reading Test5 +attr Slave obj-h130-unpack a* +attr Slave obj-h130-len 2 + +attr Slave obj-c400-reading c0 +attr Slave obj-c401-reading c1 +attr Slave obj-c402-reading c2 +attr Slave obj-c403-reading c3 +attr Slave obj-c404-reading c4 +attr Slave obj-c405-reading c5 +attr Slave obj-c406-reading c6 +attr Slave obj-c407-reading c7 +attr Slave obj-c408-reading c8 +attr Slave obj-c409-reading c9 +attr Slave obj-c410-reading c10 +attr Slave obj-c411-reading c11 +attr Slave obj-c412-reading c12 +attr Slave obj-c413-reading c13 +attr Slave obj-c414-reading c14 +attr Slave obj-c415-reading c15 +attr Slave obj-c416-reading c16 +attr Slave obj-c417-reading c17 +attr Slave obj-c418-reading c18 + +define Master ModbusAttr 5 0 localhost:5501 +attr Master disable 1 +attr Master verbose 3 +attr Master nonPrioritizedGet 1 +attr Master nonPrioritizedSet 1 + +attr Master dev-timing-sendDelay 0 +attr Master dev-timing-commDelay 0 diff --git a/fhem/t/FHEM/98_Modbus/58_Profiler.cfg b/fhem/t/FHEM/98_Modbus/58_Profiler.cfg index 25529ba35..eef0a77fd 100644 --- a/fhem/t/FHEM/98_Modbus/58_Profiler.cfg +++ b/fhem/t/FHEM/98_Modbus/58_Profiler.cfg @@ -1,128 +1,128 @@ -attr global mseclog 1 - -define D1 dummy - -define Slave ModbusAttr 5 slave global:5501 -attr Slave obj-h256-reading TempWasserEin -attr Slave obj-h258-reading D1:TempWasserAus - -attr Slave obj-h100-reading Test1 -attr Slave obj-h100-setexpr $val * 4 - -attr Slave obj-h101-reading Test2 -attr Slave obj-h101-unpack f> -attr Slave obj-h101-len 2 - -attr Slave obj-h103-reading Test3 -attr Slave obj-h103-unpack a8 -attr Slave obj-h103-len 4 - -attr Slave obj-h120-reading Test4 -attr Slave obj-h120-unpack f> -attr Slave obj-h120-len 2 - -attr Slave obj-h130-reading Test5 -attr Slave obj-h130-unpack a* -attr Slave obj-h130-len 2 - -attr Slave obj-c400-reading c0 -attr Slave obj-c401-reading c1 -attr Slave obj-c402-reading c2 -attr Slave obj-c403-reading c3 -attr Slave obj-c404-reading c4 -attr Slave obj-c405-reading c5 -attr Slave obj-c406-reading c6 -attr Slave obj-c407-reading c7 -attr Slave obj-c408-reading c8 -attr Slave obj-c409-reading c9 -attr Slave obj-c410-reading c10 -attr Slave obj-c411-reading c11 -attr Slave obj-c412-reading c12 -attr Slave obj-c413-reading c13 -attr Slave obj-c414-reading c14 -attr Slave obj-c415-reading c15 -attr Slave obj-c416-reading c16 -attr Slave obj-c417-reading c17 -attr Slave obj-c418-reading c18 - -define Master ModbusAttr 5 0 localhost:5501 -attr Master disable 1 -attr Master verbose 3 -attr Master nonPrioritizedGet 1 -attr Master nonPrioritizedSet 1 -attr Master profileInterval 1 - -attr Master dev-timing-sendDelay 0 -attr Master dev-timing-commDelay 0 - -attr Master obj-h256-reading TempWasserEin -attr Master obj-h258-reading TempWasserAus - -attr Master obj-h100-reading Test1 -attr Master obj-h100-expr $val + 2 -attr Master obj-h100-poll 1 -attr Master obj-h100-polldelay 0 - -attr Master obj-h101-reading Test2 -attr Master obj-h101-unpack f> -attr Master obj-h101-len 2 -attr Master obj-h101-format %.2f -attr Master obj-h101-poll 1 -attr Master obj-h101-polldelay 0 - -attr Master obj-h103-reading Test3 -attr Master obj-h103-unpack a8 -attr Master obj-h103-len 4 -attr Master obj-h103-poll 1 -attr Master obj-h103-polldelay 0 - -attr Master obj-h120-reading Test4 -attr Master obj-h120-unpack f> -attr Master obj-h120-len 2 -attr Master obj-h120-format %.2f -attr Master obj-h120-poll 1 -attr Master obj-h120-ignoreExpr $val > 10 -attr Master obj-h120-polldelay 0 - -attr Master obj-h130-reading Test5 -attr Master obj-h130-unpack a* -attr Master obj-h130-len 2 -attr Master obj-h130-encode utf8 - -attr Master obj-h10-reading o1 -attr Master obj-h10-map 0:off, 1:on - -attr Master obj-h11-reading o2 -attr Master obj-h11-min 1 -attr Master obj-h11-max 3 -attr Master dev-h-defSet 1 -attr Master dev-c-defSet 1 -attr Master dev-h-defShowGet 1 - -attr Master obj-c400-reading c0 -attr Master obj-c401-reading c1 -attr Master obj-c402-reading c2 -attr Master obj-c403-reading c3 -attr Master obj-c404-reading c4 -attr Master obj-c405-reading c5 -attr Master obj-c406-reading c6 -attr Master obj-c407-reading c7 -attr Master obj-c408-reading c8 -attr Master obj-c409-reading c9 -attr Master obj-c410-reading c10 -attr Master obj-c411-reading c11 -attr Master obj-c412-reading c12 -attr Master obj-c413-reading c13 -attr Master obj-c414-reading c14 -attr Master obj-c415-reading c15 -attr Master obj-c416-reading c16 -attr Master obj-c417-reading c17 -attr Master obj-c418-reading c18 - -attr Master obj-c400-poll 1 -attr Master obj-c405-poll 1 -attr Master obj-c406-poll 1 -attr Master obj-c417-poll 1 - -attr Master dev-h-combine 19 +attr global mseclog 1 + +define D1 dummy + +define Slave ModbusAttr 5 slave global:5501 +attr Slave obj-h256-reading TempWasserEin +attr Slave obj-h258-reading D1:TempWasserAus + +attr Slave obj-h100-reading Test1 +attr Slave obj-h100-setexpr $val * 4 + +attr Slave obj-h101-reading Test2 +attr Slave obj-h101-unpack f> +attr Slave obj-h101-len 2 + +attr Slave obj-h103-reading Test3 +attr Slave obj-h103-unpack a8 +attr Slave obj-h103-len 4 + +attr Slave obj-h120-reading Test4 +attr Slave obj-h120-unpack f> +attr Slave obj-h120-len 2 + +attr Slave obj-h130-reading Test5 +attr Slave obj-h130-unpack a* +attr Slave obj-h130-len 2 + +attr Slave obj-c400-reading c0 +attr Slave obj-c401-reading c1 +attr Slave obj-c402-reading c2 +attr Slave obj-c403-reading c3 +attr Slave obj-c404-reading c4 +attr Slave obj-c405-reading c5 +attr Slave obj-c406-reading c6 +attr Slave obj-c407-reading c7 +attr Slave obj-c408-reading c8 +attr Slave obj-c409-reading c9 +attr Slave obj-c410-reading c10 +attr Slave obj-c411-reading c11 +attr Slave obj-c412-reading c12 +attr Slave obj-c413-reading c13 +attr Slave obj-c414-reading c14 +attr Slave obj-c415-reading c15 +attr Slave obj-c416-reading c16 +attr Slave obj-c417-reading c17 +attr Slave obj-c418-reading c18 + +define Master ModbusAttr 5 0 localhost:5501 +attr Master disable 1 +attr Master verbose 3 +attr Master nonPrioritizedGet 1 +attr Master nonPrioritizedSet 1 +attr Master profileInterval 1 + +attr Master dev-timing-sendDelay 0 +attr Master dev-timing-commDelay 0 + +attr Master obj-h256-reading TempWasserEin +attr Master obj-h258-reading TempWasserAus + +attr Master obj-h100-reading Test1 +attr Master obj-h100-expr $val + 2 +attr Master obj-h100-poll 1 +attr Master obj-h100-polldelay 0 + +attr Master obj-h101-reading Test2 +attr Master obj-h101-unpack f> +attr Master obj-h101-len 2 +attr Master obj-h101-format %.2f +attr Master obj-h101-poll 1 +attr Master obj-h101-polldelay 0 + +attr Master obj-h103-reading Test3 +attr Master obj-h103-unpack a8 +attr Master obj-h103-len 4 +attr Master obj-h103-poll 1 +attr Master obj-h103-polldelay 0 + +attr Master obj-h120-reading Test4 +attr Master obj-h120-unpack f> +attr Master obj-h120-len 2 +attr Master obj-h120-format %.2f +attr Master obj-h120-poll 1 +attr Master obj-h120-ignoreExpr $val > 10 +attr Master obj-h120-polldelay 0 + +attr Master obj-h130-reading Test5 +attr Master obj-h130-unpack a* +attr Master obj-h130-len 2 +attr Master obj-h130-encode utf8 + +attr Master obj-h10-reading o1 +attr Master obj-h10-map 0:off, 1:on + +attr Master obj-h11-reading o2 +attr Master obj-h11-min 1 +attr Master obj-h11-max 3 +attr Master dev-h-defSet 1 +attr Master dev-c-defSet 1 +attr Master dev-h-defShowGet 1 + +attr Master obj-c400-reading c0 +attr Master obj-c401-reading c1 +attr Master obj-c402-reading c2 +attr Master obj-c403-reading c3 +attr Master obj-c404-reading c4 +attr Master obj-c405-reading c5 +attr Master obj-c406-reading c6 +attr Master obj-c407-reading c7 +attr Master obj-c408-reading c8 +attr Master obj-c409-reading c9 +attr Master obj-c410-reading c10 +attr Master obj-c411-reading c11 +attr Master obj-c412-reading c12 +attr Master obj-c413-reading c13 +attr Master obj-c414-reading c14 +attr Master obj-c415-reading c15 +attr Master obj-c416-reading c16 +attr Master obj-c417-reading c17 +attr Master obj-c418-reading c18 + +attr Master obj-c400-poll 1 +attr Master obj-c405-poll 1 +attr Master obj-c406-poll 1 +attr Master obj-c417-poll 1 + +attr Master dev-h-combine 19 attr Master dev-c-combine 32 \ No newline at end of file diff --git a/fhem/t/FHEM/98_Modbus/60_OverrideFC.cfg b/fhem/t/FHEM/98_Modbus/60_OverrideFC.cfg new file mode 100644 index 000000000..246413432 --- /dev/null +++ b/fhem/t/FHEM/98_Modbus/60_OverrideFC.cfg @@ -0,0 +1,77 @@ +attr global mseclog 1 + +define D1 dummy + +define Slave ModbusAttr 5 slave global:5501 + +attr Slave obj-h100-reading Test1 +attr Slave obj-h100-setexpr $val * 4 + +attr Slave obj-h400-reading DummyRegister + +attr Slave obj-c400-reading c0 +attr Slave obj-c401-reading c1 +attr Slave obj-c402-reading c2 +attr Slave obj-c403-reading c3 +attr Slave obj-c404-reading c4 +attr Slave obj-c405-reading c5 +attr Slave obj-c406-reading c6 +attr Slave obj-c407-reading c7 +attr Slave obj-c408-reading c8 +attr Slave obj-c409-reading c9 +attr Slave obj-c410-reading c10 +attr Slave obj-c411-reading c11 +attr Slave obj-c412-reading c12 +attr Slave obj-c413-reading c13 +attr Slave obj-c414-reading c14 +attr Slave obj-c415-reading c15 +attr Slave obj-c416-reading c16 +attr Slave obj-c417-reading c17 +attr Slave obj-c418-reading c18 + + +define Master ModbusAttr 5 0 localhost:5501 +attr Master disable 1 +attr Master verbose 3 +attr Master nonPrioritizedGet 1 +attr Master nonPrioritizedSet 1 +attr Master queueDelay 0 + +attr Master dev-timing-sendDelay 0 +attr Master dev-timing-commDelay 0 + +attr Master obj-h100-reading Test1 +attr Master obj-h100-expr $val + 2 +attr Master obj-h100-poll 1 +attr Master obj-h100-polldelay 0 + +attr Master dev-c-defSet 1 +attr Master dev-h-defShowGet 1 + +attr Master obj-c400-reading c0 +attr Master obj-c401-reading c1 +attr Master obj-c402-reading c2 +attr Master obj-c403-reading c3 +attr Master obj-c404-reading c4 +attr Master obj-c405-reading c5 +attr Master obj-c406-reading c6 +attr Master obj-c407-reading c7 +attr Master obj-c408-reading c8 +attr Master obj-c409-reading c9 +attr Master obj-c410-reading c10 +attr Master obj-c411-reading c11 +attr Master obj-c412-reading c12 +attr Master obj-c413-reading c13 +attr Master obj-c414-reading c14 +attr Master obj-c415-reading c15 +attr Master obj-c416-reading c16 +attr Master obj-c417-reading c17 +attr Master obj-c418-reading c18 + +attr Master obj-c400-poll 1 +attr Master obj-c405-poll 1 +attr Master obj-c406-poll 1 +attr Master obj-c417-poll 1 + +attr Master dev-h-combine 19 +attr Master dev-c-combine 32 \ No newline at end of file diff --git a/fhem/t/FHEM/98_Modbus/60_OverrideFC.t b/fhem/t/FHEM/98_Modbus/60_OverrideFC.t new file mode 100644 index 000000000..fb7f453aa --- /dev/null +++ b/fhem/t/FHEM/98_Modbus/60_OverrideFC.t @@ -0,0 +1,109 @@ +############################################## +# test master slave end to end +# also map, min max, ... +############################################## + +package main; + +use strict; +use warnings; +use Test::More; +use Time::HiRes qw( gettimeofday tv_interval); # return time as float, not just full seconds +use FHEM::HTTPMOD::Utils qw(:all); +use FHEM::Modbus::TestUtils qw(:all); + +fhem 'attr global mseclog 1'; +NextStep(); + +sub testStep1 { # preparation of slave content, enable devices + is(FhemTestUtils_gotLog('attribute'), 0, "no unknown attributes"); # logs during init are not collected. + LogStep "enable Master and set value at Slave"; + fhem 'attr Master disable 0'; + + fhem 'setreading Slave c0 1'; + fhem 'setreading Slave c5 1'; + fhem 'setreading Slave c17 1'; + return 0.1; +} + + +sub testStep10 { # check combined read of holding registers and coils + LogStep "getUpdate with combine"; + fhem 'attr Master verbose 5'; # 3 + fhem 'attr Slave verbose 3'; + fhem 'set Master reread'; + return 0.2; +} + +sub testStep11 { # check results coming from slave and write coils to slave + is(FhemTestUtils_gotEvent(qr/Master:c0: 1/), 1, "Combined Retrieve coil bit 0 from local slave"); + is(FhemTestUtils_gotEvent(qr/Master:c1: 0/), 1, "Combined Retrieve coil bit 1 from local slave"); + is(FhemTestUtils_gotEvent(qr/Master:c5: 1/), 1, "Combined Retrieve coil bit 5 from local slave"); + is(FhemTestUtils_gotEvent(qr/Master:c17: 1/), 1, "Combined Retrieve coil bit 17 from local slave"); + is(FhemTestUtils_gotLog('GetUpdate will now create requests for c400 len 18'), 1, "log for combined coils"); + + fhem 'attr Slave obj-c402-allowWrite 1'; + fhem 'attr Master verbose 5'; + fhem 'set Master c2 1'; + return 0.1; +} + +sub testStep12 { + LogStep "check coil comm"; + + is(FhemTestUtils_gotLog('sending 05050192ff002daf'), 1, "set c2 1 sending message in log"); + is(FhemTestUtils_gotEvent(qr/Master:c2: 1/), 1, "fc5 response for coil shows 1 from local slave"); + return 0.4; +} + + +sub testStep20 { + LogStep "override FC"; + fhem ('attr Master obj-c400-overrideFCread 99'); + fhem ('set Master reread'); + return 0.1; +} + +sub testStep21 { + LogStep "check overridden comm"; + is(FhemTestUtils_gotLog('cant combine c400 len 1 c0 with c405 len 1 c5, different function codes'), 1, "prevent combining different FCs"); + return 0.5; +} + + +sub testStep30 { + LogStep "override coil write FC"; + fhem 'attr Master obj-c400-overrideFCwrite 6'; + fhem 'attr Slave obj-h400-allowWrite 1'; # arrives as h400 on slave side + fhem 'attr Slave verbose 5'; + fhem 'set Master c0 1'; + return 0.1; +} + +sub testStep31 { + LogStep "check overridden write to coil"; + is(FhemTestUtils_gotEvent(qr/Slave:DummyRegister: 1/), 1, "DummyRegister set to 1"); + CheckAndReset(); + return 0.1; +} + + + +sub testStep40 { + LogStep "override holding register write FC"; + fhem 'attr Master obj-h400-reading Dummy2'; + fhem 'attr Master obj-h400-overrideFCwrite 5'; + fhem 'attr Slave obj-c400-allowWrite 1'; # h400 now arrives as c400 + fhem 'set Master Dummy2 255'; + return 0.1; +} + +sub testStep41 { + LogStep "check overridden write to holding register"; + #is(FhemTestUtils_gotEvent(qr/Slave:DummyRegister: 1/), 1, "DummyRegister set to 1"); + CheckAndReset(); + return 0.1; +} + + +1;