tomrosenback / botvac

PHP library for Neato Botvac
GNU General Public License v2.0
38 stars 21 forks source link

Question how to use commands #7

Closed CooperCGN closed 7 years ago

CooperCGN commented 7 years ago

Hi, I hope you can help me. I just installed the scripts on my home server and tried the demo client.php script which seems to work as I get the screen output of four arrays for my two neatos (robot info and schedule).

Now I just want to start both of them instead of getting that info. What would I need to put into the foreach loop. I assume it's the startCleaning() command but I can't get it work. How do I pass the requested robot?

foreach ($robots as $robot) { -> what goes here }

Cheers Anatol

tomrosenback commented 7 years ago

Hi!

In it simplest form it should be like this, however I you have more than more robot you need to be sure you are doing actions on the right robot by checking the ID of the bot.

foreach($robots as $robot) { $robot->startCleaning(); }

CooperCGN commented 7 years ago

That's basically what I did. $robot gives me two arrays with the serial and secret of my two Neatos, I then pasted one of those into the robot.php but get an error that the robot cannot be found in my account.

print_r returns this: Array ( [message] => Could not find robot_serial for specified vendor_name )

tomrosenback commented 7 years ago

in the bottom foreach in the client.php file, change it to

foreach($robots as $robot) { $robot->startCleaning(); }

and both of the bots should start cleaning.

CooperCGN commented 7 years ago

That's what I did at first, still nothing happens. I wonder if it has something to do with the robot model which are two D5 connected.

What's weird is that the getState() works as it returns the following for each of the robots.

Array
(
    [version] => 1
    [reqId] => 1
    [result] => ok
    [data] => Array
        (
        )

    [error] => 
    [alert] => 
    [state] => 1
    [action] => 0
    [cleaning] => Array
        (
            [category] => 2
            [mode] => 2
            [modifier] => 1
            [navigationMode] => 1
            [spotWidth] => 0
            [spotHeight] => 0
        )

    [details] => Array
        (
            [isCharging] => 
            [isDocked] => 1
            [isScheduleEnabled] => 
            [dockHasBeenSeen] => 
            [charge] => 100
        )

    [availableCommands] => Array
        (
            [start] => 1
            [stop] => 
            [pause] => 
            [resume] => 
            [goToBase] => 
        )

    [availableServices] => Array
        (
            [findMe] => basic-1
            [generalInfo] => basic-1
            [houseCleaning] => minimal-2
            [IECTest] => basic-1
            [localStats] => advanced-1
            [logCopy] => basic-1
            [preferences] => basic-1
            [schedule] => minimal-1
            [softwareUpdate] => basic-1
            [spotCleaning] => minimal-2
            [wifi] => basic-1
        )

    [meta] => Array
        (
            [modelName] => BotVacD5Connected
            [firmware] => 3.1.0-673
        )

)