kukulich / home-assistant-jablotron100

Home Assistant custom component for JABLOTRON 100+ alarm system
MIT License
65 stars 24 forks source link

ServiceUnavailable: after working for many months #80

Closed zlymeda closed 10 months ago

zlymeda commented 11 months ago

Hi,

first of all, thank you for a great integration!

I have been using your component for many months and it was working nicely. Sometimes I faced the below issue and restarting the machine usually fixed it. But not this time. No matter what I do - restart HA, restart machine, this error never goes away. There was no particular change that I know of. I was using version 3.21.0.

I noticed that the permissions were root read/writable so I changed that:

$ ls -lah /dev/hidraw0 
crwxrwxrwx 1 root root 246, 0 Sep 20 07:57 /dev/hidraw0

Can you figure out what is the problem from the incoming pockets?

Thanks a lot

2023-09-20 08:25:32.290 DEBUG (ThreadPoolExecutor-4_1) [custom_components.jablotron100] Outcoming: 300102
2023-09-20 08:25:32.291 DEBUG (ThreadPoolExecutor-4_1) [custom_components.jablotron100] Outcoming: 300108
2023-09-20 08:25:32.291 DEBUG (ThreadPoolExecutor-4_1) [custom_components.jablotron100] Outcoming: 300109
2023-09-20 08:25:32.299 DEBUG (ThreadPoolExecutor-3_0) [custom_components.jablotron100] Incoming: d0089c68803fe0658814
2023-09-20 08:25:32.300 DEBUG (ThreadPoolExecutor-4_0) [custom_components.jablotron100] Incoming: d0089c68803fe0658814
2023-09-20 08:25:32.306 DEBUG (ThreadPoolExecutor-4_0) [custom_components.jablotron100] Incoming: 4008024a412d3130334b
2023-09-20 08:25:32.308 DEBUG (ThreadPoolExecutor-4_0) [custom_components.jablotron100] Incoming: 400c084d44363131322e30362e30
2023-09-20 08:25:32.311 DEBUG (ThreadPoolExecutor-4_0) [custom_components.jablotron100] Incoming: 4008094d443135303035
2023-09-20 08:25:32.313 DEBUG (MainThread) [custom_components.jablotron100] Central unit: JA-103K (hardware: MD6112.06.0, firmware: MD15005)
2023-09-20 08:25:32.318 DEBUG (ThreadPoolExecutor-5_1) [custom_components.jablotron100] Outcoming: 80080339393933323437
2023-09-20 08:25:32.378 DEBUG (ThreadPoolExecutor-5_0) [custom_components.jablotron100] Incoming: 801a0cffffffff0f000f002820010027ffffffffffffffffffffffff
2023-09-20 08:25:32.380 DEBUG (ThreadPoolExecutor-5_0) [custom_components.jablotron100] Incoming: d0089630843fe065a854
2023-09-20 08:25:33.914 DEBUG (ThreadPoolExecutor-5_0) [custom_components.jablotron100] Incoming: d206a42a09000000
2023-09-20 08:25:47.319 ERROR (MainThread) [custom_components.jablotron100] Service unavailable: 
Traceback (most recent call last):
  File "/config/custom_components/jablotron100/jablotron.py", line 681, in _detect_devices
    packets = reader.result(estimated_duration * 2)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 458, in result
    raise TimeoutError()
TimeoutError
2023-09-20 08:25:47.332 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Jablotron for jablotron100
Traceback (most recent call last):
  File "/config/custom_components/jablotron100/jablotron.py", line 681, in _detect_devices
    packets = reader.result(estimated_duration * 2)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 458, in result
    raise TimeoutError()
TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/jablotron100/__init__.py", line 30, in async_setup_entry
    await jablotron_instance.initialize()
  File "/config/custom_components/jablotron100/jablotron.py", line 290, in initialize
    await self._detect_and_create_devices_and_sections_and_pg_outputs()
  File "/config/custom_components/jablotron100/jablotron.py", line 301, in _detect_and_create_devices_and_sections_and_pg_outputs
    self._detect_devices()
  File "/config/custom_components/jablotron100/jablotron.py", line 685, in _detect_devices
    raise ServiceUnavailable
custom_components.jablotron100.errors.ServiceUnavailable
kukulich commented 11 months ago

Is there anything that can changed in your Jablotron? User rights, pin code ? New device?

zlymeda commented 11 months ago

Is there anything that can changed in your Jablotron? User rights, pin code ? New device?

none that I know of. however, I noticed yesterday that none of my motion sensors were updated in like 7 hours, even though I was present and moved around a lot. But, what I noticed was that one motion sensor was unavailable. It is battery-powered. So now when I think about it... maybe the battery is dead and that is why no packet can be received.. is it possible?

I though I would see some warning or something in the official Jablotron app, but nope. now I think it might be a dead battery, I will try to check that now.

if that is the case and charging the battery would work, then maybe it would be nice not to crash if the packet is not received, but mark the sensor unavailable if possible - I might even make a contribution if that is the case and I would be able to figure it out :)

I will keep you posted.

kukulich commented 11 months ago

@zlymeda

You can try to change the type of the device in Jablotron integration to "empty", so the position will be ignored. You will see if HA the integration will work then.

zlymeda commented 11 months ago

@kukulich

so unfortunately that did not work. I tried changing everything to Empty expect one device, but still had the same problem.

kukulich commented 11 months ago

@zlymeda ok, another idea. Can you change the number of devices? If the broken device is eg. no 8, then change it to 7 devices.

zlymeda commented 11 months ago

no, still nothing. I will try to debug it in the evening.

kukulich commented 11 months ago

@zlymeda Please enable debug of all device packets (in integration options).

zlymeda commented 11 months ago

@kukulich I was able to debug, find and fix the issue here: https://github.com/kukulich/home-assistant-jablotron100/pull/81

integration now works and no more errors in the logs