Branch Coverage

blib/lib/HiPi/Energenie/Command.pm
Criterion Covered Total %
branch 0 292 0.0


line true false branch
173 0 0 if length $command > 40 or not $command =~ /^[a-z]+$/
174 0 0 exists $commandopts->{$command} ? :
192 0 0 if (lc $arg eq '--json') { }
0 0 elsif (lc $arg eq '--pretty') { }
202 0 0 unless @commandargs
206 0 0 if ($self->valid_command($command)) { }
210 0 0 if ($opttemplate)
218 0 0 $command eq 'missing' ? :
235 0 0 if ($self->mode eq 'json')
236 0 0 if (exists $self->result->{'data'} and ref($self->result->{'data'})->isa('HiPi::RF::OpenThings::Message'))
240 0 0 $self->pretty ? :
244 0 0 if ($self->display eq 'usage')
247 0 0 if ($self->result->{'errorcode'} ne 'ERROR_SUCCESS')
256 0 0 if ($self->result->{'errorcode'} ne 'ERROR_SUCCESS' or not $self->result->{'success'}) { }
0 0 elsif ($self->result->{'command'} eq 'config') { }
0 0 elsif ($self->result->{'command'} eq 'version') { }
0 0 elsif ($self->result->{'command'} eq 'group') { }
0 0 elsif ($self->result->{'command'} =~ /^pair|alias$/ or $self->result->{'command'} eq 'switch' and $self->result->{'option'} eq 'list') { }
0 0 elsif ($self->result->{'command'} eq 'switch' and $self->result->{'option'} ne 'list') { }
0 0 elsif ($self->result->{'command'} eq 'join' or $self->result->{'command'} =~ /^adapter|monitor$/ and $self->result->{'option'} eq 'list') { }
0 0 elsif ($self->result->{'command'} =~ /^adapter|monitor$/ and $self->result->{'option'} ne 'list') { }
266 0 0 if (my $data = $self->result->{'data'})
273 0 0 if $data->{'version'}
274 0 0 if $data->{'board'}
275 0 0 if $data->{'can_rx'}
276 0 0 if $data->{'uses_spi'}
277 0 0 if $data->{'spi_device'} and $data->{'can_rx'} eq 'YES'
278 0 0 if $data->{'spi_device'} and $data->{'can_rx'} eq 'YES'
324 0 0 $self->result->{'data'}{'switch'} ? :
339 0 0 $self->result->{'command'} eq 'adapter' ? :
343 0 0 'HiPi::RF::OpenThings'->product_can_switch($data->{'manufacturer_id'}, $data->{'product_id'}) ? :
365 0 0 if ($record->{'id'} == 115)
366 0 0 $value ? :
368 0 0 $record->{'units'} ? :
376 0 0 if (exists $self->result->{'data'} and ref($self->result->{'data'})->isa('HiPi::RF::OpenThings::Message'))
387 0 0 if ($data)
394 0 0 if $option
405 0 0 if $option
416 0 0 if $option
440 0 0 if ($self->options->{'help'}) { }
0 0 elsif ($self->options->{'list'}) { }
449 0 0 if ($self->options->{'device'})
450 0 0 if (my($devicename) = $self->options->{'device'} =~ m[^(/dev/spidev\d\.\d)$]i) { }
462 0 0 if ($self->options->{'board'})
463 0 0 if (my($board) = $self->options->{'board'} =~ /^(ENER314|ENER314_RT|RF69HW)$/i) { }
475 0 0 if (defined $self->options->{'reset'})
477 0 0 if ($self->options->{'reset'} and $self->options->{'reset'} =~ /^\d+$/) { }
491 0 0 if ($newdevice)
496 0 0 if ($newboard)
501 0 0 if ($newreset)
520 0 0 if ($self->options->{'help'}) { }
0 0 elsif ($self->options->{'list'}) { }
0 0 elsif ($create) { }
0 0 elsif ($delete) { }
0 0 elsif ($rename) { }
528 0 0 if ($delete or $rename)
538 0 0 if (lc $self->conf->{'groups'}{$existing} eq lc $create)
550 0 0 if ($group)
551 0 0 if (exists $self->conf->{'groups'}{$group})
565 0 0 unless (exists $self->conf->{'groups'}{$group})
575 0 0 if ($create or $rename)
585 0 0 if (lc $self->conf->{'groups'}{$group} eq lc $delete)
588 0 0 if ($self->conf->{'switches'}{$switchname}{'group'} == $group)
607 0 0 if ($delete or $create)
617 0 0 unless ($newname)
627 0 0 if (lc $self->conf->{'groups'}{$existing} eq lc $newname)
638 0 0 if (lc $self->conf->{'groups'}{$existing} eq lc $rename)
665 0 0 if ($self->options->{'help'})
670 0 0 if ($self->options->{'list'})
679 0 0 if ($self->receiver) { }
681 0 0 unless ($groupname)
692 0 0 if (lc $self->conf->{'groups'}{$checkgroup} eq lc $groupname)
698 0 0 unless ($group)
713 0 0 unless ($switch and $switch =~ /^1|2|3|4$/)
739 0 0 if ($error)
754 0 0 if ($self->options->{'help'})
759 0 0 if ($self->options->{'list'})
766 0 0 $self->options->{'all'} ? :
770 0 0 if ($name)
771 0 0 if (exists $self->conf->{'switches'}{$name}) { }
786 0 0 if ($self->receiver and not $group) { }
0 0 elsif (not $self->receiver) { }
788 0 0 unless ($groupname)
799 0 0 if (lc $self->conf->{'groups'}{$checkgroup} eq lc $groupname)
805 0 0 unless ($group)
818 0 0 unless (defined $switch and $switch =~ /^0|1|2|3|4$/)
827 0 0 unless ($self->options->{'on'} or $self->options->{'off'})
836 0 0 if ($self->options->{'on'} and $self->options->{'off'})
845 0 0 $self->options->{'on'} ? :
864 0 0 if ($error)
869 0 0 $self->receiver ? :
871 0 0 $state ? :
885 0 0 if ($self->options->{'help'})
890 0 0 if ($self->options->{'list'})
900 0 0 unless ($switch and $switch =~ /^|1|2|3|4$/)
909 0 0 unless ($name)
918 0 0 if ($self->receiver) { }
920 0 0 unless ($groupname)
931 0 0 if (lc $self->conf->{'groups'}{$checkgroup} eq lc $groupname)
937 0 0 unless ($group)
953 0 0 if ($self->conf->{'switches'}{$switchname}{'switch'} == $switch and $self->conf->{'switches'}{$switchname}{'group'} == $group)
969 0 0 if ($self->options->{'help'})
974 0 0 if ($self->options->{'list'})
979 0 0 unless ($self->receiver)
992 0 0 if ($delete) { }
0 0 elsif ($rename) { }
994 0 0 if (exists $self->conf->{'adapters'}{$delete})
998 0 0 if (exists $self->conf->{'monitors'}{$delete})
1002 0 0 if ($deleted) { }
1014 0 0 unless ($name)
1024 0 0 if (exists $self->conf->{'monitors'}{$name})
1034 0 0 unless (exists $self->conf->{'monitors'}{$rename})
1046 0 0 if (exists $self->conf->{'adapters'}{$rename})
1056 0 0 if (exists $self->conf->{'adapters'}{$name})
1069 0 0 unless ($timeout =~ /^[1-9][0-9]*$/)
1092 0 0 if ($result->{'success'}) { }
1097 0 0 if (my $registered_name = $self->registered_sensor($joinmsg->sensor_key))
1111 0 0 if ('HiPi::RF::OpenThings'->product_can_switch($joinmsg->manufacturer_id, $joinmsg->product_id))
1133 0 0 if ($self->options->{'help'})
1138 0 0 if ($self->options->{'list'})
1143 0 0 unless ($self->receiver)
1154 0 0 unless ($name)
1167 0 0 if (lc $checkname eq lc $name)
1173 0 0 unless ($nameconfig)
1183 0 0 if ($self->options->{'query'})
1184 0 0 unless ($timeout =~ /^[1-9][0-9]*$/)
1198 0 0 unless ($self->options->{'on'} or $self->options->{'off'})
1207 0 0 if ($self->options->{'on'} and $self->options->{'off'})
1216 0 0 unless ($timeout =~ /^[1-9][0-9]*$/)
1225 0 0 $self->options->{'on'} ? :
1248 0 0 unless ($result->{'success'})
1265 0 0 if ($self->options->{'help'})
1270 0 0 if ($self->options->{'list'})
1275 0 0 unless ($self->receiver)
1286 0 0 unless ($name)
1300 0 0 if (lc $checkname eq lc $name)
1306 0 0 unless ($nameconfig)
1315 0 0 unless ($timeout =~ /^[1-9][0-9]*$/)
1347 0 0 unless ($result->{'success'})
1350 0 0 $type eq 'adapter ' ? :
1375 0 0 $self->receiver ? :
0 0 $self->receiver ? :
1397 0 0 $type eq 'both' ? :
1439 0 0 if (lc $conf->{$member}{'sensor_key'} eq $sensorkey)
1461 0 0 $self->conf->{'board'} =~ /^ENER314_RT|RF69HW$/ ? :
1768 0 0 if (exists $usagetext->{$command}) { }