ewelink-api-python
ewelink-api-python copied to clipboard
Device change state timeout error
I cloned the repo into my directory and executed the code: import ewelink from ewelink import Client, DeviceOffline
@ewelink.login('password', '[email protected]') async def main(client: Client): print(client.region) print(client.user.info) print(client.devices)
device = client.get_device('XXXXX') #single channel device
print(device.params)
#Raw device specific properties
#can be accessed easily like: device.params.switch or device.params['startup'] (a subclass of dict)
print(device.state)
print(device.created_at)
print("Brand Name:", device.brand.name, "Logo URL:", device.brand.logo.url)
print("Device online?", device.online)
try:
await device.on()
except DeviceOffline:
print("Device is offline!")
I was able to print the device param but when it comes to changing the device state (device.on) it generates a timeout error: Params( version = 8 demNextFetchTime = 1711404000000 current = 11 voltage = 23227 power = 823 fwVersion = '1.1.0' uiActive = 60 ssid = '!#%$#%^&$#^&^%#@#$&' bssid = 'a0:f3:c1:35:60:16' timeZone = 2 dayKwh = 7 monthKwh = 10 switches = [Object( switch = 'on' outlet = 0 )] configure = [Object( startup = 'off' outlet = 0 )] pulses = [Object( pulse = 'off' switch = 'off' outlet = 0 width = 500 )] sledOnline = 'on' staMac = '08:D1:F9:E4:73:AC' rssi = -38 getHoursKwh = Gethourskwh( start = 0 end = 0 ) threshold = Threshold( actPow = Actpow( min = 10 max = 500000 ) voltage = Voltage( min = 16500 max = 27700 ) current = Current( min = 10 max = 2100 ) ) overload_00 = Overload_00( minAP = Minap( en = 0 val = 10 ) maxAP = Maxap( en = 1 val = 500000 ) minV = Minv( en = 0 val = 16500 ) maxV = Maxv( en = 0 val = 27700 ) maxC = Maxc( en = 1 val = 2100 ) minC = Minc( en = 0 val = 10 ) ) operSide = 1 ) Traceback (most recent call last): File "C:\Users\ElioChedid\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 456, in wait_for return fut.result() asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\Users\ElioChedid\Desktop\sonoffff\ewelink-api-python\test.py", line 7, in
PLZ how you install ewelink,i face problem with it