2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 04:36:36 +00:00

74_XXiaomiBTLSens: Thermo/HydroSense new state format, new Readings batteryState and batteryPercent

git-svn-id: https://svn.fhem.de/fhem/trunk@16857 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
LeonGaultier 2018-06-13 06:46:04 +00:00
parent 81e9fb9d10
commit 025b1bf35c
2 changed files with 13 additions and 6 deletions

View File

@ -1,5 +1,7 @@
# 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: 74_XXiaomiBTLSens: Thermo/HydroSense new state format, new Reading
batteryState and batteryPercent
- change: 49_SSCamSTRM: new attribute "forcePageRefresh" for better control
of page refresh (for e.g. Floorplan,Dashboard)
- feature: 89_FULLY: Added screen saver commands.

View File

@ -50,7 +50,7 @@ eval "use Blocking;1" or $missingModul .= "Blocking ";
#use Data::Dumper; only for Debugging
my $version = "2.0.13";
my $version = "2.0.14";
@ -656,8 +656,8 @@ sub XiaomiBTLESens_FlowerSensHandle0x38($$) {
my @dataBatFw = split(" ",$notification);
$readings{'batteryLevel'} = hex("0x".$dataBatFw[0]);
$readings{'battery'} = (hex("0x".$dataBatFw[0]) > 15 ? "ok" : "low");
#$readings{'batteryLevel'} = hex("0x".$dataBatFw[0]);
#$readings{'battery'} = (hex("0x".$dataBatFw[0]) > 15 ? "ok" : "low");
### neue Vereinheitlichung für Batteriereadings Forum #800017
$readings{'batteryPercent'} = hex("0x".$dataBatFw[0]);
$readings{'batteryState'} = (hex("0x".$dataBatFw[0]) > 15 ? "ok" : "low");
@ -711,8 +711,11 @@ sub XiaomiBTLESens_ThermoHygroSensHandle0x18($$) {
chomp($notification);
$readings{'batteryLevel'} = hex("0x".$notification);
$readings{'battery'} = (hex("0x".$notification) > 15 ? "ok" : "low");
#$readings{'batteryLevel'} = hex("0x".$notification);
#$readings{'battery'} = (hex("0x".$notification) > 15 ? "ok" : "low");
### neue Vereinheitlichung für Batteriereadings Forum #800017
$readings{'batteryPercent'} = hex("0x".$notification);
$readings{'batteryState'} = (hex("0x".$notification) > 15 ? "ok" : "low");
$hash->{helper}{CallBattery} = 1;
XiaomiBTLESens_CallBattery_Timestamp($hash);
@ -797,7 +800,9 @@ sub XiaomiBTLESens_WriteReadings($$) {
readingsBulkUpdate($hash,$r,$v);
}
readingsBulkUpdateIfChanged($hash, "state", ($readings->{'lastGattError'}?'error':'active'));
readingsBulkUpdateIfChanged($hash, "state", ($readings->{'lastGattError'}?'error':'active')) if( AttrVal($name,'model','none') eq 'flowerSens' );
readingsBulkUpdateIfChanged($hash, "state", ($readings->{'lastGattError'}?'error':'T: '.ReadingsVal($name,'temperature',0).' H: '.ReadingsVal($name,'humidity',0)) ) if( AttrVal($name,'model','none') eq 'thermoHygroSens' );
readingsEndUpdate($hash,1);