2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

98_ComfoAir: updated tests

git-svn-id: https://svn.fhem.de/fhem/trunk@26105 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
StefanStrobel 2022-05-31 18:24:48 +00:00
parent 24568def07
commit 35f1371ffc
6 changed files with 172 additions and 0 deletions

View File

@ -0,0 +1,2 @@
attr global mseclog 1

View File

@ -0,0 +1,37 @@
##############################################
# test basic define
##############################################
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);
NextStep();
sub testStep1 {
fhem 'define ZL ComfoAir none';
return;
}
sub testStep2 {
is(FhemTestUtils_gotLog("Defined with device none"), 1, "defined");
is($defs{'ZL'}{Interval} // 0, 0, "no interval");
FhemTestUtils_resetLogs();
fhem 'delete ZL';
fhem 'define ZL ComfoAir none 60';
return;
}
sub testStep3 {
is($defs{'ZL'}{Interval} // 0, 60, "interval correct");
#is(FhemTestUtils_gotLog("ZL: Can't open NoSuchDevice: No such file or directory"), 1, "correct error if no device");
#is(FhemTestUtils_gotLog("Defined with device NoSuchDevice"), 0, "no defined log if no device");
FhemTestUtils_resetLogs();
return;
}
1;

View File

@ -0,0 +1,6 @@
attr global mseclog 1
define ZL ComfoAir none
attr ZL verbose 5
attr ZL timeout 0
attr ZL queueDelay 0

View File

@ -0,0 +1,57 @@
##############################################
# test ComfoAir listen and create readings
##############################################
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);
NextStep;
sub testStep1 {
SimRead('ZL', '07f000d209503e4e55550f28282895070f');
SimRead('ZL', '07f3');
return;
}
sub testStep2 {
is(FhemTestUtils_gotEvent(qr/ZL:Temp_Komfort:\s20/xms), 1, "Parse TempKomfort with expression");
CheckAndReset();
return;
}
sub testStep3 {
SimRead('ZL', '07f000ce0e0f23320f23322d000300464600000d070f');
SimRead('ZL', '07f3');
return;
}
sub testStep4 {
is(FhemTestUtils_gotEvent(qr/ZL:Stufe:\smittel/xms), 1, "Parse TempKomfort with expression");
CheckAndReset();
return;
}
sub testStep10 {
fhem 'attr ZL verbose 5';
# start 07f0, cmd 00de, len 14, data, chk af, end 070f
#SimRead('ZL', '07f000de14004e0f003e8900018e05590000002e31128000010daf070f');
SimRead('ZL', '07f000de144e0f003e8900018e05590000002e31128000010daf070f');
return;
}
sub testStep11{
#is(FhemTestUtils_gotEvent(qr/ZL:Stufe:\smittel/xms), 1, "Parse TempKomfort with expression");
return;
}
1;

View File

@ -0,0 +1,6 @@
attr global mseclog 1
define ZL ComfoAir none
attr ZL verbose 5
attr ZL timeout 0
attr ZL queueDelay 0

View File

@ -0,0 +1,64 @@
##############################################
# test ComfoAir listen and create readings
##############################################
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);
NextStep;
sub testStep5 {
fhem 'set ZL Stufe niedrig';
return 0.1;
}
sub testStep6 {
is(FhemTestUtils_gotLog('Simulate sending to none: 07f00099010249070f'), 1, "got sending correct data for Stufe");
CheckAndReset();
return 0.1;
}
sub testStep7 {
fhem 'set ZL Temp_Komfort 21';
return 0.1;
}
sub testStep8 {
is(FhemTestUtils_gotLog('Simulate sending to none: 07f000d30152d3070f'), 1, "got sending correct data for Temp_Comfort");
CheckAndReset();
return;
}
sub testStep10 {
fhem 'set ZL Temp_Komfort 1';
return 0.1;
}
sub testStep11 {
is(FhemTestUtils_gotLog('Set Value 1 is smaller than Min'), 1, "got error from min check");
CheckAndReset();
return;
}
sub testStep12 {
fhem 'set ZL Temp_Komfort 50';
return 0.1;
}
sub testStep13 {
is(FhemTestUtils_gotLog('Set Value 50 is bigger than Max'), 1, "got error from min check");
CheckAndReset();
return;
}
1;