sbidy / pywizlight

A python connector for WiZ devices
MIT License
463 stars 79 forks source link

If a request is retried, the response may arrive after the next message is sent #135

Closed bdraco closed 2 years ago

bdraco commented 2 years ago
2022-02-20 14:19:14 DEBUG (MainThread) [pywizlight.bulb] 192.168.107.98: >> b'{"method":"getModelConfig","params":{}}' (1/6) backoff=0.0
2022-02-20 14:19:15 DEBUG (MainThread) [pywizlight.bulb] 192.168.107.98: >> b'{"method":"getModelConfig","params":{}}' (2/6) backoff=0.75
2022-02-20 14:19:16 DEBUG (MainThread) [pywizlight.bulb] 192.168.107.98: << b'{"method":"getModelConfig","env":"pro","error":{"code":-32601,"message":"Method not found"}}'
2022-02-20 14:19:16 DEBUG (MainThread) [pywizlight.bulb] 192.168.107.98: >> b'{"method":"getUserConfig","params":{}}' (1/6) backoff=0.0
2022-02-20 14:19:16 DEBUG (MainThread) [pywizlight.bulb] 192.168.107.98: << b'{"method":"getModelConfig","env":"pro","error":{"code":-32601,"message":"Method not found"}}'
2022-02-20 14:19:16 DEBUG (MainThread) [pywizlight.bulb] 192.168.107.98: << b'{"method":"getUserConfig","env":"pro","result":{"fadeIn":500,"fadeOut":500,"dftDim":100,"pwmRange":[0,100],"whiteRange":[2700,6500],"extRange":[2200,6500],"opMode":0,"po":true}}'
2022-02-20 14:19:16 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/Users/bdraco/home-assistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/Users/bdraco/home-assistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/Users/bdraco/home-assistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/Users/bdraco/home-assistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
    return await handler(request)
  File "/Users/bdraco/home-assistant/homeassistant/components/http/auth.py", line 219, in auth_middleware
    return await handler(request)
  File "/Users/bdraco/home-assistant/homeassistant/components/http/view.py", line 137, in handle
    result = await result
  File "/Users/bdraco/home-assistant/homeassistant/components/config/config_entries.py", line 164, in post
    return await super().post(request, flow_id)
  File "/Users/bdraco/home-assistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/Users/bdraco/home-assistant/homeassistant/helpers/data_entry_flow.py", line 111, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/Users/bdraco/home-assistant/homeassistant/data_entry_flow.py", line 252, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/Users/bdraco/home-assistant/homeassistant/data_entry_flow.py", line 325, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/Users/bdraco/home-assistant/homeassistant/components/wiz/config_flow.py", line 94, in async_step_discovery_confirm
    await self._async_connect_discovered_or_abort()
  File "/Users/bdraco/home-assistant/homeassistant/components/wiz/config_flow.py", line 72, in _async_connect_discovered_or_abort
    bulbtype = await bulb.get_bulbtype()
  File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/pywizlight/bulb.py", line 545, in get_bulbtype
    white_range = await self.getExtendedWhiteRange()
  File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/pywizlight/bulb.py", line 587, in getExtendedWhiteRange
    resp = await self.getUserConfig()
  File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/pywizlight/bulb.py", line 691, in getUserConfig
    return await self.send({"method": "getUserConfig", "params": {}})
  File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/pywizlight/bulb.py", line 709, in send
    return await self.sendUDPMessage(to_wiz_json(message))
  File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/pywizlight/bulb.py", line 746, in sendUDPMessage
    raise WizLightMethodNotFound("Method not found; maybe older bulb FW?")
pywizlight.exceptions.WizLightMethodNotFound: Method not found; maybe older bulb FW?