diff --git a/fhem/CHANGED b/fhem/CHANGED index 7f8b45c94..3153a8972 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -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. + - change: WMBUS: use _ instead of : as readings separator, better support for EnergyCam - feature: new module 23_KOSTALPIKO added (john) - feature: new module 98_HourCounter added, 99_UtilsHourCounter.pm added to contrib (john) - added: MYSENSORS: connect to serial or Ethernet MySensors Gateway diff --git a/fhem/FHEM/36_WMBUS.pm b/fhem/FHEM/36_WMBUS.pm index f45e79010..5293524a6 100644 --- a/fhem/FHEM/36_WMBUS.pm +++ b/fhem/FHEM/36_WMBUS.pm @@ -13,30 +13,6 @@ use SetExtensions; use WMBus; -#my %defaultAttrs = ( -# # manufacturer -# FFD => { # FastForward AG, EnergyCam -# # type -# 2 => [ # electricity -# # fhem commands to execute -# 'attr %D% userreading energy:1:value { ReadingsVal("%D%","1:value",0)/1000 . " kWh";; }', -# 'attr %D% stateformat {ReadingsVal("%D%","energy","") . " " . ReadingsTimestamp("%D%","energy","");;}', -# ], -# 3 => [ # gas -# # fhem commands to execute -# 'attr %D% userreading volume:1:value { ReadingsVal("%D%","1:value",0) . " " . ReadingsVal("%D%","1:unit","");; }', -# 'attr %D% stateformat {ReadingsVal("%D%","volume","") . " " . ReadingsTimestamp("%D%","volume","");;}', -# ], -# 7 => [ # water -# # fhem commands to execute -# 'attr %D% userreading volume:1:value { ReadingsVal("%D%","1:value",0) . " " . ReadingsVal("%D%","1:unit","");; }', -# 'attr %D% stateformat {ReadingsVal("%D%","volume","") . " " . ReadingsTimestamp("%D%","volume","");;}', -# ], -# -# } -#); - - sub WMBUS_Parse($$); sub WMBUS_SetReadings($$$); sub WMBUS_SetRSSI($$$); @@ -306,15 +282,18 @@ sub WMBUS_SetReadings($$$) my $dataBlock; for $dataBlock ( @$dataBlocks ) { - readingsBulkUpdate($hash, "$dataBlock->{number}:storage_no", $dataBlock->{storageNo}); - readingsBulkUpdate($hash, "$dataBlock->{number}:type", $dataBlock->{type}); - readingsBulkUpdate($hash, "$dataBlock->{number}:value", $dataBlock->{value}); - readingsBulkUpdate($hash, "$dataBlock->{number}:unit", $dataBlock->{unit}); + readingsBulkUpdate($hash, "$dataBlock->{number}_storage_no", $dataBlock->{storageNo}); + readingsBulkUpdate($hash, "$dataBlock->{number}_type", $dataBlock->{type}); + readingsBulkUpdate($hash, "$dataBlock->{number}_value", $dataBlock->{value}); + readingsBulkUpdate($hash, "$dataBlock->{number}_unit", $dataBlock->{unit}); if ($dataBlock->{errormsg}) { - readingsBulkUpdate($hash, "$dataBlock->{number}:errormsg", $dataBlock->{errormsg}); + readingsBulkUpdate($hash, "$dataBlock->{number}_errormsg", $dataBlock->{errormsg}); } } - } + readingsBulkUpdate($hash, "battery", $mb->{status} & 4 ? "low" : "ok"); + + WMBUS_SetDeviceSpecificReadings($hash, $name, $mb); + } readingsBulkUpdate($hash, "is_encrypted", $mb->{isEncrypted}); readingsBulkUpdate($hash, "decryption_ok", $mb->{decrypted}); @@ -330,6 +309,27 @@ sub WMBUS_SetReadings($$$) } +sub WMBUS_SetDeviceSpecificReadings($$$) +{ + my ($hash, $name, $mb) = @_; + + if ($mb->{manufacturer} eq 'FFD') { + # Fast Forward AG + if ($mb->{afield_ver} == 1) { + #EnergyCam + if ($mb->{afield_type} == 2) { + # electricity + readingsBulkUpdate($hash, "energy", ReadingsVal($name, "1_value", 0) / 1000); + readingsBulkUpdate($hash, "unit", "kWh"); + } elsif ($mb->{afield_type} == 3 || $mb->{afield_type} == 7) { + # gas/water + readingsBulkUpdate($hash, "volume", ReadingsVal($name, "1_value", 0)); + readingsBulkUpdate($hash, "unit", "m³"); + } + } + } +} + ##################################### sub WMBUS_Set($@) @@ -459,9 +459,9 @@ WMBUS_Attr(@) The readings are generated in blocks starting with block 1. A meter can send several data blocks. Each block has at least a type, a value and a unit, e.g. for an electricity meter it might look like

There is also a fixed set of readings. @@ -469,7 +469,9 @@ WMBUS_Attr(@)
  • is_encrypted is 1 if the received message is encrypted.
  • decryption_ok is 1 if a message has either been successfully decrypted or if it is unencrypted.
  • state contains the state of the meter and may contain error message like battery low. Normally it contains 'no error'.
  • +
  • battery contains ok or low. + For some well known devices specific readings like the energy consumption in kWh created. @@ -564,9 +566,9 @@ WMBUS_Attr(@) Die Readings werden als Block dargestellt, beginnend mit Block 1. Ein Zähler kann mehrere Blöcke senden. Jeder Block enthält zumindest einen Typ, einen Wert und eine Einheit. Für einen Elektrizitätszähler könnte das z. B. so aussehen

    Es gibt auch eine Anzahl von festen Readings. @@ -574,7 +576,9 @@ WMBUS_Attr(@)
  • is_encrypted ist 1 wenn die empfangene Nachricht verschlüsselt ist.
  • decryption_ok ist 1 wenn die Nachricht entweder erfolgreich entschlüsselt wurde oder gar nicht verschlüsselt war.
  • state enthält den Status des Zählers und kann Fehlermeldungen wie 'battery low' enthalten. Normalerweise ist der Wert 'no error'.
  • +
  • battery enthält ok oder low. + Für einige bekannte Gerätetypen werden zusätzliche Readings wie der Energieverbrauch in kWh erzeugt.