Branch Coverage

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


line true false branch
172 0 0 if length $command > 40 or not $command =~ /^[a-z]+$/
173 0 0 exists $commandopts->{$command} ? :
191 0 0 if (lc $arg eq '--json') { }
0 0 elsif (lc $arg eq '--pretty') { }
201 0 0 unless @commandargs
205 0 0 if ($self->valid_command($command)) { }
209 0 0 if ($opttemplate)
217 0 0 $command eq 'missing' ? :
234 0 0 if ($self->mode eq 'json')
235 0 0 if (exists $self->result->{'data'} and ref($self->result->{'data'})->isa('HiPi::RF::OpenThings::Message'))
239 0 0 $self->pretty ? :
243 0 0 if ($self->display eq 'usage')
246 0 0 if ($self->result->{'errorcode'} ne 'ERROR_SUCCESS')
255 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') { }
265 0 0 if (my $data = $self->result->{'data'})
272 0 0 if $data->{'version'}
273 0 0 if $data->{'board'}
274 0 0 if $data->{'can_rx'}
275 0 0 if $data->{'uses_spi'}
276 0 0 if $data->{'spi_device'} and $data->{'can_rx'} eq 'YES'
277 0 0 if $data->{'spi_device'} and $data->{'can_rx'} eq 'YES'
323 0 0 $self->result->{'data'}{'switch'} ? :
338 0 0 $self->result->{'command'} eq 'adapter' ? :
342 0 0 'HiPi::RF::OpenThings'->product_can_switch($data->{'manufacturer_id'}, $data->{'product_id'}) ? :
364 0 0 if ($record->{'id'} == 115)
365 0 0 $value ? :
367 0 0 $record->{'units'} ? :
375 0 0 if (exists $self->result->{'data'} and ref($self->result->{'data'})->isa('HiPi::RF::OpenThings::Message'))
386 0 0 if ($data)
393 0 0 if $option
404 0 0 if $option
415 0 0 if $option
439 0 0 if ($self->options->{'help'}) { }
0 0 elsif ($self->options->{'list'}) { }
448 0 0 if ($self->options->{'device'})
449 0 0 if (my($devicename) = $self->options->{'device'} =~ m[^(/dev/spidev\d\.\d)$]i) { }
461 0 0 if ($self->options->{'board'})
462 0 0 if (my($board) = $self->options->{'board'} =~ /^(ENER314|ENER314_RT)$/i) { }
474 0 0 if (defined $self->options->{'reset'})
476 0 0 if ($self->options->{'reset'} and $self->options->{'reset'} =~ /^\d+$/) { }
490 0 0 if ($newdevice)
495 0 0 if ($newboard)
500 0 0 if ($newreset)
519 0 0 if ($self->options->{'help'}) { }
0 0 elsif ($self->options->{'list'}) { }
0 0 elsif ($create) { }
0 0 elsif ($delete) { }
0 0 elsif ($rename) { }
527 0 0 if ($delete or $rename)
537 0 0 if (lc $self->conf->{'groups'}{$existing} eq lc $create)
549 0 0 if ($group)
550 0 0 if (exists $self->conf->{'groups'}{$group})
564 0 0 unless (exists $self->conf->{'groups'}{$group})
574 0 0 if ($create or $rename)
584 0 0 if (lc $self->conf->{'groups'}{$group} eq lc $delete)
587 0 0 if ($self->conf->{'switches'}{$switchname}{'group'} == $group)
606 0 0 if ($delete or $create)
616 0 0 unless ($newname)
626 0 0 if (lc $self->conf->{'groups'}{$existing} eq lc $newname)
637 0 0 if (lc $self->conf->{'groups'}{$existing} eq lc $rename)
664 0 0 if ($self->options->{'help'})
669 0 0 if ($self->options->{'list'})
678 0 0 if ($self->receiver) { }
680 0 0 unless ($groupname)
691 0 0 if (lc $self->conf->{'groups'}{$checkgroup} eq lc $groupname)
697 0 0 unless ($group)
712 0 0 unless ($switch and $switch =~ /^1|2|3|4$/)
738 0 0 if ($error)
753 0 0 if ($self->options->{'help'})
758 0 0 if ($self->options->{'list'})
765 0 0 $self->options->{'all'} ? :
769 0 0 if ($name)
770 0 0 if (exists $self->conf->{'switches'}{$name}) { }
785 0 0 if ($self->receiver and not $group) { }
0 0 elsif (not $self->receiver) { }
787 0 0 unless ($groupname)
798 0 0 if (lc $self->conf->{'groups'}{$checkgroup} eq lc $groupname)
804 0 0 unless ($group)
817 0 0 unless (defined $switch and $switch =~ /^0|1|2|3|4$/)
826 0 0 unless ($self->options->{'on'} or $self->options->{'off'})
835 0 0 if ($self->options->{'on'} and $self->options->{'off'})
844 0 0 $self->options->{'on'} ? :
863 0 0 if ($error)
868 0 0 $self->receiver ? :
870 0 0 $state ? :
884 0 0 if ($self->options->{'help'})
889 0 0 if ($self->options->{'list'})
899 0 0 unless ($switch and $switch =~ /^|1|2|3|4$/)
908 0 0 unless ($name)
917 0 0 if ($self->receiver) { }
919 0 0 unless ($groupname)
930 0 0 if (lc $self->conf->{'groups'}{$checkgroup} eq lc $groupname)
936 0 0 unless ($group)
952 0 0 if ($self->conf->{'switches'}{$switchname}{'switch'} == $switch and $self->conf->{'switches'}{$switchname}{'group'} == $group)
968 0 0 if ($self->options->{'help'})
973 0 0 if ($self->options->{'list'})
978 0 0 unless ($self->receiver)
991 0 0 if ($delete) { }
0 0 elsif ($rename) { }
993 0 0 if (exists $self->conf->{'adapters'}{$delete})
997 0 0 if (exists $self->conf->{'monitors'}{$delete})
1001 0 0 if ($deleted) { }
1013 0 0 unless ($name)
1023 0 0 if (exists $self->conf->{'monitors'}{$name})
1033 0 0 unless (exists $self->conf->{'monitors'}{$rename})
1045 0 0 if (exists $self->conf->{'adapters'}{$rename})
1055 0 0 if (exists $self->conf->{'adapters'}{$name})
1081 0 0 if ($result->{'success'}) { }
1086 0 0 if (my $registered_name = $self->registered_sensor($joinmsg->sensor_key))
1100 0 0 if ('HiPi::RF::OpenThings'->product_can_switch($joinmsg->manufacturer_id, $joinmsg->product_id))
1122 0 0 if ($self->options->{'help'})
1127 0 0 if ($self->options->{'list'})
1132 0 0 unless ($self->receiver)
1143 0 0 unless ($name)
1156 0 0 if (lc $checkname eq lc $name)
1162 0 0 unless ($nameconfig)
1170 0 0 if ($self->options->{'query'})
1177 0 0 unless ($self->options->{'on'} or $self->options->{'off'})
1186 0 0 if ($self->options->{'on'} and $self->options->{'off'})
1195 0 0 $self->options->{'on'} ? :
1217 0 0 unless ($result->{'success'})
1234 0 0 if ($self->options->{'help'})
1239 0 0 if ($self->options->{'list'})
1244 0 0 unless ($self->receiver)
1255 0 0 unless ($name)
1268 0 0 if (lc $checkname eq lc $name)
1274 0 0 unless ($nameconfig)
1305 0 0 unless ($result->{'success'})
1308 0 0 $type eq 'adapter ' ? :
1333 0 0 $self->receiver ? :
0 0 $self->receiver ? :
1355 0 0 $type eq 'both' ? :
1397 0 0 if (lc $conf->{$member}{'sensor_key'} eq $sensorkey)
1419 0 0 $self->conf->{'board'} eq 'ENER314_RT' ? :
1717 0 0 if (exists $usagetext->{$command}) { }