From 41e147ae3e9f98303a3fc258ffe2b86c76808cd4 Mon Sep 17 00:00:00 2001
From: MarkusF <>
Date: Sun, 7 Jan 2018 16:23:41 +0000
Subject: [PATCH] 51_MOBILEALERTS.pm:Added Sensor WL2000
git-svn-id: https://svn.fhem.de/fhem/trunk@15815 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/CHANGED | 1 +
fhem/FHEM/51_MOBILEALERTS.pm | 70 +++++++++++++++++++++++++++++++++---
2 files changed, 67 insertions(+), 4 deletions(-)
diff --git a/fhem/CHANGED b/fhem/CHANGED
index 9a120b240..24168decb 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.
+ - feature: 51_MOBILEALERTS: Added Sensor WL2000
- change: 93_DbRep: V7.3.0, charfilter avoid control characters in datasets
to export, function exportToFile importFromFile improved
- feature: FHEMWEB: new style f18
diff --git a/fhem/FHEM/51_MOBILEALERTS.pm b/fhem/FHEM/51_MOBILEALERTS.pm
index 1f1c0b26c..b50f0e501 100644
--- a/fhem/FHEM/51_MOBILEALERTS.pm
+++ b/fhem/FHEM/51_MOBILEALERTS.pm
@@ -336,6 +336,55 @@ sub MOBILEALERTS_Parse_d4 ($$) {
"T: " . $temperature . " H: " . $humidity . " " . $wetness );
}
+sub MOBILEALERTS_Parse_05_da ($$) {
+ my ( $hash, $message ) = @_;
+ MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType",
+ "WL2000" );
+ my ( $txCounter, $temperatureOut, $temperatureIn, $humidityIn, $co2,
+ $prevTemperatureOut, $prevTemperatureIn, $prevHumidityIn )
+ = unpack( "nnnnnnnn", $message );
+
+ MOBILEALERTS_readingsBulkUpdate( $hash, 0, "txCounter",
+ MOBILEALERTS_decodeTxCounter($txCounter) );
+ MOBILEALERTS_readingsBulkUpdate( $hash, 0, "triggered",
+ MOBILEALERTS_triggeredTxCounter($txCounter) );
+ $temperatureIn = MOBILEALERTS_decodeTemperature($temperatureIn);
+ MOBILEALERTS_readingsBulkUpdate( $hash, 0, "temperatureIn",
+ $temperatureIn );
+ MOBILEALERTS_readingsBulkUpdate( $hash, 0, "temperatureStringIn",
+ MOBILEALERTS_temperatureToString($temperatureIn) );
+ $temperatureOut = MOBILEALERTS_decodeTemperature($temperatureOut);
+ MOBILEALERTS_readingsBulkUpdate( $hash, 0, "temperatureOut",
+ $temperatureOut );
+ MOBILEALERTS_readingsBulkUpdate( $hash, 0, "temperatureStringOut",
+ MOBILEALERTS_temperatureToString($temperatureOut) );
+ $humidityIn = MOBILEALERTS_decodeHumidity($humidityIn);
+ MOBILEALERTS_readingsBulkUpdate( $hash, 0, "humidity", $humidityIn );
+ MOBILEALERTS_readingsBulkUpdate( $hash, 0, "humidityString",
+ MOBILEALERTS_humidityToString($humidityIn) );
+ $co2 = MOBILEALERTS_decodeCO2($co2);
+ MOBILEALERTS_readingsBulkUpdate( $hash, 0, "co2", $co2 );
+ MOBILEALERTS_readingsBulkUpdate( $hash, 0, "co2String",
+ MOBILEALERTS_cO2ToString($co2) );
+ $prevTemperatureIn = MOBILEALERTS_decodeTemperature($prevTemperatureIn);
+ MOBILEALERTS_readingsBulkUpdate( $hash, 1, "prevTemperatureIn",
+ $prevTemperatureIn );
+ $prevTemperatureOut = MOBILEALERTS_decodeTemperature($prevTemperatureOut);
+ MOBILEALERTS_readingsBulkUpdate( $hash, 1, "prevTemperatureOut",
+ $prevTemperatureOut );
+ $prevHumidityIn = MOBILEALERTS_decodeHumidity($prevHumidityIn);
+ MOBILEALERTS_readingsBulkUpdate( $hash, 1, "prevHumidityIn",
+ $prevHumidityIn );
+ MOBILEALERTS_readingsBulkUpdate( $hash, 0, "state",
+ "In T: "
+ . $temperatureIn . " H: "
+ . $humidityIn
+ . " Out T: "
+ . $temperatureOut
+ . " CO2: "
+ . $co2 );
+}
+
sub MOBILEALERTS_Parse_07_da ($$) {
my ( $hash, $message ) = @_;
MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType",
@@ -718,6 +767,18 @@ sub MOBILEALERTS_humidityToString($) {
return $humidity . "%";
}
+sub MOBILEALERTS_decodeCO2($) {
+ my ($co2) = @_;
+ return 9999 if ( ( $co2 & 0x80 ) == 0x80 );
+ return ( $co2 & 0x7F ) * 50;
+}
+
+sub MOBILEALERTS_cO2ToString($) {
+ my ($co2) = @_;
+ return "---" if ( $co2 == 9999 );
+ return $co2 . " ppm";
+}
+
sub MOBILEALERTS_decodeWetness($) {
my ($wetness) = @_;
@@ -813,6 +874,7 @@ sub MOBILEALERTS_time2sec($) {
sub MOBILEALERTS_CheckRainSensorTimed($) {
my ($hash) = @_;
+ $hash->{".expertMode"} = AttrVal( $hash->{NAME}, "expert", 0 );
readingsBeginUpdate($hash);
MOBILEALERTS_CheckRainSensor( $hash, 0 );
readingsEndUpdate( $hash, 1 );
@@ -971,8 +1033,8 @@ sub MOBILEALERTS_ActionDetector($) {
The MOBILEALERTS is a fhem module for the german MobileAlerts devices and TFA WEATHERHUB devices.
The fhem module represents a MobileAlerts device. The connection is provided by the MOBILELAERTSGW module.
- Currently supported: MA10100, MA10200, MA10230, MA10300, MA10650, MA10320PRO, MA10350, MA10410, MA10450, MA10660, MA10700, TFA 30.3312.02
- Supported but untested: MA10800
+ Currently supported: MA10100, MA10200, MA10230, MA10300, MA10650, MA10320PRO, MA10350, MA10410, MA10450, MA10660, MA10700, TFA 30.3312.02, MA10800, WL2000
+ Supported but untested: ./.
@@ -1050,8 +1112,8 @@ sub MOBILEALERTS_ActionDetector($) {
Dieses FHEM Modul stellt jeweils ein MobileAlerts Gerät dar. Die Verbindung wird durch das
MOBILELAERTSGW Modul bereitgestellt.
- Aktuell werden unterstüzt: MA10100, MA10200, MA10230, MA10300, MA10650, MA10320PRO, MA10350, MA10410, MA10450, MA10660, MA10700, TFA 30.3312.02
- Unterstüzt aber ungetestet: MA10800
+ Aktuell werden unterstüzt: MA10100, MA10200, MA10230, MA10300, MA10650, MA10320PRO, MA10350, MA10410, MA10450, MA10660, MA10700, TFA 30.3312.02, MA10800, WL2000
+ Unterstüzt aber ungetestet: ./.