Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

With one Mi Flora timout error not sending MQTT update for any other device #95

Closed
kobush opened this issue Aug 24, 2019 · 3 comments
Closed

Comments

@kobush
Copy link

kobush commented Aug 24, 2019

I have four Mi Flora device currently configured. When one of them is out of reach and BT connection timeouts the whole status_update process is stopped and no MQTT update is sent for any device.

I think it should rather execute each device independent of each other, then send normal updates for devices that can be connected and error report for any disconnected device.

Running on Raspberry Pi Zero W with Raspbian Stretch Lite

2019-08-24 09:00:16,345 INFO bt-mqtt-gw.workers.miflora miflora.py:76:status_update - Updating 4 miflora devices
2019-08-24 09:00:16,349 DEBUG bt-mqtt-gw.workers.miflora miflora.py:79:status_update - Updating miflora device 'avocado' (C4:7C:8D:6B:27:9F)
2019-08-24 09:00:20,231 DEBUG bt-mqtt-gw.workers.miflora miflora.py:79:status_update - Updating miflora device 'sansevieria_lower' (C4:7C:8D:6B:23:D3)
2019-08-24 09:00:29,330 DEBUG bt-mqtt-gw.workers.miflora miflora.py:79:status_update - Updating miflora device 'sansevieria_upper' (C4:7C:8D:6B:18:DC)
2019-08-24 09:00:39,860 DEBUG bt-mqtt-gw.workers.miflora miflora.py:79:status_update - Updating miflora device 'zamioculcas' (C4:7C:8D:6B:27:94)
2019-08-24 09:00:51,347 ERROR bt-mqtt-gw logger.py:48:log_exception - Execution of command MifloraWorker.status_update timed out after 35 seconds
Traceback (most recent call last):
  File "gateway.py", line 51, in <module>
    mqtt.publish(_WORKERS_QUEUE.get(timeout=10).execute())
  File "/home/pi/bt-mqtt-gateway/workers_manager.py", line 34, in execute
    messages = self._callback(*self._args)
  File "/home/pi/bt-mqtt-gateway/workers/miflora.py", line 82, in status_update
    ret += self.update_device_state(name, data["poller"])
  File "/home/pi/bt-mqtt-gateway/workers/miflora.py", line 91, in update_device_state
    ret.append(MqttMessage(topic=self.format_topic(name, attr), payload=poller.parameter_value(attr)))
  File "/home/pi/bt-mqtt-gateway/.venv/lib/python3.5/site-packages/miflora/miflora_poller.py", line 132, in parameter_value
    self.fill_cache()
  File "/home/pi/bt-mqtt-gateway/.venv/lib/python3.5/site-packages/miflora/miflora_poller.py", line 61, in fill_cache
    firmware_version = self.firmware_version()
  File "/home/pi/bt-mqtt-gateway/.venv/lib/python3.5/site-packages/miflora/miflora_poller.py", line 103, in firmware_version
    with self._bt_interface.connect(self._mac) as connection:
  File "/home/pi/bt-mqtt-gateway/.venv/lib/python3.5/site-packages/btlewrap/base.py", line 44, in __enter__
    self._backend.connect(self._mac)
  File "/home/pi/bt-mqtt-gateway/.venv/lib/python3.5/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
    return func(*args, **kwargs)
  File "/home/pi/bt-mqtt-gateway/.venv/lib/python3.5/site-packages/btlewrap/bluepy.py", line 55, in connect
    self._peripheral = Peripheral(mac, iface=iface)
  File "/home/pi/bt-mqtt-gateway/.venv/lib/python3.5/site-packages/bluepy/btle.py", line 391, in __init__
    self._connect(deviceAddr, addrType, iface)
  File "/home/pi/bt-mqtt-gateway/.venv/lib/python3.5/site-packages/bluepy/btle.py", line 436, in _connect
    rsp = self._getResp('stat')
  File "/home/pi/bt-mqtt-gateway/.venv/lib/python3.5/site-packages/bluepy/btle.py", line 407, in _getResp
    resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
  File "/home/pi/bt-mqtt-gateway/.venv/lib/python3.5/site-packages/bluepy/btle.py", line 347, in _waitResp
    rv = self._helper.stdout.readline()
  File "/home/pi/bt-mqtt-gateway/.venv/lib/python3.5/site-packages/interruptingcow/__init__.py", line 74, in handler
    raise exception
TimeoutError: Execution of command MifloraWorker.status_update timed out after 35 seconds
@lb20
Copy link

lb20 commented Aug 29, 2019

This seems to be the same issue as #65 . I too have this issue and am eagerly awaiting a fix.

@zewelor
Copy link
Owner

zewelor commented Aug 29, 2019

This should be fixed in #96. Please test it

@zewelor
Copy link
Owner

zewelor commented Sep 3, 2019

Closing as it should be fixed in newest code.

@zewelor zewelor closed this as completed Sep 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants