klali / ha-plejd

Plejd component for Home Assistant
Apache License 2.0
69 stars 16 forks source link

Error doing job: Future exception was never retrieved #6

Closed BertilJ closed 5 years ago

BertilJ commented 5 years ago

I had everything working, but then I decided to upgrade the code with the latest from the component. Now I'm getting error messages.

Running Hass.io 0.96.3 on nuc, other BLE is working fine (MiFlora).

This I'm getting during startup:

Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/plejd/light.py", line 297, in _start_plejd
    connect(plejdinfo)
  File "/config/custom_components/plejd/light.py", line 127, in connect
    devs = sorted(list(scanner.scan(1)), key=lambda d: d.rssi)[::-1]
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 854, in scan
    self.stop()
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 803, in stop
    self._mgmtCmd(self._cmd()+"end")
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 309, in _mgmtCmd
    rsp = self._waitResp('mgmt')
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 362, in _waitResp
    raise BTLEDisconnectError("Device disconnected", resp)
bluepy.btle.BTLEDisconnectError: Device disconnected

When trying to operate a light I'm getting this:

'handles'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service
    connection.context(msg))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1150, in async_call
    self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1172, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 295, in async_handle_light_on_service
    await light.async_turn_on(**pars)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/plejd/light.py", line 106, in turn_on
    plejd_write(pi, pi["handles"]["data"], plejd_enc_dec(pi["key"], pi["address"], payload))
KeyError: 'handles'

Sorry for being a pain in the ass reporting issues on something that is in early development, but I'm really excited for this integration, that's the last thing I need to have full control of my home through HA.

BertilJ commented 5 years ago

Did a fresh install, and restored everything except HA and now Plejd is working without error messages.

Issue closed.

klali commented 5 years ago

No worries, open issues for problems.