此包已被 废弃 且不再维护。没有建议的替代包。

EWeLink 智能家居 API 方法

v1.1 2019-04-02 17:54 UTC

This package is auto-updated.

Last update: 2020-08-31 00:37:53 UTC


README

使用 [Composer] 进行安装

$ composer require kukkjanos/ewelink
<?php

require_once __DIR__ . '/vendor/autoload.php';

$options = [
    'auth' => [
        'email'    => 'eWelink login email',
        //'phone'    => '+361234567', # email or phone login parameter
        'password' => 'eWelink login password',
        'region'   => 'eu'
    ],
    'settings' => [
        'cachedir' => './cache', // Token cache directory
        'cachetime' => 3600, // The expiration time, defaults to 3600
        
    ]
];

// Init configuration
$config = new EWeLink\Api\Config($options);

// Init API
$api = new EWeLink\Api\EWeApi($config);

// All device
print_r( $api->getDevices() );

// One device
$deviceId = 'xyz';
print_r( $api->getDevice($deviceId) );

// Toogle device
//print_r( $api->toggleDevice($deviceId) );