kevinvincent / ha-wyzesense

A Home Assistant Component to interface with the WYZE Sense hub and sensor system
370 stars 100 forks source link

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

Open atechnical opened 4 years ago

atechnical commented 4 years ago

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

carlos-sarmiento commented 4 years ago

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)

clandestine-avocado commented 4 years ago

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

pixeldj commented 4 years ago

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

firestrife23 commented 4 years ago

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
rdesmara commented 4 years ago

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

Pizzaface commented 4 years ago

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 commented 4 years ago

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

MagicMountainMan commented 4 years ago

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
mckochan commented 4 years ago

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.

Meelobee commented 4 years ago

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.

PierreScerri commented 3 years ago

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'