augustofagioli / ewelinkapiphp
API connector for Sonoff/eWeLink devices
Fund package maintenance!
Buy Me A Coffee
Requires
- php: >=7.4
- ext-hash: *
- ext-json: *
This package is auto-updated.
Last update: 2025-07-07 06:34:17 UTC
README
Install by composer
composer require pjanisio/ewelink-api-php
eWeLink API PHP is a connector for Sonoff / eWeLink devices. This library allows you to interact with your eWeLink-enabled devices from your browser.
Requirements
- PHP 7.4+
Current features
- get all devices list with their parameters using deviceId or deviceName from ewelink app
- saving devices data and other outputs from API to .json
- search for any value of each device (f.e switch status, productName, MAC etc.)
- set any parameter/state of device using HTTP gateway or websockets
- set parameter for multi-channel devices (like 4CH Pro)
- update power parameters like current, voltage, power for electricity monitoring devices
- debug all requests and responses to debug.log
Documentation
Go to Wiki Pages to get started read about possible methods.
Example
This is a single case example to turn on device.
Look at Wiki Pages to get knowledge of how to start and other methods.
<?php $deviceId = 'your_device_id'; $params = ['switch' => 'on']; $statusUpdateResult = $devices->setDeviceStatus($deviceId, $params); echo $statusUpdateResult;
Ready to deploy Device Monitoring application
Please see example app written based on this class that checks and update chosen parameters in real time (using asynchronous calls) using both HTTP and websocket method alltogether.
Tech info
Visit wiki page for devs: devs-wiki