mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
module: 38_JawboneUp: Patch by My-FHEM: additional readings for awakenings, light, time_to_sleep,bedtime, deep ,awake
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@8364 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1b1971def8
commit
2e7a23a1c9
@ -68,7 +68,7 @@ jawboneUp_Define($$)
|
|||||||
my $user = $a[2];
|
my $user = $a[2];
|
||||||
my $password = $a[3];
|
my $password = $a[3];
|
||||||
|
|
||||||
$hash->{"module_version"} = "0.1.2";
|
$hash->{"module_version"} = "0.1.3";
|
||||||
|
|
||||||
$hash->{user}=$user;
|
$hash->{user}=$user;
|
||||||
$hash->{password}=$password;
|
$hash->{password}=$password;
|
||||||
@ -174,6 +174,11 @@ sub jawboneUp_DoBackground($)
|
|||||||
my $li=$score->{"move"}{"longest_idle"};
|
my $li=$score->{"move"}{"longest_idle"};
|
||||||
|
|
||||||
my $aw=$score->{"sleep"}{"awake"};
|
my $aw=$score->{"sleep"}{"awake"};
|
||||||
|
my $ak=$score->{"sleep"}{"awakenings"};
|
||||||
|
my $lt=$score->{"sleep"}{"light"};
|
||||||
|
my $ts=$score->{"sleep"}{"time_to_sleep"};
|
||||||
|
my $bt=$score->{"sleep"}{"goals"}{"bedtime"}[0];
|
||||||
|
my $dp=$score->{"sleep"}{"goals"}{"deep"}[0];
|
||||||
my $as=$score->{"sleep"}{"goals"}{"total"}[0];
|
my $as=$score->{"sleep"}{"goals"}{"total"}[0];
|
||||||
|
|
||||||
# Second expensive call for band events
|
# Second expensive call for band events
|
||||||
@ -214,7 +219,7 @@ sub jawboneUp_DoBackground($)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "OK|$na|$st|$ca|$di|$bc|$bd|$at|$li|$aw|$as|$sl|$sw";
|
return "OK|$na|$st|$ca|$di|$bc|$bd|$at|$li|$aw|$as|$sl|$sw|$ak|$lt|$ts|$bt|$dp";
|
||||||
}
|
}
|
||||||
#Error: API doesn't return any information about errors...
|
#Error: API doesn't return any information about errors...
|
||||||
my $na=$hash->{NAME};
|
my $na=$hash->{NAME};
|
||||||
@ -262,7 +267,7 @@ sub jawboneUp_DoneBackground($)
|
|||||||
$hash->{STATE} = "Connect-failure, retries: ".$hash->{"API_Failures"};
|
$hash->{STATE} = "Connect-failure, retries: ".$hash->{"API_Failures"};
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (@a < 13) {
|
if (@a < 18) {
|
||||||
print ("Internal error at DoneBackground (0x003).\n");
|
print ("Internal error at DoneBackground (0x003).\n");
|
||||||
$hash->{STATE} = "Disconnected - disabled";
|
$hash->{STATE} = "Disconnected - disabled";
|
||||||
$attr{$hash->{NAME}}{"disable"} = 1;
|
$attr{$hash->{NAME}}{"disable"} = 1;
|
||||||
@ -286,6 +291,13 @@ sub jawboneUp_DoneBackground($)
|
|||||||
|
|
||||||
updReading($hash,"sleep_mode",$a[11]);
|
updReading($hash,"sleep_mode",$a[11]);
|
||||||
updReading($hash,"stopwatch_mode",$a[12]);
|
updReading($hash,"stopwatch_mode",$a[12]);
|
||||||
|
|
||||||
|
updReading($hash,"awakenings",$a[13]);
|
||||||
|
updReading($hash,"light",$a[14]);
|
||||||
|
updReading($hash,"time_to_sleep",$a[15]);
|
||||||
|
updReading($hash,"bedtime",$a[16]);
|
||||||
|
updReading($hash,"deep",$a[17]);
|
||||||
|
|
||||||
readingsEndUpdate($hash, 1);
|
readingsEndUpdate($hash, 1);
|
||||||
|
|
||||||
$hash->{LAST_POLL} = FmtDateTime( gettimeofday() );
|
$hash->{LAST_POLL} = FmtDateTime( gettimeofday() );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user