antriver / energenie-mihome-api
1.0.0
2020-09-27 15:20 UTC
Requires
- php: >7.0.0
- guzzlehttp/guzzle: ^7.1
Requires (Dev)
- phpunit/phpunit: ^9.3
This package is auto-updated.
Last update: 2024-10-28 00:39:30 UTC
README
A PHP library to interfacing with the Enegenie Mi|Home API for Energenie smart home devices.
Note: This is not for Xiaomi devices, which are called a similar name.
Currently it supports very few actions. You can list subdevices and turn them on or off.
Usage
Installation
composer require antriver/energenie-mihome-api
Example Use
<?php
use Antriver\EnergenieMihomeApi\Entities\Subdevice;
require __DIR__.'/vendor/autoload.php';
$api = new \Antriver\EnergenieMihomeApi\MihomeApi('email', 'password');
$subdevices = $api->listAllSubdevices();
print_r($subdevices);
$fairyLights = array_values(
array_filter(
$subdevices,
function (Subdevice $subdevice) {
return $subdevice->label === 'Fairy Lights';
}
)
)[0];
$api->powerOnSubdevice($fairyLights->id);
sleep(5);
$api->powerOffSubdevice($fairyLights->id);