2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-01 01:09:47 +00:00

30_pilight_temp: new reading battery, attribut corrTemp

git-svn-id: https://svn.fhem.de/fhem/trunk@8585 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
risiko79 2015-05-16 08:54:47 +00:00
parent ee3e271ab6
commit c53e0c5c32
3 changed files with 27 additions and 6 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # 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. # Do not insert empty lines here, update check depends on it.
- feature: 30_pilight_temp: reading battery state, attribut corrTemp to correct temperature
- change: 73_km200: Wrong SwitchProgram time format fixed - change: 73_km200: Wrong SwitchProgram time format fixed
- feature: 73_km200: SwitchPrograms can be written/changed - feature: 73_km200: SwitchPrograms can be written/changed
- change: MSGMail: Improve error logging to assist problem solving - change: MSGMail: Improve error logging to assist problem solving

View File

@ -1,5 +1,5 @@
############################################## ##############################################
# $Id: 10_pilight_ctrl.pm 1.00 2015-05-09 Risiko $ # $Id: 10_pilight_ctrl.pm 1.02 2015-05-16 Risiko $
# #
# Usage # Usage
# #
@ -25,6 +25,7 @@
# V 0.51 2015-04-29 - CHG: rename attribute ignore to ignoreProtocol because with ignore the whole device is ignored in FHEMWEB # V 0.51 2015-04-29 - CHG: rename attribute ignore to ignoreProtocol because with ignore the whole device is ignored in FHEMWEB
# V 1.00 2015-05-09 - NEW: white list for defined submodules activating by ignoreProtocol * # V 1.00 2015-05-09 - NEW: white list for defined submodules activating by ignoreProtocol *
# V 1.01 2015-05-09 - NEW: add quigg_gt* protocol (e.q quigg_gt7000) # V 1.01 2015-05-09 - NEW: add quigg_gt* protocol (e.q quigg_gt7000)
# V 1.02 2015-05-16 - NEW: battery state for temperature sensors
############################################## ##############################################
package main; package main;
@ -718,7 +719,9 @@ sub pilight_ctrl_Parse($$)
return if ($temp eq ""); return if ($temp eq "");
my $humidity = (defined($data->{$s}{humidity})) ? $data->{$s}{humidity} : ""; my $humidity = (defined($data->{$s}{humidity})) ? $data->{$s}{humidity} : "";
my $msg = "PITEMP,$proto,$id,$temp,$humidity"; my $battery = (defined($data->{$s}{battery})) ? $data->{$s}{battery} : "";
my $msg = "PITEMP,$proto,$id,$temp,$humidity,$battery";
return Dispatch($hash, $msg,undef); return Dispatch($hash, $msg,undef);
} }
else {Log3 $me, 3, "$me(Parse): unknown protocol -> $proto"; return;} else {Log3 $me, 3, "$me(Parse): unknown protocol -> $proto"; return;}

View File

@ -1,5 +1,5 @@
############################################## ##############################################
# $Id: 20_pilight_temp.pm 0.11 2015-03-29 Risiko $ # $Id: 20_pilight_temp.pm 0.12 2015-05-16 Risiko $
# #
# Usage # Usage
# #
@ -9,6 +9,8 @@
# #
# V 0.10 2015-03-29 - initial beta version # V 0.10 2015-03-29 - initial beta version
# V 0.11 2015-03-29 - FIX: $readingFnAttributes # V 0.11 2015-03-29 - FIX: $readingFnAttributes
# V 0.12 2015-05-16 - NEW: reading battery
# V 0.12 2015-05-16 - NEW: attribut corrTemp, a factor to modify temperatur
############################################## ##############################################
package main; package main;
@ -29,7 +31,7 @@ sub pilight_temp_Initialize($)
$hash->{DefFn} = "pilight_temp_Define"; $hash->{DefFn} = "pilight_temp_Define";
$hash->{Match} = "^PITEMP"; $hash->{Match} = "^PITEMP";
$hash->{ParseFn} = "pilight_temp_Parse"; $hash->{ParseFn} = "pilight_temp_Parse";
$hash->{AttrList} = $readingFnAttributes; $hash->{AttrList} = "corrTemp ".$readingFnAttributes;
} }
##################################### #####################################
@ -67,7 +69,7 @@ sub pilight_temp_Parse($$)
Log3 $backend, 4, "pilight_temp_Parse: RCV -> $rmsg"; Log3 $backend, 4, "pilight_temp_Parse: RCV -> $rmsg";
my ($dev,$protocol,$id,$temp,$humidity,@args) = split(",",$rmsg); my ($dev,$protocol,$id,$temp,$humidity,$battery,@args) = split(",",$rmsg);
return () if($dev ne "PITEMP"); return () if($dev ne "PITEMP");
my $chash; my $chash;
@ -82,10 +84,14 @@ sub pilight_temp_Parse($$)
return () if (!defined($chash->{NAME})); return () if (!defined($chash->{NAME}));
my $corrTemp = AttrVal($chash->{NAME}, "corrTemp",1);
$temp = $temp * $corrTemp;
readingsBeginUpdate($chash); readingsBeginUpdate($chash);
readingsBulkUpdate($chash,"state",$temp); readingsBulkUpdate($chash,"state",$temp);
readingsBulkUpdate($chash,"temperature",$temp); readingsBulkUpdate($chash,"temperature",$temp);
readingsBulkUpdate($chash,"humidity",$humidity) if (defined($humidity) && $humidity ne ""); readingsBulkUpdate($chash,"humidity",$humidity) if (defined($humidity) && $humidity ne "");
readingsBulkUpdate($chash,"battery",$battery) if (defined($battery) && $battery ne "");
readingsEndUpdate($chash, 1); readingsEndUpdate($chash, 1);
return $chash->{NAME}; return $chash->{NAME};
@ -133,8 +139,19 @@ sub pilight_temp_Parse($$)
humidity<br> humidity<br>
present the current humidity (if sensor support it) present the current humidity (if sensor support it)
</li> </li>
<li>
battery<br>
present the battery state of the senor (if sensor support it)
</li>
</ul> </ul>
<br> <br>
<a name="pilight_temp_attr"></a>
<b>Attributes</b>
<ul>
<li><a name="corrTemp">corrTemp</a><br>
A factor (e.q. 0.1) to correct the temperture value. Default: 1
</li>
</ul>
</ul> </ul>
=end html =end html