diff --git a/fhem/CHANGED b/fhem/CHANGED index ee973271f..c59ccab1c 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: Add MA 10860 - change: 93_DbRep: NOTE: !! syntax of set ... changeValue" is changed !! - feature: 10_RHASSPY: new module for Rhasspy integration (from contrib) - bugfix: 73_AutoShuttersControl: fix can't locate object method after update diff --git a/fhem/FHEM/50_MOBILEALERTSGW.pm b/fhem/FHEM/50_MOBILEALERTSGW.pm index 8e4b76b94..875a7524f 100644 --- a/fhem/FHEM/50_MOBILEALERTSGW.pm +++ b/fhem/FHEM/50_MOBILEALERTSGW.pm @@ -97,7 +97,12 @@ sub MOBILEALERTSGW_Get ($$@) { my $destpaddr; my $command; - if ( $gateway =~ /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/ ) { + if ( !defined($gateway)) { + $gateway = "000000000000"; + $destpaddr = sockaddr_in( 8003, INADDR_BROADCAST ); + $command = 1; + } + elsif ( $gateway =~ /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/ ) { $destpaddr = sockaddr_in( 8003, inet_aton($gateway) ); $gateway = "000000000000"; $command = 1; diff --git a/fhem/FHEM/51_MOBILEALERTS.pm b/fhem/FHEM/51_MOBILEALERTS.pm index a88e3c9dd..571a4a135 100644 --- a/fhem/FHEM/51_MOBILEALERTS.pm +++ b/fhem/FHEM/51_MOBILEALERTS.pm @@ -256,7 +256,7 @@ sub MOBILEALERTS_Parse ($$) { if ( defined &$sub ) { #no strict "refs"; - &{ \&$sub }( $hash, substr $message, 12, $packageLength - 12 ); + &{ \&$sub }( $hash, substr($message, 12, $packageLength - 12), substr($message, 12)); #use strict "refs"; MOBILEALERTS_readingsBulkUpdate( $hash, 0, "lastMsg", @@ -305,14 +305,14 @@ sub MOBILEALERTS_Parse ($$) { return $res; } -sub MOBILEALERTS_Parse_02_ce ($$) { - my ( $hash, $message ) = @_; +sub MOBILEALERTS_Parse_02_ce ($$$) { + my ( $hash, $message, $messagefull ) = @_; MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType", "MA10100/MA10101" ); - MOBILEALERTS_Parse_ce( $hash, $message ); + MOBILEALERTS_Parse_ce( $hash, $message, $messagefull ); } -sub MOBILEALERTS_Parse_15_ce ($$) { +sub MOBILEALERTS_Parse_15_ce ($$$) { my ( $hash, $message ) = @_; MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType", "MA10880" ); @@ -373,7 +373,7 @@ sub MOBILEALERTS_Parse_15_ce ($$) { "$channel $state_name" ); } -sub MOBILEALERTS_Parse_ce ($$) { +sub MOBILEALERTS_Parse_ce ($$$) { my ( $hash, $message ) = @_; my ( $txCounter, $temperature, $prevTemperature ) = unpack( "nnn", $message ); @@ -397,7 +397,7 @@ sub MOBILEALERTS_Parse_ce ($$) { MOBILEALERTS_readingsBulkUpdate( $hash, 0, "state", "T: " . $temperature ); } -sub MOBILEALERTS_Parse_0f_d2 ($$) { +sub MOBILEALERTS_Parse_0f_d2 ($$$) { my ( $hash, $message ) = @_; my ( $txCounter, $temperatureIn, $temperatureOut, $prevTemperatureIn, $prevTemperatureOut ) @@ -436,14 +436,14 @@ sub MOBILEALERTS_Parse_0f_d2 ($$) { "In T: " . $temperatureIn . " Out T: " . $temperatureOut ); } -sub MOBILEALERTS_Parse_03_d2 ($$) { - my ( $hash, $message ) = @_; +sub MOBILEALERTS_Parse_03_d2 ($$$) { + my ( $hash, $message, $messagefull ) = @_; MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType", "MA10200" ); - MOBILEALERTS_Parse_d2( $hash, $message ); + MOBILEALERTS_Parse_d2( $hash, $message, $messagefull ); } -sub MOBILEALERTS_Parse_d2 ($$) { +sub MOBILEALERTS_Parse_d2 ($$$) { my ( $hash, $message ) = @_; my ( $txCounter, $temperature, $humidity, $prevTemperature, $prevHumidity ) = unpack( "nnnnn", $message ); @@ -476,14 +476,14 @@ sub MOBILEALERTS_Parse_d2 ($$) { "T: " . $temperature . " H: " . $humidity ); } -sub MOBILEALERTS_Parse_04_d4 ($$) { - my ( $hash, $message ) = @_; +sub MOBILEALERTS_Parse_04_d4 ($$$) { + my ( $hash, $message, $messagefull ) = @_; MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType", "MA10350" ); - MOBILEALERTS_Parse_d4( $hash, $message ); + MOBILEALERTS_Parse_d4( $hash, $message, $messagefull ); } -sub MOBILEALERTS_Parse_d4 ($$) { +sub MOBILEALERTS_Parse_d4 ($$$) { my ( $hash, $message ) = @_; my ( $txCounter, $temperature, $humidity, $wetness, $prevTemperature, $prevHumidity, $prevWetness ) @@ -521,7 +521,7 @@ sub MOBILEALERTS_Parse_d4 ($$) { "T: " . $temperature . " H: " . $humidity . " " . $wetness ); } -sub MOBILEALERTS_Parse_05_da ($$) { +sub MOBILEALERTS_Parse_05_da ($$$) { my ( $hash, $message ) = @_; MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType", "WL2000" ); @@ -579,14 +579,14 @@ sub MOBILEALERTS_Parse_05_da ($$) { . $co2 ); } -sub MOBILEALERTS_Parse_07_da ($$) { - my ( $hash, $message ) = @_; +sub MOBILEALERTS_Parse_07_da ($$$) { + my ( $hash, $message, $messagefull ) = @_; MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType", "MA10410" ); - MOBILEALERTS_Parse_da( $hash, $message ); + MOBILEALERTS_Parse_da( $hash, $message, $messagefull ); } -sub MOBILEALERTS_Parse_da ($$) { +sub MOBILEALERTS_Parse_da ($$$) { my ( $hash, $message ) = @_; my ( $txCounter, $temperatureIn, $humidityIn, @@ -632,7 +632,7 @@ sub MOBILEALERTS_Parse_da ($$) { . $humidityOut ); } -sub MOBILEALERTS_Parse_18_e0 ($$) { +sub MOBILEALERTS_Parse_18_e0 ($$$) { my ( $hash, $message ) = @_; my ( $txCounter, $txCounter2, $temperature, $humidity, $airPressure ) = unpack( "nCnCn", $message ); @@ -665,14 +665,14 @@ sub MOBILEALERTS_Parse_18_e0 ($$) { "T: " . $temperature . " H: " . $humidity . " A: " . $airPressure ); } -sub MOBILEALERTS_Parse_08_e1 ($$) { - my ( $hash, $message ) = @_; +sub MOBILEALERTS_Parse_08_e1 ($$$) { + my ( $hash, $message, $messagefull ) = @_; MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType", "MA10650" ); - MOBILEALERTS_Parse_e1( $hash, $message ); + MOBILEALERTS_Parse_e1( $hash, $message, $messagefull ); } -sub MOBILEALERTS_Parse_e1 ($$) { +sub MOBILEALERTS_Parse_e1 ($$$) { my ( $hash, $message ) = @_; my @eventTime; ( my ( $txCounter, $temperature, $eventCounter ), @eventTime[ 0 .. 8 ] ) = @@ -735,14 +735,14 @@ sub MOBILEALERTS_Parse_e1 ($$) { "T: " . $temperature . " C: " . $eventCounter ); } -sub MOBILEALERTS_Parse_0b_e2 ($$) { - my ( $hash, $message ) = @_; +sub MOBILEALERTS_Parse_0b_e2 ($$$) { + my ( $hash, $message, $messagefull ) = @_; MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType", "MA10660" ); - MOBILEALERTS_Parse_e2( $hash, $message ); + MOBILEALERTS_Parse_e2( $hash, $message, $messagefull ); } -sub MOBILEALERTS_Parse_e2 ($$) { +sub MOBILEALERTS_Parse_e2 ($$$) { my ( $hash, $message ) = @_; my @dirTable = ( "N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", @@ -771,14 +771,14 @@ sub MOBILEALERTS_Parse_e2 ($$) { "D: " . $dirTable[$dir] . " W: " . $windSpeed . " G: " . $gustSpeed ); } -sub MOBILEALERTS_Parse_0e_d8 ($$) { - my ( $hash, $message ) = @_; +sub MOBILEALERTS_Parse_0e_d8 ($$$) { + my ( $hash, $message, $messagefull ) = @_; MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType", "TFA30.3312.02" ); - MOBILEALERTS_Parse_d8( $hash, $message ); + MOBILEALERTS_Parse_d8( $hash, $message, $messagefull ); } -sub MOBILEALERTS_Parse_d8 ($$) { +sub MOBILEALERTS_Parse_d8 ($$$) { my ( $hash, $message ) = @_; my ( $txCounter, $temperature, $humidity, $prevTemperature, @@ -822,14 +822,14 @@ sub MOBILEALERTS_Parse_d8 ($$) { "T: " . $temperature . " H: " . $humidity ); } -sub MOBILEALERTS_Parse_10_d3 ($$) { - my ( $hash, $message ) = @_; +sub MOBILEALERTS_Parse_10_d3 ($$$) { + my ( $hash, $message, $messagefull ) = @_; MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType", "MA10800" ); - MOBILEALERTS_Parse_d3( $hash, $message ); + MOBILEALERTS_Parse_d3( $hash, $message, $messagefull ); } -sub MOBILEALERTS_Parse_d3 ($$) { +sub MOBILEALERTS_Parse_d3 ($$$) { my ( $hash, $message ) = @_; my @data; ( my ($txCounter), @data[ 0 .. 3 ] ) = unpack( "nnnnn", $message ); @@ -861,14 +861,14 @@ sub MOBILEALERTS_Parse_d3 ($$) { } } -sub MOBILEALERTS_Parse_12_d9 ($$) { - my ( $hash, $message ) = @_; +sub MOBILEALERTS_Parse_12_d9 ($$$) { + my ( $hash, $message, $messagefull ) = @_; MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType", "MA10230" ); - MOBILEALERTS_Parse_d9( $hash, $message ); + MOBILEALERTS_Parse_d9( $hash, $message, $messagefull ); } -sub MOBILEALERTS_Parse_d9 ($$) { +sub MOBILEALERTS_Parse_d9 ($$$) { my ( $hash, $message ) = @_; my ( $txCounter, $humidity3h, $humidity24h, $humidity7d, @@ -922,21 +922,21 @@ sub MOBILEALERTS_Parse_d9 ($$) { . $humidity30d ); } -sub MOBILEALERTS_Parse_06_d6 ($$) { - my ( $hash, $message ) = @_; +sub MOBILEALERTS_Parse_06_d6 ($$$) { + my ( $hash, $message, $messagefull ) = @_; MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType", "MA10300/MA10700" ); - MOBILEALERTS_Parse_d6( $hash, $message ); + MOBILEALERTS_Parse_d6( $hash, $message, $messagefull ); } -sub MOBILEALERTS_Parse_09_d6 ($$) { - my ( $hash, $message ) = @_; +sub MOBILEALERTS_Parse_09_d6 ($$$) { + my ( $hash, $message, $messagefull ) = @_; MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType", "MA10320PRO" ); - MOBILEALERTS_Parse_d6( $hash, $message ); + MOBILEALERTS_Parse_d6( $hash, $message, $messagefull ); } -sub MOBILEALERTS_Parse_d6 ($$) { +sub MOBILEALERTS_Parse_d6 ($$$) { my ( $hash, $message ) = @_; my ( $txCounter, $temperatureIn, $temperatureOut, $humidityIn, $prevTemperatureIn, $prevTemperatureOut, $prevHumidityIn ) @@ -986,7 +986,7 @@ sub MOBILEALERTS_Parse_d6 ($$) { . $temperatureOut ); } -sub MOBILEALERTS_Parse_01_d2 ($$) { +sub MOBILEALERTS_Parse_01_d2 ($$$) { my ( $hash, $message ) = @_; my ( $txCounter, $temperatureIn, $temperatureOut, $prevTemperatureIn, $prevTemperatureOut ) @@ -1025,14 +1025,14 @@ sub MOBILEALERTS_Parse_01_d2 ($$) { "In T: " . $temperatureIn . " Out T: " . $temperatureOut ); } -sub MOBILEALERTS_Parse_11_ea ($$) { - my ( $hash, $message ) = @_; +sub MOBILEALERTS_Parse_11_ea ($$$) { + my ( $hash, $message, $messagefull ) = @_; MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType", "TFA30.3060.01.IT" ); - MOBILEALERTS_Parse_ea( $hash, $message ); + MOBILEALERTS_Parse_ea( $hash, $message, $messagefull ); } -sub MOBILEALERTS_Parse_ea ($$) { +sub MOBILEALERTS_Parse_ea ($$$) { my ( $hash, $message ) = @_; my ( $txCounter, $temperature1, $humidity1, @@ -1160,6 +1160,50 @@ sub MOBILEALERTS_Parse_ea ($$) { . $humidity3 ); } +sub MOBILEALERTS_Parse_0a_cb($$$) { + my ( $hash, $message, $messagefull ) = @_; + my ( $txCounter, $temperature ) = + unpack( "nn", $messagefull ); + + MOBILEALERTS_readingsBulkUpdateIfChanged( $hash, 0, "deviceType", + "MA 10860" ); + + # Alarm + my $alarm_ch1 = "off"; + my $alarm_ch2 = "off"; + my $alarm_ch3 = "off"; + my $alarm_ch4 = "off"; + $alarm_ch1 = "on" if( ($temperature & 0x8000) == 0x8000); + $alarm_ch2 = "on" if( ($temperature & 0x4000) == 0x4000); + $alarm_ch3 = "on" if( ($temperature & 0x2000) == 0x2000); + $alarm_ch4 = "on" if( ($temperature & 0x1000) == 0x1000); + + MOBILEALERTS_readingsBulkUpdate( $hash, 0, "alarm1", $alarm_ch1); + MOBILEALERTS_readingsBulkUpdate( $hash, 0, "alarm2", $alarm_ch2); + MOBILEALERTS_readingsBulkUpdate( $hash, 0, "alarm3", $alarm_ch3); + MOBILEALERTS_readingsBulkUpdate( $hash, 0, "alarm4", $alarm_ch4); + # Oberen Bits werden fuer Alarm benutzt + $temperature = $temperature & 0x0fff; + + # txCounter + MOBILEALERTS_readingsBulkUpdate( $hash, 0, "txCounter", + MOBILEALERTS_decodeTxCounter($txCounter) ); + MOBILEALERTS_readingsBulkUpdate( $hash, 0, "triggered", + MOBILEALERTS_triggeredTxCounter($txCounter) ); + MOBILEALERTS_readingsBulkUpdate( $hash, 0, "batteryState", + MOBILEALERTS_batteryStateTxCounter($txCounter) ); + # temperature + $temperature = + MOBILEALERTS_decodeTemperature($temperature) + + $hash->{".corrTemperature"}; + MOBILEALERTS_readingsBulkUpdate( $hash, 0, "temperature", $temperature ); + MOBILEALERTS_readingsBulkUpdate( $hash, 0, "temperatureString", + MOBILEALERTS_temperatureToString($temperature) ); + # state + MOBILEALERTS_readingsBulkUpdate( $hash, 0, "state", "T: " . $temperature . + " " . $alarm_ch1 . " " . $alarm_ch2 ." " . $alarm_ch3 . " " . $alarm_ch4); +} + sub MOBILEALERTS_decodeTxCounter($) { my ($txCounter) = @_; return $txCounter & 0x3FFF; @@ -1508,7 +1552,7 @@ 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, MA10101, MA10200, MA10230, MA10300, MA10650, MA10320PRO, MA10350, MA10410, MA10450, MA10660, MA10700, TFA 30.3312.02, MA10800, WL2000, TFA30.3060.01.IT, MA10120PRO, MA10880
+ Currently supported: MA10100, MA10101, MA10200, MA10230, MA10238, MA10300, MA10650, MA10320PRO, MA10350, MA10410, MA10450, MA10660, MA10700, TFA 30.3312.02, MA10800, WL2000, TFA30.3060.01.IT, MA10120PRO, MA10860, MA10880
Supported but untested: ./.

@@ -1557,9 +1601,10 @@ sub MOBILEALERTS_ActionDetector($) {
  • lastEvent, lastEvent<X> ,lastEventString, lastEvent<X>String
    Time when last event (rain) happend (MA10650 only).
  • mmRain, mmRainActHour, mmRainLastHour, mmRainActDay, mmRainYesterday
    Rain since reset of counter, current hour, last hour, current day, yesterday.
  • direction, directionInt
    Direction of wind.
  • -
  • windSpeed, gustSpeed
    Windspeed.
  • +
  • windSpeed, gustSpeed
    Windspeed in m/s.
  • airPressure
    Barometric pressure in hPa
  • airPressureString
    Barometric pressure as String
  • +
  • alarm1, alarm2, alarm3, alarm4
    Active Alarms (values: on/off)

  • @@ -1607,8 +1652,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, MA10101, MA10200, MA10230, MA10300, MA10650, MA10320PRO, MA10350, MA10410, MA10450, MA10660, MA10700, TFA 30.3312.02, MA10800, WL2000, TFA30.3060.01.IT, MA10120PRO, MA10880
    - Unterstüzt aber ungetestet: MA10238
    + Aktuell werden unterstüzt: MA10100, MA10101, MA10200, MA10238, MA10230, MA10300, MA10650, MA10320PRO, MA10350, MA10410, MA10450, MA10660, MA10700, TFA 30.3312.02, MA10800, WL2000, TFA30.3060.01.IT, MA10120PRO, MA10860, MA10880
    + Unterstüzt aber ungetestet: ./.

    @@ -1656,9 +1701,10 @@ sub MOBILEALERTS_ActionDetector($) {
  • lastEvent, lastEvent<X> ,lastEventString, lastEvent<X>String
    Zeitpunkt wann das letzte Event (Regen) stattgefunden hat (nur MA10650).
  • mmRain, mmRainActHour, mmRainLastHour, mmRainActDay, mmRainYesterday
    Regen seit dem letzten Reset des Counters, in der aktuellen Stunde, seit der letzten Stunden, am aktuellen Tagn, gestern.
  • direction, directionInt
    Richtung des Winds.
  • -
  • windSpeed, gustSpeed
    Windgeschwindigkeit.
  • +
  • windSpeed, gustSpeed
    Windgeschwindigkeit in m/s.
  • airPressure
    Luftdruck in hPa
  • airPressureString
    Luftdruck in hPa als Zeichenkette
  • +
  • alarm1, alarm2, alarm3, alarm4
    Aktive Alarme (Werte: on/off)