PHP code example of ggottwald / miio

1. Go to this page and download the library: Download ggottwald/miio library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ggottwald / miio example snippets


// mir robot vacuum
$robotDeviceName = 'mirobot_vacuum';
$robotToken = '00112233445566778899aabbccddeeff';

$miRobot = Factory::miRobot($robotDeviceName, $robotToken);

// start cleaning
$miRobot->start();

// get status
var_export($miRobot->status());

// air purifier
$purifierDeviceName = 'air_purifier';
$purifierToken = '00112233445566778899aabbccddeeff';

$purifier = Factory::airPurifier($purifierDeviceName, $purifierToken);

$purifier->setPower(true);