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

36_ShellyMonitor: Further bugfixes, SHEM recognition

git-svn-id: https://svn.fhem.de/fhem/trunk@27981 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
gvzdus 2023-09-18 20:54:54 +00:00
parent 6ef5da10c8
commit a140c01633

View File

@ -234,6 +234,7 @@ my %DEVID_MODEL = (
"SHCB-1" => "shellybulb",
"SHBLB-1" => "shellybulb",
"SHBDUO-1" => "shellybulb",
"SHEM" => "shellyem",
"SHEM-3" => "shelly3em",
"SHMOS-01" => "generic",
"SHWT-1" => "generic",
@ -265,6 +266,7 @@ my %DEVID_PREFIX = (
"SHIX3-1" => "shelly_i3",
"SHMOS-01" => "shelly_motion",
"SHTRV-01" => "shelly_trv",
"SHEM" => "shelly_em",
"SHEM-3" => "shelly_em3"
);
@ -325,8 +327,8 @@ sub ShellyMonitor_Initialize
# Check which models are available in Mod_Shelly
LoadModule "Shelly";
my $fn = $modules{"Shelly"}{"AttrList"};
if($fn && $fn=~/ model:([^ ]+)( |$)/) {
map { $shelly_models_by_mod_shelly{$_} = 1 } split (/,/, $1);
if($fn && $fn=~/(^| )model:([^ ]+)( |$)/) {
map { $shelly_models_by_mod_shelly{$_} = 1 } split (/,/, $2);
Log3 $hash->{NAME}, 2, "Shelly-Module loaded supports models: " . join(',', keys %shelly_models_by_mod_shelly);
}
}
@ -1007,6 +1009,8 @@ sub ShellyMonitor_Set
CommandAttr ( undef, $dname . ' model ' . $model);
} elsif ($shelly_models_by_mod_shelly{"shellygeneric"}) {
CommandAttr ( undef, $dname . ' model shellygeneric');
} elsif ($shelly_models_by_mod_shelly{"generic"}) {
CommandAttr ( undef, $dname . ' model generic');
}
return "Creation of device '$dname' failed" unless ($defs{$dname});