2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-17 05:16:02 +00:00

70_BOTVAC.pm: added state "Password missing", added check for robots in account

git-svn-id: https://svn.fhem.de/fhem/trunk@20276 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
vuffiraa 2019-09-29 16:07:12 +00:00
parent e6199d93f5
commit e3012aefaa
2 changed files with 19 additions and 7 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: 70_BOTVAC: new state "Password missing",
added check for robots in account
- bugfix: 95_Dashboard: fix warnings
- change: 88_Timer: spelling mistake
- bufix: 93_DbRep: fix readingRename without leading device Forum: #104024,

View File

@ -32,6 +32,7 @@ use warnings;
sub BOTVAC_Initialize($) {
my ($hash) = @_;
our $readingFnAttributes;
$hash->{DefFn} = "BOTVAC::Define";
$hash->{GetFn} = "BOTVAC::Get";
@ -44,7 +45,7 @@ sub BOTVAC_Initialize($) {
$hash->{AttrList} = "disable:0,1 " .
"actionInterval " .
"boundaries:textField-long " .
$::readingFnAttributes;
$readingFnAttributes;
}
package BOTVAC;
@ -147,7 +148,8 @@ sub Define($$) {
$hash->{INTERVAL} = $interval;
unless ( defined( AttrVal( $name, "webCmd", undef ) ) ) {
$::attr{$name}{webCmd} = 'startCleaning:stop:sendToBase';
no warnings "once";
$::attr{$name}{webCmd} = 'startCleaning:stop:sendToBase';
}
# start the status update timer
@ -692,7 +694,10 @@ sub SendCommand($$;$$@) {
$header .= "\r\nContent-Type: application/json";
if ($service eq "sessions") {
return if (!defined($password));
if (!defined($password)) {
readingsSingleUpdate($hash, "state", "Password missing (see instructions)",1);
return;
}
my $token = createUniqueId() . createUniqueId();
$URL .= GetBeehiveHost($hash->{VENDOR});
$URL .= "/sessions";
@ -1186,10 +1191,15 @@ sub ReceiveCommand($$$) {
push(@robotList, $r);
}
$hash->{helper}{ROBOTS} = \@robotList;
SetRobot($hash, ReadingsNum($name, "robot", 0));
push(@successor , ["robots", "maps"]);
if (@robotList) {
SetRobot($hash, ReadingsNum($name, "robot", 0));
push(@successor , ["robots", "maps"]);
} else {
Log3($name, 3, "BOTVAC $name: no robots found");
Log3($name, 4, "BOTVAC $name: drop successors");
LogSuccessors($hash, @successor);
@successor = ();
}
}
}
}