2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

GFPROBT: fix timer weekdays

git-svn-id: https://svn.fhem.de/fhem/trunk@20085 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
dominikkarall 2019-08-31 20:28:15 +00:00
parent 3eacd88eeb
commit 4390d9a8fb

View File

@ -330,8 +330,8 @@ sub GFPROBT_execGatttool($) {
$json{"timer".$i."-Weekdays"} = "-"; $json{"timer".$i."-Weekdays"} = "-";
} }
my %timers; my %timers;
my @timerHnd = ("0x0017", "0x0019", "0x001b", "0x001d", "0x001f", "0x0021", "0x0023", "0x0025", "0x0027", "0x0029", my @timerHnd = ("0x0017", "0x0019", "0x001b", "0x001d", "0x001f", "0x0021", "0x0023", "0x0031", "0x0025", "0x0027", "0x0029",
"0x002b", "0x002d", "0x002f", "0x0031"); "0x002b", "0x002d", "0x002f");
my $stop = 0; my $stop = 0;
foreach my $hnd (@timerHnd) { foreach my $hnd (@timerHnd) {
if ($stop == 1) { if ($stop == 1) {
@ -419,10 +419,12 @@ sub GFPROBT_execGatttool($) {
$json{'watering'} = GFPROBT_convertHexToInt($hash, $hash->{gattProc}->exp_after()); $json{'watering'} = GFPROBT_convertHexToInt($hash, $hash->{gattProc}->exp_after());
} }
if ($json{'watering'} == 1) { if (defined($json{'watering'})) {
$json{'state'} = 'on'; if ($json{'watering'} == 1) {
} else { $json{'state'} = 'on';
$json{'state'} = 'off'; } else {
$json{'state'} = 'off';
}
} }
$hash->{gattProc}->send("disconnect"); $hash->{gattProc}->send("disconnect");
@ -465,6 +467,7 @@ sub GFPROBT_convertHexToTimer($$) {
my $weekday = $day[int($seconds/(3600*24))]; my $weekday = $day[int($seconds/(3600*24))];
my $hour = int(($seconds%(3600*24))/3600); my $hour = int(($seconds%(3600*24))/3600);
my $minutes = int(($seconds%(3600*24) - $hour*3600) / 60); my $minutes = int(($seconds%(3600*24) - $hour*3600) / 60);
Log3 $hash, 3, "Seconds from Monday: ".$seconds.", ".$weekday."\n";
$seconds = $seconds%60; $seconds = $seconds%60;
my $duration = unpack "I", pack "H*", join("", @hexarr[4,5])."0000"; my $duration = unpack "I", pack "H*", join("", @hexarr[4,5])."0000";
return ($weekday, $hour, $minutes, $duration); return ($weekday, $hour, $minutes, $duration);