2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

36_WMBUS: new attribute ignoreUnknownDataBlocks

git-svn-id: https://svn.fhem.de/fhem/trunk@18001 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
kaihs 2018-12-18 19:20:02 +00:00
parent d6c23e47c9
commit 3ffb734571
3 changed files with 25 additions and 4 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- feature: 36_WMBUS: new attribute ignoreUnknownDataBlocks
- feature: 49_SSCam: V8.0.0, new type "hls" of streaming devices, hls
playback now available for all common browsers,
tooltip hints in streaming devices, minor fixes

View File

@ -33,6 +33,7 @@ sub WMBUS_Initialize($) {
" AESkey".
" ignore:0,1".
" rawmsg_as_reading:0,1".
" ignoreUnknownDataBlocks:0,1".
" $readingFnAttributes";
}
@ -333,6 +334,7 @@ sub WMBUS_SetReadings($$$)
my $dataBlock;
for $dataBlock ( @$dataBlocks ) {
next if AttrVal($name, "ignoreUnknownDataBlocks", 0) && $dataBlock->{type} eq 'MANUFACTURER SPECIFIC'; #WMBus::VIF_TYPE_MANUFACTURER_SPECIFIC
readingsBulkUpdate($hash, "$dataBlock->{number}_storage_no", $dataBlock->{storageNo});
readingsBulkUpdate($hash, "$dataBlock->{number}_type", $dataBlock->{type});
readingsBulkUpdate($hash, "$dataBlock->{number}_value", $dataBlock->{value});
@ -359,7 +361,7 @@ sub WMBUS_SetReadings($$$)
}
if (AttrVal($name, "rawmsg_as_reading", 0)) {
readingsBulkUpdate($hash, "rawmsg", unpack("H*",$mb->{msg}));
readingsBulkUpdate($hash, "rawmsg", $mb->getFrameType() eq WMBus::FRAME_TYPE_B ? "Y" : "" . unpack("H*",$mb->{msg}));
}
readingsEndUpdate($hash,1);
@ -526,6 +528,11 @@ WMBUS_Attr(@)
<li>rawmsg_as_reading<br>
If set to 1, received raw messages will be stored in the reading rawmsg. This can be used to log raw messages to help with debugging.
</li>
<li>ignoreUnknownDataBlocks<br>
If set to 1, datablocks containing unknown/manufacturer specific data will be ignored. This is useful if a meter sends data in different
formats of which some can be interpreted and some not. This prevents the unknown data overwriting the readings of the data that can be
interpreted.
</li>
</ul>
<br>
<a name="WMBUSreadings"></a>
@ -636,6 +643,10 @@ WMBUS_Attr(@)
<li>rawmsg_as_reading<br>
Wenn auf 1 gesetzt so werden empfangene Nachrichten im Reading rawmsg gespeichert. Das kann verwendet werden um Rohnachrichten zu loggen und beim Debugging zu helfen.
</li>
<li>ignoreUnknownDataBlocks<br>
Wenn auf 1 gesetzt so werden Datenblocks die unbekannte/herstellerspezifische Daten enthalten ignoriert. Das ist hilfreich wenn ein Z&auml;hler Daten in unterschiedlichen
Formaten sendet von denen einige nicht interpretiert werden k&ouml;nnen. Es verhindert, dass die unbekannten Daten die Readings der interpretierbaren Daten &uuml;berschreiben.
</li>
</ul>
<br>
<a name="WMBUSreadings"></a>

View File

@ -13,7 +13,7 @@ my $hasCTR = ($@)?0:1;
require Exporter;
my @ISA = qw(Exporter);
my @EXPORT = qw(new parse parseLinkLayer parseApplicationLayer manId2ascii type2string);
my @EXPORT = qw(new parse parseLinkLayer parseApplicationLayer manId2ascii type2string setFrameType getFrameType VIF_TYPE_MANUFACTURER_SPECIFIC);
sub manId2ascii($$);
@ -97,10 +97,13 @@ use constant {
ERR_CIPHER_NOT_INSTALLED => 16,
ERR_LINK_LAYER_INVALID => 17,
VIF_TYPE_MANUFACTURER_SPECIFIC => 'MANUFACTURER SPECIFIC',
# TYPE C transmission uses two different frame types
# see http://www.st.com/content/ccc/resource/technical/document/application_note/3f/fb/35/5a/25/4e/41/ba/DM00233038.pdf/files/DM00233038.pdf/jcr:content/translations/en.DM00233038.pdf
FRAME_TYPE_A => 'A',
FRAME_TYPE_B => 'B',
};
sub valueCalcNumeric($$) {
@ -1175,7 +1178,7 @@ sub decodeValueInformationBlock($$$) {
} else {
# manufacturer specific data, can't be interpreted
$dataBlockRef->{type} = "MANUFACTURER SPECIFIC";
$dataBlockRef->{type} = VIF_TYPE_MANUFACTURER_SPECIFIC;
$dataBlockRef->{unit} = "";
$analyzeVIF = 0;
}
@ -1968,12 +1971,18 @@ sub decodeLinkLayer($$)
return 1;
}
sub setFrameType($)
sub setFrameType($$)
{
my $self = shift;
$self->{frame_type} = shift;
}
sub getFrameType($)
{
my $self = shift;
return $self->{frame_type};
}
sub parse($$)
{
my $self = shift;