2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

36_ShellyMonitor: Initial support for ShellyMotion

git-svn-id: https://svn.fhem.de/fhem/trunk@23756 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
gvzdus 2021-02-17 12:26:37 +00:00
parent 5d3255fdb7
commit 9e33d72564

View File

@ -215,6 +215,7 @@ my %DEVID_MODEL = (
"SHCB-1" => "shellybulb", "SHCB-1" => "shellybulb",
"SHBLB-1" => "shellybulb", "SHBLB-1" => "shellybulb",
"SHBDUO-1" => "shellybulb", "SHBDUO-1" => "shellybulb",
"SHMOS-01" => "generic",
"SHWT-1" => "generic", "SHWT-1" => "generic",
"SHHT-1" => "generic", "SHHT-1" => "generic",
"SHGS-1" => "generic", "SHGS-1" => "generic",
@ -240,7 +241,8 @@ my %DEVID_PREFIX = (
"SHHT-1" => "shelly_ht", "SHHT-1" => "shelly_ht",
"SHGS-1" => "shelly_gas", "SHGS-1" => "shelly_gas",
"SHBTN-2" => "shelly_button", "SHBTN-2" => "shelly_button",
"SHIX3-1" => "shelly_i3" "SHIX3-1" => "shelly_i3",
"SHMOS-01" => "shelly_motion"
); );
# Mapping of DeviceId in Multicast to additional attributes on creation # Mapping of DeviceId in Multicast to additional attributes on creation
@ -462,8 +464,9 @@ sub ShellyMonitor_DoRead
# Now lets unpack the raw packet data... # Now lets unpack the raw packet data...
my ($b1,$b2,$msgid,$opt1byte,$remain) = unpack('CCSB8A*', $data); my $opt1byte;
if ($b1 != 0x50) { my ($b1,$b2,$msgid,$remain) = unpack('CCSA*', $data);
if ($b1 < 0x50 || $b1 > 0x5f) {
Log3 $name, 3, "Unexpected byte at pos 0: " . sprintf("0x%X", $b1) . ", expecting Non-Confirm. w/o token"; Log3 $name, 3, "Unexpected byte at pos 0: " . sprintf("0x%X", $b1) . ", expecting Non-Confirm. w/o token";
$hash->{".ReceivedBroken"}++; $hash->{".ReceivedBroken"}++;
return; return;
@ -473,6 +476,15 @@ sub ShellyMonitor_DoRead
Log3 $name, 3, "Unexpected byte at pos 1: " . sprintf("0x%X", $b2) . ", expecting Code 30"; Log3 $name, 3, "Unexpected byte at pos 1: " . sprintf("0x%X", $b2) . ", expecting Code 30";
return; return;
} }
my $tokenlen = $b1 & 0xf;
my $token;
if ($tokenlen>0) {
my $unpackstr = "A${tokenlen}B8A*";
($token,$opt1byte,$remain) = unpack($unpackstr, $remain);
} else {
($opt1byte,$remain) = unpack('B8A*', $remain);
}
my $option = 0; my $option = 0;
my $uri = ""; my $uri = "";