kukkjanos/ewelink

This package is abandoned and no longer maintained. No replacement package was suggested.

EWeLink Smart Home API Methods

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

This package is auto-updated.

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


README

Installation using [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) );