DeeeeLAN / homebridge-sleepiq

SleepIQ Homebridge plugin
18 stars 10 forks source link

New Log Error - Crashes Homebridge #4

Closed 400HPMustang closed 5 years ago

400HPMustang commented 5 years ago

Please see the new log error below, this occurred after running for a week. This was the last thing logged before homebridge crashed.

[2019-3-8 08:59:22] [SleepNumber] Family Status GET results: {"Error":{"Code":418,"Message":"Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection-CannotCreateTransactionException"}} [2019-3-8 08:59:22] [SleepNumber] SleepIQ authentication failed with an unknown error code. Please report this incident at https://github.com/DeeeeLAN/homebridge-sleepiq/issues/new [2019-3-8 08:59:22] [SleepNumber] Exiting...

DeeeeLAN commented 5 years ago

I am amazed at how bizarre the error messages you keep receiving are. I have been running for months without issue, never seen anything like this. I don't really know what that means, but I think I will just disable the exit so it gracefully carries on. As long as it is a temporary error, it should be fine.

400HPMustang commented 5 years ago

@DeeeeLAN Well I have to tell you, when the plugin is working it works great. I've got a great good night automation built around the bed sensors.

DeeeeLAN commented 5 years ago

I removed the exit statements in 99f4a4c, give it a try and lets see if we can make it further this time.

400HPMustang commented 5 years ago

Alright. Updated to the latest and restarted in debug mode. I'll let you know what happens!

400HPMustang commented 5 years ago

Ok so the beds are always reporting 100% inflated now regardless of their actual state. Only thing I've found in the logs, admittedly not in debug mode is:

Line 249: [2019-3-9 09:58:31] [SleepNumber] Family Status GET results: {"Error":{"Code":50002,"Message":"Session is invalid"}}
Line 317: [2019-3-9 09:58:38] [SleepNumber] foundationStatus result: {"Error":{"Code":404,"Message":" No Foundation Device"}}

I also have this showing up in my console, not sure if that's you or not:

(node:6740) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'forEach' of undefined
(node:6740) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:6740) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read property 'forEach' of undefined
(node:6740) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): TypeError: Cannot read property 'forEach' of undefined

I'll restart in debug and see if I can replicate

DeeeeLAN commented 5 years ago

Those two errors are expected. They are not errors in the plugin, just results of some API calls as I set up the plugin.

400HPMustang commented 5 years ago

Alright, cool. I'm going to debug some more for a few days and see if I can catch the bed not responding again.

DeeeeLAN commented 5 years ago

Is it responding right now? I just checked and mine isn’t responding either. I will work on it a bit later tonight.

400HPMustang commented 5 years ago

After a few restarts of homebridge it is, but it was also detecting duplicates of the bed and sensors for a few of those reboots.

On Mar 10, 2019, at 12:01 PM, DeeeeLAN notifications@github.com wrote:

Is it responding right now? I just checked and mine isn’t responding either. I will work on it a bit later tonight.

Thanks, Dillan


From: 400HPMustang notifications@github.com Sent: Sunday, March 10, 2019 9:25 AM To: DeeeeLAN/homebridge-sleepiq Cc: DeeeeLAN; Mention Subject: Re: [DeeeeLAN/homebridge-sleepiq] New Log Error - Crashes Homebridge (#4)

Alright, cool. I'm going to debug some more for a few days and see if I can catch the bed not responding again.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/DeeeeLAN/homebridge-sleepiq/issues/4#issuecomment-471320812, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AMR86JdIFIBMkfgOo6ZaVlp1H6tLuzG2ks5vVTIOgaJpZM4blmA7. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

400HPMustang commented 5 years ago

@DeeeeLAN I have a new issue where the beds are inflated to 100% (shows on the native SleepIQ app and because I did set the beds to 100%) but in Homekit and homebridge I'm seeing 40%. The API looks like it's returning 40% back as well which is really weird.

I'm not sure if this is related to this same issue or something new since the logs are not throwing errors. Let me know if you want me to close this out and open a new bug for this.

Looks like it might be the result of timeouts...I'm guessing there's no retry so the SleepIQ status stays the same while your Homebridge and Homekit just continue to return whatever the last status/values were?

[2019-3-13 08:30:29] [SleepNumber] Error: familyStatus GET request returned undefined. Error: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"54.156.18.180","port":443}
[2019-3-13 08:30:29] [SleepNumber] Error: familyStatus GET request returned undefined. Error: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"54.156.18.180","port":443}
[2019-3-13 14:54:50] [SleepNumber] Error: pauseMode GET request returned undefined. Error: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"52.20.28.118","port":443}
[2019-3-13 14:54:50] [SleepNumber] Error: pauseMode GET request returned undefined. Error: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"52.20.28.118","port":443}
[2019-3-13 16:57:08] [SleepNumber] Error: familyStatus GET request returned undefined. Error: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"52.20.28.118","port":443}
[2019-3-13 16:57:08] [SleepNumber] Error: familyStatus GET request returned undefined. Error: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"52.20.28.118","port":443}
[2019-3-13 17:18:45] [SleepNumber] Family Status GET results: {"Error":{"Code":401,"Message":"HTTP 401 Unauthorized"}}
[2019-3-13 17:51:55] [SleepNumber] Error: pauseMode GET request returned undefined. Error: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"52.20.28.118","port":443}
[2019-3-13 17:51:55] [SleepNumber] Error: pauseMode GET request returned undefined. Error: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"52.20.28.118","port":443}
[2019-3-14 00:25:25] [SleepNumber] Error: familyStatus GET request returned undefined. Error: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"52.20.28.118","port":443}
[2019-3-14 00:25:25] [SleepNumber] Error: familyStatus GET request returned undefined. Error: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"52.20.28.118","port":443}
[2019-3-14 02:44:00] [SleepNumber] Error: pauseMode GET request returned undefined. Error: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"54.156.18.180","port":443}
[2019-3-14 02:44:00] [SleepNumber] Error: pauseMode GET request returned undefined. Error: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"54.156.18.180","port":443}
[2019-3-14 05:04:10] [SleepNumber] Sleep Number PUT result: {"Error":{"Code":400,"Message":"97 The sleepNumber in the request is incorrect. The sleepNumber must be between 5 and 100 and divisible by 5"}}
[2019-3-14 06:06:08] [SleepNumber] Error: pauseMode GET request returned undefined. Error: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"54.156.18.180","port":443}
[2019-3-14 06:06:08] [SleepNumber] Error: pauseMode GET request returned undefined. Error: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"54.156.18.180","port":443}
DeeeeLAN commented 5 years ago

I had this happen as well after the most recent updates. Let me dig into it a bit.

DeeeeLAN commented 5 years ago

I fixed a few different bugs tonight. It should take care of the duplicate issue, but if it doesn't (after restarting homebridge a couple times), you might need to clear your accessory cache and try again. I tried to handle the migration from my old accessory naming style gracefully, but it has had a few bumps. Other than that, I don't know if that timeout issue has been resolved or not, although it looks like that might be server side (sleep number's fault). Not sure.

Run this for a few days, and if you get any new errors, as always, let me know. 😁

400HPMustang commented 5 years ago

@DeeeeLAN grabbed the latest...The occupancy sensors and privacy sensor show up in HK. Everything shows up in HB but the bed sides themselves not showing up in HK seems to make HB go unresponsive. Everything shows up "no response", including the HB which is odd. I've deleted all of my cache, restarted the computer running HB, etc. The only way to get everything working again was to remove my HB from HK. Now everything is showing up as responding. This happened after the last update for your plugin but I thought it was a HK issue. Nothing in the logs showing any kind of errors, etc. Another interesting note, noticed last night that if I create an automation with the bed controls and a scene in it, they don't seem to like to chain things.

ex: Bed detects occupancy > set sleep number to 45 > run "good night scene". If I remove the scene I get the bed detecting occupancy and my sleep number sets. Add the scene back into the automation and I get nothing.

DeeeeLAN commented 5 years ago

Hmm, I have not played with automation chains like that very much, and am not even sure if that issue is mine or not. Can you just add the sleep number setting to the good night scene so it is just one step? Or make them two separate automations?

So is everything working right now? One thing to remember is to check the default room where new homebridge items show up when you update and things are unresponsive, because sometimes when messing with the cache and such, the device will show up as a new one instead of updating the old one. Hopefully it only happens once, but it depends on if the cache has good devices or not.

400HPMustang commented 5 years ago

@DeeeeLAN I'm not sure the automation issue is yours at all. I think Home Kit is just unreliable in general. I've tried a few different things. Right now I'm just going to start with one automation, setting my sleep number when I'm detected in bed. Once I confirm that works consistently; I'll document that and move on to adding the sleep number setting to the good night automation. If that doesn't work I'll move to two separate automations (one to set the sleep number and one to trigger good night based on bed occupancy).

Do you have any thoughts on why upgrading your plugin the last two times has required me to completely remove and add my homebridge back to the home app again?

DeeeeLAN commented 5 years ago

I am not sure why you had to completely remove homebridge, but I would be surprised if it was 100% necessary, my guess is you might have just missed the devices when they changed. The IDs for the devices changed on the backend, causing the old ones in HomeKit to stop working. Removing everything and starting fresh would re-sync the device list. Regardless, you shouldn’t see the problem again. If you do, something bigger must be going on and we can dig into it. I wouldn’t worry about it too much for now though, as long as everything is working as expected.

400HPMustang commented 5 years ago

@DeeeeLAN you rock! Thank you again for all the help.

DeeeeLAN commented 5 years ago

Did you have a Sleep Number base we were trying to add any features for? I am losing track of who requested what. 😅

400HPMustang commented 5 years ago

It's not me with the base, it's the person who has the other open ticket about the lighting features .

DeeeeLAN commented 5 years ago

Okay, but do you have a base? I need lots of data for the updates necessary.

400HPMustang commented 5 years ago

This is what I have, https://www.sleepnumber.com/sn/en/Bed-Bases-and-Frames/p/base-modular

DeeeeLAN commented 5 years ago

Ah, no smarts in that base. I will close this issue. Open a new one with any fresh discoveries.

64Spaces commented 5 years ago

SFA20S | Split King FlexFit2, Stone, 2Remotes

DeeeeLAN commented 5 years ago

@64Spaces go ahead and open a new ticket, I will need some API data and screenshots.