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

Starting the Ring-Mqtt addon in Home Assistant, nothing is pushed to MQTT #330

Closed
MrAnonymous722 opened this issue Feb 24, 2022 · 10 comments
Assignees
Labels
bug Some code behavior is not as expected

Comments

@MrAnonymous722
Copy link

MrAnonymous722 commented Feb 24, 2022

Describe the bug

Following a (rather hard) reboot of my enviorment, the Ring-Mqtt addon seems to be acting funny. It seems to start and stay running, but looking at the logs in Supervisor, it gets to ring-mqtt New location: then stops. Nothing is published to MQTT, and nothing further happens.

Describe your environment

I have Ring-Mqtt running as an Addon in a supervised Home Assistant VM, running on top of Ubuntu.

Describe your settings and what you've tried

None of the settings I have now are different from what I was using prior to the weird reboot. Only things I have changed from the defaults are my MQTT server location and login details.

I have tried fully uninstalling/reinstalling and re-logging in with the web portal. No dice.

Debug Logs

[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] ring-mqtt.sh: executing... 
-------------------------------------------------------
| Ring-MQTT with Video Streaming                      |
| Addon for Home Assistant                            |
|                                                     |
| Report issues at:                                   |
| https://github.com/tsightler/ring-mqtt-hassio-addon |
-------------------------------------------------------
[cont-init.d] ring-mqtt.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
-------------------------------------------------------
ring-mqtt.js version: 4.9.1
Node version v16.13.2
NPM version 8.1.3
git version 2.34.1
-------------------------------------------------------
Using configured MQTT Host: 192.168.0.127
Using configured MQTT Port: 1883
Using configured MQTT User: mqttuser
Using configured MQTT password: <hidden>
-------------------------------------------------------
Running ring-mqtt...
2022-02-24T19:17:31.416Z ring-mqtt Using configuration file: /data/options.json
2022-02-24T19:17:31.419Z ring-mqtt File /data/ring-state.json not found. No saved state data available.
2022-02-24T19:17:31.419Z ring-mqtt No refresh token was found in saved state file or config file.
2022-02-24T19:17:31.419Z ring-mqtt Use the web interface to generate a new token.
2022-02-24T19:17:57.108Z ring-mqtt Username/Password was accepted, waiting for 2FA code to be entered.
2022-02-24T19:18:28.904Z ring-mqtt The 2FA code was not accepted, please verify the code and try again.
2022-02-24T19:18:48.441Z ring-mqtt Using configuration file: /data/options.json
2022-02-24T19:18:48.442Z ring-mqtt File /data/ring-state.json not found. No saved state data available.
2022-02-24T19:18:48.443Z ring-mqtt Using refresh token generated via web UI.
2022-02-24T19:18:48.497Z ring-mqtt Attempting connection to Ring API using generated refresh token.
2022-02-24T19:18:49.837Z ring-mqtt Connection to Ring API successful
2022-02-24T19:18:49.849Z ring-mqtt Starting connection to MQTT broker...
2022-02-24T19:18:49.918Z ring-mqtt MQTT connection established, processing locations...
2022-02-24T19:18:49.920Z ring-mqtt File /data/ring-state.json saved with updated refresh token.
2022-02-24T19:18:51.420Z ring-mqtt --------------------------------------------------------------------------------
2022-02-24T19:18:51.421Z ring-mqtt New location: ...```
I can provide more detailed logs if needed, I just need to know how to go about getting them with the way I have this installed. Thank you!
@MrAnonymous722 MrAnonymous722 added the bug Some code behavior is not as expected label Feb 24, 2022
@tsightler
Copy link
Owner

tsightler commented Feb 24, 2022

If you are saying that it hangs at the spot of the log that you posted then it's likely that the Ring hub for that location is offline. During startup, any Ring hub (alarm or smart lighting bridge) at all monitored locations must be online, otherwise the addon waits forever for the hub to come online so that it can query for the available devices.

@MrAnonymous722
Copy link
Author

It is online and responsive to the app. I'll try and restart it and see if that helps.

@tsightler
Copy link
Owner

tsightler commented Feb 24, 2022

Do you have multiple locations? I mean, the code in question is super simple and has not changed since the earliest days of this project, it's basically this snippet:

...
            debug(colors.white('New location: ')+colors.green(location.name)+colors.cyan(` (${location.id})`))
            location.isSubscribed = false
            location.isConnected = false
            ringLocations.push(location)
        }

        // Get all location devices and, if configured, cameras
        const devices = await location.getDevices()
...

So, basically, it prints out "New location" with the location ID, sets a few properties used for internal state tracking, and then calls getDevices() for that location. This call has no timeout and thus will wait forever for all Ring base stations to come be online (this is the documented behavior of ring-client-api, see dgreif/ring#388). In the 3+ years of maintaining this project I've never seen a case of it hanging there unless there is some location with a hub that is offline.

I suppose it's theoretically possible that something else is causing getDevices() to fail, but again, that code hasn't changed in years and is in use by thousands of users across various project that leverage ring-client-api so it's unlikely to be something there.

@MrAnonymous722
Copy link
Author

I only have the one location. I stopped the add-on, restarted the alarm hub then after I was able to control it from the app again (also after confirming its working over WiFi and not cellular, in case that mattered), I started the add-on again. Its still stopping right as it discovers my alarm hub.

Looking back at the issue templates, I should have opened this as a support request. I know its not anything with the add-on, because even if something had changed, I didn't make an update.

I was really hoping you had seen this before and it would be a super simple silly mistake I made. Dang.

@tsightler
Copy link
Owner

Do you have any locations that are shared with you from another account? The code attempts to connect to all locations which the account has access to, this includes shared locations. For example, if my daughter shares her alarm with me so that I can see it in the Ring app, then her alarm must also be online.

@MrAnonymous722
Copy link
Author

I do not. Looking in the app, from the hamburger menu in the top left, I only see my house as a location, then "Add a location" below it.

@tsightler
Copy link
Owner

And, just to be sure, no smart lighting, which also counts as a hub?

@MrAnonymous722
Copy link
Author

Oh, good call on that. My lighting hub has been unplugged for some time since I was rearranging some stuff. I'll get that reconnected and see what that does.

@MrAnonymous722
Copy link
Author

Good deal! That was the problem! Good to know that I can't unplug this silly thing haha. Thank you for that!

@tsightler
Copy link
Owner

Good to know that the rule still holds, it only hangs here if a hub is offline.

I'm going to add some additional logging in 5.0.0 that will list all locations to which the account has access prior to processing the devices for each individual location. Then I'll also add a note that the device level processing will hang if any alarm or smart lighting hubs are offline. Maybe that will help people since this keeps coming up. I never realized how many people just live with the fact that something is offline. It would drive me nuts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Some code behavior is not as expected
Projects
None yet
Development

No branches or pull requests

2 participants