2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 19:04:20 +00:00

98_Modbus: updated tests and TestUtils.pm

git-svn-id: https://svn.fhem.de/fhem/trunk@26104 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
StefanStrobel 2022-05-31 18:23:01 +00:00
parent d48931a37b
commit 24568def07
28 changed files with 3016 additions and 2277 deletions

View File

@ -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

View File

@ -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;

View File

@ -45,6 +45,7 @@ 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
@ -88,6 +89,7 @@ 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
@ -95,6 +97,13 @@ 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

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;