line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
1981
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
112
|
|
2
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
170
|
|
3
|
|
|
|
|
|
|
package Device::RFXCOM::Decoder::Digimax; |
4
|
|
|
|
|
|
|
$Device::RFXCOM::Decoder::Digimax::VERSION = '1.163170'; |
5
|
|
|
|
|
|
|
# ABSTRACT: Device::RFXCOM::Decoder::Digimax decode Digimax RF messages |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
60
|
use 5.006; |
|
3
|
|
|
|
|
8
|
|
9
|
3
|
|
|
3
|
|
29
|
use constant DEBUG => $ENV{DEVICE_RFXCOM_DECODER_DIGIMAX_DEBUG}; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
217
|
|
10
|
3
|
|
|
3
|
|
14
|
use Carp qw/croak/; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
150
|
|
11
|
3
|
|
|
3
|
|
14
|
use base 'Device::RFXCOM::Decoder'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
252
|
|
12
|
3
|
|
|
3
|
|
1473
|
use Device::RFXCOM::Response::Thermostat; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
85
|
|
13
|
3
|
|
|
3
|
|
147
|
use Device::RFXCOM::Decoder qw/hi_nibble lo_nibble nibble_sum/; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
978
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub decode { |
17
|
86
|
|
|
86
|
1
|
157
|
my ($self, $parent, $message, $bytes, $bits, $result) = @_; |
18
|
86
|
100
|
|
|
|
456
|
return unless ($bits == 44); |
19
|
5
|
|
|
|
|
19
|
my $p = |
20
|
|
|
|
|
|
|
hi_nibble($bytes->[0]) + lo_nibble($bytes->[0]) + |
21
|
|
|
|
|
|
|
hi_nibble($bytes->[1]) + lo_nibble($bytes->[1]) + |
22
|
|
|
|
|
|
|
hi_nibble($bytes->[2]) + lo_nibble($bytes->[2]); |
23
|
5
|
|
|
|
|
7
|
$p &= 0xf; |
24
|
5
|
100
|
|
|
|
17
|
return unless ($p == 0xf); |
25
|
|
|
|
|
|
|
|
26
|
4
|
|
|
|
|
10
|
$p = |
27
|
|
|
|
|
|
|
hi_nibble($bytes->[3]) + lo_nibble($bytes->[3]) + |
28
|
|
|
|
|
|
|
hi_nibble($bytes->[4]) + lo_nibble($bytes->[4]) + |
29
|
|
|
|
|
|
|
hi_nibble($bytes->[5]); |
30
|
4
|
|
|
|
|
6
|
$p &= 0xf; |
31
|
4
|
100
|
|
|
|
11
|
return unless ($p == 0xf); |
32
|
|
|
|
|
|
|
|
33
|
3
|
|
|
|
|
17
|
my $state = |
34
|
|
|
|
|
|
|
[ |
35
|
|
|
|
|
|
|
'undef', 'demand', 'satisfied', 'init' |
36
|
|
|
|
|
|
|
]->[hi_nibble($bytes->[2])&0x3]; |
37
|
|
|
|
|
|
|
|
38
|
3
|
|
|
|
|
5
|
my $temp = $bytes->[3]; |
39
|
3
|
|
|
|
|
5
|
my $set = $bytes->[4]&0x3f; |
40
|
3
|
100
|
|
|
|
12
|
my $mode = $bytes->[4]&0x40 ? 'cool' : 'heat'; |
41
|
3
|
|
|
|
|
16
|
my $device = sprintf 'digimax.%02x%02x', $bytes->[0], $bytes->[1]; |
42
|
3
|
|
|
|
|
3
|
printf STDERR "Thermostat: $device $state $temp $set $mode\n" if DEBUG; |
43
|
3
|
|
|
|
|
4
|
push @{$result->{messages}}, |
|
3
|
|
|
|
|
20
|
|
44
|
|
|
|
|
|
|
Device::RFXCOM::Response::Thermostat->new(device => $device, |
45
|
|
|
|
|
|
|
temp => $temp, |
46
|
|
|
|
|
|
|
set => $set, |
47
|
|
|
|
|
|
|
mode => $mode, |
48
|
|
|
|
|
|
|
state => $state); |
49
|
3
|
|
|
|
|
13
|
return 1; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |