Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] unable to fetch DeviceMotion #151

Closed
simonnelli opened this issue Nov 30, 2020 · 12 comments
Closed

[BUG] unable to fetch DeviceMotion #151

simonnelli opened this issue Nov 30, 2020 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@simonnelli
Copy link

simonnelli commented Nov 30, 2020

Describe the bug
Since installing 2.0.x I get following errors in the log

[11/30/2020, 2:00:05 PM] [dingz] [dingz Küche] ALIVE (192.168.227.12)
[11/30/2020, 2:00:10 PM] [dingz] [dingz Küche] ALIVE (192.168.227.12)
[11/30/2020, 2:00:15 PM] [dingz] [dingz Küche] ALIVE (192.168.227.12)
[11/30/2020, 2:00:20 PM] [dingz] [dingz Küche] ALIVE (192.168.227.12)
[11/30/2020, 2:00:25 PM] [dingz] [dingz Küche] ALIVE (192.168.227.12)
[11/30/2020, 2:00:30 PM] [dingz] [dingz Küche] ALIVE (192.168.227.12)
[11/30/2020, 2:00:30 PM] [dingz] [dingz Küche] Error: timeout of 3000ms exceeded (GET http://192.168.227.12/api/v1/state)
[11/30/2020, 2:00:30 PM] [dingz] [dingz Küche] HTTP ECONNABORTED Connection aborted --> 192.168.227.12
[11/30/2020, 2:00:30 PM] [dingz] [dingz Küche] Error -> unable to fetch DeviceMotion data DeviceNotReachableError DeviceNotReachableError: Device can not be reached -> dingz Küche-> 192.168.227.12
[11/30/2020, 2:00:31 PM] [dingz] [dingz Küche] Device --> recovered from unreachable state (192.168.227.12)
[11/30/2020, 2:00:35 PM] [dingz] [dingz Küche] ALIVE (192.168.227.12)
[11/30/2020, 2:00:40 PM] [dingz] [dingz Küche] ALIVE (192.168.227.12)
[11/30/2020, 2:00:45 PM] [dingz] [dingz Küche] ALIVE (192.168.227.12)

To Reproduce
Install 2.0.4 and check log

@simonnelli simonnelli added the bug Something isn't working label Nov 30, 2020
@simonnelli
Copy link
Author

simonnelli commented Nov 30, 2020 via email

@johannrichard johannrichard reopened this Nov 30, 2020
@johannrichard
Copy link
Owner

🙈 This is the dingz without a PIR that's throwing the error, right? If so, then this is probably the reason (although this shouldn't happen as there should be no Motion Service at all on this one and hence the poller not be running ...)

@simonnelli
Copy link
Author

simonnelli commented Nov 30, 2020 via email

@johannrichard
Copy link
Owner

Maybe I’ll better ask the dingz-guys for a replacement...

🙈

Right now I'm still willing to support. 🤣 It's working here though, so I wonder whether you could let me know the following (sorry, lost a bit track of what dingz / FW combinations you have):

@simonnelli
Copy link
Author

simonnelli commented Nov 30, 2020 via email

@johannrichard
Copy link
Owner

When starting the plugin, it's quite common that the dingz have an unreachable state until the first one or two requests are made. After that they should quickly switch to ALIVE though. So, one question:

  • Do you still get the same error (i.e. with the Error -> unable to fetch DeviceMotion data DeviceNotReachableError or just the surrounding timeouts without that specific error on DeviceMotion?

@simonnelli
Copy link
Author

simonnelli commented Nov 30, 2020 via email

@johannrichard
Copy link
Owner

The state changes intermittently between ALIVE and DEAD. Therefore I also see Error -> unable to fetch DeviceMotion data DeviceNotReachableError long after plugin restart.

Since it's only that one but consistently it could be that the 3s timeout is just too short when the prototype dingz is read out (we send ~ 5 requests following each other every 5s. If the dingz gets saturated then maybe the additional motion polling which happens in parallel is just too much.

I will work on a potential workaround (increase timeout/delay between polls). In the meantime you could consider switching to PUSH for motion detection instead of POLL.

@johannrichard
Copy link
Owner

Based on your feedback and the one from @qx54 in #152, I've implemented a new feature which allows you to set the update interval in the configuration. As I've noted in #152, the problem seems to be prevalent for PIR motion sensors and your prototype dingz (which proves to be a useful source of edge cases, so is very useful. 😁 🙈 :octocat:)

I've pushed a nightly to [email protected] -- you should find a new setting in the UI for an interval which is by default at 10s (you have to save the config and restart Homebridge, otherwise the minimum value of 5s will be kept). If you find some time to check how your log looks with a different interval, that'd be appreciated.

I suspect that despite the cleaner code, the change I made re: the mutex (see #152) actually increased the load on the devices as they see more requests coming in. Not exactly what was the intention. In any case, you might want to switch from POLL to PUSH for your PIR sensors: it's generally more robust and more event-driven than the brainless polling that was the default. It will also be the new default value for motion sensors: the callbacks function reliably enough and the price for polling might just be too high in many cases.

@simonnelli
Copy link
Author

Just installed [email protected] and switched to polling. Now getting a slightly different error:

[11/30/2020, 9:32:44 PM] [dingz] [dingz Küche] ALIVE (192.168.227.12)
[11/30/2020, 9:32:47 PM] [dingz] [dingz Küche] Error: timeout of 3000ms exceeded (GET http://192.168.227.12/api/v1/state)
[11/30/2020, 9:32:47 PM] [dingz] [dingz Küche] Device --> entered unreachable state (192.168.227.12)
[11/30/2020, 9:32:47 PM] [dingz] [dingz Küche] HTTP ECONNABORTED Connection aborted --> 192.168.227.12
[11/30/2020, 9:32:49 PM] [dingz] [dingz Küche] DEAD (192.168.227.12)
[11/30/2020, 9:32:49 PM] [dingz] [dingz Küche] Device --> recovered from unreachable state (192.168.227.12)
[11/30/2020, 9:32:54 PM] [dingz] [dingz Küche] ALIVE (192.168.227.12)

@johannrichard johannrichard changed the title unable to fetch DeviceMotion [BUG] unable to fetch DeviceMotion Nov 30, 2020
@johannrichard
Copy link
Owner

The first one or two requests to the dingz currently timeout (I suspect that there are also just one too many parallel requests made). My dingz always recover with the second GET, if the error disappears after startup, then we should be fine. Solving that issue is on my list though.

@simonnelli
Copy link
Author

What about adding an initial delay to circumvent errors after startup?

johannrichard added a commit that referenced this issue Dec 4, 2020
- switch default behaviour of motion sensors to `PUSH`
- should help with #151, reduce the load on the devices
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants