SonoffBasic allows to control Sonoff switches via the Ewelink cloud, with a very basic features.
⚠️ Project was tested on sonoff basic only. Other devices will be tested and adjust in the future.
>>> from SonoffBasic.sonoff import Sonoff
>>> sonoff = Sonoff(username='my_name@example.com',
password='my_pass',
timezone='US/Pacific',
region='us')
Search the required device
>>> print(sonoff.devices)
[{'name': 'taco', 'deviceid': '1000157898', 'outletid': 0, 'status': 'on'},
{'name': 'Irrigation', 'deviceid': '100015b23r', 'outletid': 0, 'status': 'off'}]
>>> sonoff.change_device_status(deviceid = '1000157898',
new_status = 'off',
outletid = 0
)
deviceid: 1000157898 status successfully changed to off
Thanks to @AlexxIT. cloud connection to eWeLink was inspired by SonoffLAN project.