ha-wyzesense icon indicating copy to clipboard operation
ha-wyzesense copied to clipboard

Ignoring non-OSError in worker thread. Please share the error logs with the developers.

Open atechnical opened this issue 4 years ago • 11 comments

Not sure what it means, the sensors appear to be working. I can tell you just prior I was removing sensors add re-adding them after having restarted the Proxmox virtual machine.

Log Details (ERROR) Logger: custom_components.wyzesense.wyzesense_custom Source: helpers/entity.py:416 Integration: wyzesense (documentation) First occurred: 5:48:06 PM (21 occurrences) Last logged: 6:06:18 PM

Ignoring non-OSError in worker thread. Please share the error logs with the developers. Traceback (most recent call last): File "/config/custom_components/wyzesense/wyzesense_custom.py", line 371, in _Worker self._HandlePacket(pkt) File "/config/custom_components/wyzesense/wyzesense_custom.py", line 344, in _HandlePacket handler(pkt) File "/config/custom_components/wyzesense/wyzesense_custom.py", line 269, in _OnSensorAlarm self.__on_event(self, e) File "/config/custom_components/wyzesense/binary_sensor.py", line 110, in on_event entities[event.MAC].schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 416, in schedule_update_ha_state assert self.hass is not None AssertionError

atechnical avatar Jul 19 '20 22:07 atechnical

I'm having the same error, although in my case the errors stop working until a restart the docker container from the docker daemon (vs. restarting home-assistant from inside the container)

carlos-sarmiento avatar Jul 22 '20 05:07 carlos-sarmiento

I'm having the same error. I'm running HA on a Virtual Box VM. I've restarted HA from the UI as well as restarted the VM, but cannot get these sensors started again.

EDIT: Looks like @PierreScerri is having the same issue in #145

clandestine-avocado avatar Jul 25 '20 00:07 clandestine-avocado

Same issue here. I'm running wyzesense on HA Core via Docker on Unraid. Tried restarting the docker container and still receive the error. Not sure what is causing the error but I just tried to add a sensor. HA notification said it was added but I don't see it in entities and I have this error in my logs: image

PixelDJ avatar Aug 14 '20 20:08 PixelDJ

Just got same error today.

Logger: custom_components.wyzesense.wyzesense_custom
Source: helpers/entity.py:407
Integration: wyzesense (documentation)
First occurred: 11:25:12 PM (1 occurrences)
Last logged: 11:25:12 PM

Ignoring non-OSError in worker thread. Please share the error logs with the developers.
Traceback (most recent call last):
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 373, in _Worker
    self._HandlePacket(pkt)
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 346, in _HandlePacket
    handler(pkt)
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 271, in _OnSensorAlarm
    self.__on_event(self, e)
  File "/config/custom_components/wyzesense/binary_sensor.py", line 110, in on_event
    entities[event.MAC].schedule_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 407, in schedule_update_ha_state
    assert self.hass is not None
AssertionError

firestrife23 avatar Sep 06 '20 04:09 firestrife23

I have it too - I'm running on HA v0.114.4 on HassOS. My sensors are not working in my HA automations, neither through native HA or Node-Red.

ERROR (Thread-3) [custom_components.wyzesense.wyzesense_custom] Ignoring non-OSError in worker thread. Please share the error logs with the developers. Traceback (most recent call last): File "/config/custom_components/wyzesense/wyzesense_custom.py", line 373, in _Worker self._HandlePacket(pkt) File "/config/custom_components/wyzesense/wyzesense_custom.py", line 346, in _HandlePacket handler(pkt) File "/config/custom_components/wyzesense/wyzesense_custom.py", line 271, in _OnSensorAlarm self.__on_event(self, e) File "/config/custom_components/wyzesense/binary_sensor.py", line 110, in on_event entities[event.MAC].schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 407, in schedule_update_ha_state assert self.hass is not None AssertionError

rdesmara avatar Sep 25 '20 01:09 rdesmara

Same here.

 [custom_components.wyzesense.wyzesense_custom] Ignoring non-OSError in worker thread. Please share the error logs with the developers.
Traceback (most recent call last):
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 373, in _Worker
    self._HandlePacket(pkt)
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 346, in _HandlePacket
    handler(pkt)
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 271, in _OnSensorAlarm
    self.__on_event(self, e)
  File "/config/custom_components/wyzesense/binary_sensor.py", line 110, in on_event
    entities[event.MAC].schedule_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 422, in schedule_update_ha_state
    assert self.hass is not None

Pizzaface avatar Sep 29 '20 16:09 Pizzaface

Okay, I have a small update here.

I was able to get both my motion and door sensors working again by doing the following steps. Granted - this is a possible temporary fix.

  1. Remove all sensors from your integration. I did this by adding the debug logging into the script, adding a few lines of code to see which MACs were registered, and removed them using wyzesense.remove. The logging config can be found in README.md, code is attached.

  2. Replace the binary_sensor.py code with the attached file

  3. Restart to reload the debug logging config and the new .py file

    • I updated the file to include the new debug logging things with prefixes:
      • EVENT MAC: the mac address of the sensor
      • CURRENT ENTITIES: the list of mac addresses registered and
      • ENTITY FOUND: when the system finds the MAC as registered
        • This is what was causing the errors seen above (see lines 113-115 in uploaded binary_sensor.py). It seemed like it's expecting a hass object there, but none is assigned, so I updated the code to assign the default hass instance provided to the setup_platform function; on_event's parent.
      • ENTITY NOT FOUND: when the system doesn't find the MAC as registered.
  4. I readded all my sensors using wyzesense.scan and it seemed to work, I'm able to use my sensors in automations again.

I'm not 100% sure if this will fix it long term, however I'll keep you updated.

binary_sensor.zip

Pizzaface avatar Sep 30 '20 17:09 Pizzaface

This just happened to me as well.

Traceback (most recent call last):
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 373, in _Worker
    self._HandlePacket(pkt)
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 346, in _HandlePacket
    handler(pkt)
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 271, in _OnSensorAlarm
    self.__on_event(self, e)
  File "/config/custom_components/wyzesense/binary_sensor.py", line 110, in on_event
    entities[event.MAC].schedule_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 422, in schedule_update_ha_state
    assert self.hass is not None
AssertionError

MagicMountainMan avatar Oct 12 '20 03:10 MagicMountainMan

I just had this happen to me on HA 0.115.5, ha-wyzesense 0.0.9 All sensors went unresponsive, a service scan did not fix the issue (but for some reason did reset the state of some sensors). I unplugged the dongle and restarted the VM twice to fix the issue - error gone and all sensors back. First time having any issue with any sensor or the integration.

mckochan avatar Oct 16 '20 18:10 mckochan

Same here, had this integration running flawless for months, and I got this issue just now on HA 0.116.2, wyzesense 0.0.9 Unplugging/replugging the dongle and restarting HA also fixed it for me. No more errors, and the sensors all back in HA.

Meelobee avatar Oct 18 '20 22:10 Meelobee

I have also been getting this type of error through several HA versions. All sensors working.

2020-12-06 11:41:03 ERROR (Thread-3) [custom_components.wyzesense.wyzesense_custom] Ignoring non-OSError in worker thread. Please share the error logs with the developers. Traceback (most recent call last): File "/config/custom_components/wyzesense/wyzesense_custom.py", line 373, in _Worker self._HandlePacket(pkt) File "/config/custom_components/wyzesense/wyzesense_custom.py", line 346, in _HandlePacket handler(pkt) File "/config/custom_components/wyzesense/wyzesense_custom.py", line 271, in _OnSensorAlarm self.__on_event(self, e) File "/config/custom_components/wyzesense/binary_sensor.py", line 110, in on_event entities[event.MAC].schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 422, in schedule_update_ha_state assert self.hass is not None AssertionError 2020-12-06 11:41:03 ERROR (Thread-3) [custom_components.wyzesense.wyzesense_custom] Ignoring non-OSError in worker thread. Please share the error logs with the developers. Traceback (most recent call last): File "/config/custom_components/wyzesense/wyzesense_custom.py", line 356, in _Worker s += self._ReadRawHID() File "/config/custom_components/wyzesense/wyzesense_custom.py", line 321, in _ReadRawHID assert len(s) >= length + 1 AssertionError 2020-12-06 11:41:03 INFO (Thread-3) [custom_components.wyzesense.wyzesense_custom] LOG: time=2020-12-06T11:40:47.486000, data=b'14ff'

PierreScerri avatar Dec 06 '20 10:12 PierreScerri