Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device change state timeout error #13

Open
Elio-Chedid opened this issue Mar 25, 2024 · 0 comments
Open

Device change state timeout error #13

Elio-Chedid opened this issue Mar 25, 2024 · 0 comments

Comments

@Elio-Chedid
Copy link

I cloned the repo into my directory and executed the code:
import ewelink
from ewelink import Client, DeviceOffline

@ewelink.login('password', 'user.address@email.com')
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
async def main(client: Client):
File "c:\Users\ElioChedid\Desktop\sonoffff\ewelink-api-python\ewelink\client.py", line 94, in decorator
result = asyncio.get_event_loop().run_until_complete(f(client))
File "C:\Users\ElioChedid\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 641, in run_until_complete
return future.result()
File "c:\Users\ElioChedid\Desktop\sonoffff\ewelink-api-python\test.py", line 23, in main
await device.on()
File "c:\Users\ElioChedid\Desktop\sonoffff\ewelink-api-python\ewelink\models\device.py", line 86, in edit
await self._state.ws.update_device_status(self.id, **params)
File "c:\Users\ElioChedid\Desktop\sonoffff\ewelink-api-python\ewelink\ws.py", line 82, in update_device_status
result = await asyncio.wait_for(fut, timeout = 10)
File "C:\Users\ElioChedid\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 458, in wait_for
raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant