diff --git a/fhem/CHANGED b/fhem/CHANGED index 614996be5..48eefb6d1 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. + - Bugfix: CUL_TCM97001: Add temperature trend, update documentation - feature: new fhemweb widgets. see widgetOverride in commandref - Bugfix: 73_km200 - Fix for get-command responding with false error message - Feature: 73_km200 - Get and Set command blocked during initialisation process diff --git a/fhem/FHEM/14_CUL_TCM97001.pm b/fhem/FHEM/14_CUL_TCM97001.pm index 3e3405a52..17df3bc39 100755 --- a/fhem/FHEM/14_CUL_TCM97001.pm +++ b/fhem/FHEM/14_CUL_TCM97001.pm @@ -12,7 +12,7 @@ # - "GT-WT-02" # - "AURIOL" # -# Unsupported models are saved in an device named CUL_TCM97001_Unknown +# Unsupported models are saved in a device named CUL_TCM97001_Unknown # # Copyright (C) 2015 Bjoern Hempel # @@ -201,9 +201,11 @@ CUL_TCM97001_Parse($$) my $hashumidity = FALSE; my $hasbatcheck = FALSE; my $hastrend = FALSE; + my $haschannel = FALSE; my $model="Unknown"; my $temp = undef; my $humidity=undef; + my $channel = undef; if (length($msg) == 8) { # Only tmp TCM device @@ -373,6 +375,7 @@ CUL_TCM97001_Parse($$) if($def) { $name = $def->{NAME}; } + $channel = (hex($a[2])) & 0x3; $temp = (hex($a[3].$a[4].$a[5])) & 0x3FF; my $negative = (hex($a[3])) & 0xC; if ($negative == 0xC) { @@ -390,7 +393,8 @@ CUL_TCM97001_Parse($$) return "UNDEFINED CUL_TCM97001_$idType1 CUL_TCM97001 $idType1" if(!$def); } $hashumidity = TRUE; - $hasbatcheck = TRUE; + $hasbatcheck = TRUE; + $haschannel = TRUE; $packageOK = TRUE; $model="GT-WT-02"; $readedModel=$model; @@ -401,7 +405,6 @@ CUL_TCM97001_Parse($$) #Log3 $name, 4, "CUL_TCM97001: CRC for TCM21.... Failed, checking other protocolls"; # Check for Prologue if ($readedModel eq "Prologue" || (hex($a[0]) == 0x9 && $readedModel eq "Unknown")) { - # Log3 $name, 2, "ccccccccccccccccccccccccccccc"; # Protocol prologue start everytime with 1001 # e.g. 91080F614C 1001 0001 0000 1000 0000 1111 0110 0001 0100 1100 # A B C D E F G H I @@ -429,7 +432,7 @@ CUL_TCM97001_Parse($$) $humidity = hex($a[7].$a[8]); } - + $channel = (hex($a[3])) & 0x3; $batbit = (hex($a[3]) & 0x8) >> 3; $mode = (hex($a[3]) & 0x4) >> 2; if (checkValues($temp, $humidity)) { @@ -442,6 +445,7 @@ CUL_TCM97001_Parse($$) $hashumidity = TRUE; $hasbatcheck = TRUE; $packageOK = TRUE; + $haschannel = TRUE; $model="Prologue"; $readedModel=$model; } else { @@ -476,8 +480,8 @@ CUL_TCM97001_Parse($$) $temp = -$temp; } $temp = $temp / 10; - - $hashumidity = TRUE; + + $channel = (hex($a[3])) & 0x3; $humidity = hex($a[7].$a[8]) & 0x7F; $batbit = (hex($a[3]) & 0x8) >> 3; @@ -493,6 +497,7 @@ CUL_TCM97001_Parse($$) $hashumidity = TRUE; $hasbatcheck = TRUE; $packageOK = TRUE; + $haschannel = TRUE; $model="NC_WS"; $readedModel=$model; } else { @@ -609,19 +614,25 @@ CUL_TCM97001_Parse($$) readingsBulkUpdate($def, "state", $state); if($hastrend) { + my $readTrend = ReadingsVal($name, "trend", "unknown"); if ($trend == 1) { - readingsBulkUpdate($def, "trend", "falling"); + if ($readTrend ne "falling") { readingsBulkUpdate($def, "trend", "falling"); } } else { - readingsBulkUpdate($def, "trend", "rising"); + if ($readTrend ne "rising") { readingsBulkUpdate($def, "trend", "rising"); } } } if ($hasbatcheck) { + my $battery = ReadingsVal($name, "battery", "unknown"); if ($batbit) { - readingsBulkUpdate($def, "battery", "low"); + if ($battery ne "low") { readingsBulkUpdate($def, "battery", "low"); } } else { - readingsBulkUpdate($def, "battery", "ok"); + if ($battery ne "ok") { readingsBulkUpdate($def, "battery", "ok"); } } } + if ($haschannel) { + my $readChannel = ReadingsVal($name, "channel", undef); + if ($readChannel ne $channel) { readingsBulkUpdate($def, "channel", $channel); } + } readingsBulkUpdate($def, $msgtype, $val); if ($hashumidity == TRUE) { readingsBulkUpdate($def, $msgtypeH, $valH); @@ -640,7 +651,7 @@ CUL_TCM97001_Parse($$) return "UNDEFINED CUL_TCM97001_Unknown CUL_TCM97001 Unknown" if(!$defUnknown); } $name = $defUnknown->{NAME}; - Log3 $name, 4, "CUL_TCM97001 Device not interplmeted yet name Unknown msg $msg"; + Log3 $name, 4, "CUL_TCM97001 Device not implemented yet name Unknown msg $msg"; my $state="Code: $msg"; @@ -677,25 +688,124 @@ CUL_TCM97001_Parse($$)

CUL_TCM97001