Ring Device integration via MQTT w/ Video Streaming

Ok I see I need to use the different add on, can someone tell me how to get the refresh token using hassio please?

Ignore me, figured it out…!

Doing the same thing myself now. Where did you find this setting?

How? Im still not seeing where to get the ring token.

1 Like

I’m running docker but has issue.

I got the token and put it in config.json file, build the image and run the docker without user/password, but getting below errors, what else do I miss?

> [email protected] start /srv
> node ring-alarm-mqtt.js

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node ring-alarm-mqtt.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

For those running Hassio, these are the steps I pulled together to get it working with 2fa. Sorry if someone has written this up somewhere but I couldn’t find it all in one place.

Firstly, you need to make sure your using the hassio addon from this source, the one I was using was a different one:

Once that is installed, set it up like the other one, but don’t put your ring email and password in. You will see a section for refresh token.

Next (on a windows machine) install nodejs from:

Just next next it, no additional options needed.

When installed open the nodejs command prompt (you’ll see it in start menu) and enter the command:

npx -p ring-client-api ring-auth-cli

This will ask for your email/password and then supply the 2FA code you are sent. This will then output the refresh token you use in the config of the new addon posted above.

That should be all that’s needed, I don’t know much about all of these, and there may be another way but this is how I got it working on hassio.

1 Like

Excellent. This did the trick for me too.

Any one running docker? This is what I did:
pull latest code from https://github.com/tsightler/ring-mqtt
then follow this to get the refreshToken
update refreshToken value to “ring_token” in ring-alarm-mqtt/config.json file
then follow https://github.com/tsightler/ring-mqtt#docker-installation:
build the image: docker build -t ring-mqtt/ring-mqtt .
then run the docker (remove ringuser and ringpass):

docker run  -e "MQTTHOST={host name}" -e "MQTTPORT={host port}" -e "MQTTRINGTOPIC={host ring topic}" -e "MQTTHASSTOPIC={host hass topic}" -e "MQTTUSER={mqtt user}" -e "MQTTPASSWORD={mqtt pw}"  ring-mqtt/ring-mqtt

but the docker can’t start:

> [email protected] start /srv
> node ring-alarm-mqtt.js

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node ring-alarm-mqtt.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Guys, thanks for the support. As of last night I have published my own addon for Hassio that I will strive to support along with the ongoing support for the ring-mqtt script. Overall the function should be the same as prior addons but with these changes:

  • Configured to use host network so “localhost” should work if running Mosquitto on Hassio
  • Uses the new ring-mqtt code base which has support for cameras (config option) and a few new devices (e.g. fans, retro kit zones, etc.) with hopefully more to come.

I’m working on making it easier to get the initial 2FA refresh token, but that’s not implemented yet. I’d strongly suggest migration to this addon from any others because changes that I will be making to the old ring-alarm-mqtt repo will likely break the others soon.

Please feel free to report any bugs/issues via Github and I will look after them as quickly as I can.

1 Like

The Docker setup doesn’t use config.json, that’s why everything is passed via environment variables. You’ll need to pass the token via “RINGTOKEN={ring token}” just like all the other parameters.

Got it. Thanks!

For those of us not using addon, do we need to migrated to new code https://github.com/tsightler/ring-mqtt?
Question for the token, does it expire? can we manually disable it if needed?

Yes, you’ll need to migrate. I will soon be renaming the ring-alarm-mqtt repository to just ring-mqtt and placing in it the new code base. The migration should be pretty easy overall as the code is functionally identical, same config, etc. Only user visible difference is the project/executable name. It doesn’t make sense to call in ring-alarm-mqtt since it supports more than alarm functions.

As far as I understand the token doesn’t expire as long as it is being used regularly. It’s the same authentication the Ring app uses. Upon completing the 2FA auth, the Ring app gets the refresh token and stores it securely on your phone/device. That’s why you don’t have to log in again even if you reboot your device, because the refresh token is stored locally there. I suppose there could be some lifetime to the token, but I haven’t seen this yet.

1 Like

I should probably change this to say it’s the only user visible changes when used with Home Assistant, because other things that changed are handled automatically by discovery.

For those using the script with 3rd party MQTT tools (Node-Red seems common) there are a few breaking changes with topic naming and such to be more consistent.

BTW, I’m also looking for people who can help testing this new code as some of it is completely untested after the refactor because I don’t have the actual devices. While I copied the logic from the existing code, typos or other minor issues could easily sneak in.

I’ve tested the following devices thoroughly:
Alarm Control Panel
Contact Sensor
Motion Sensor
Camera functions (dings, motion, lights, siren)
Flood/Freeze Sensor
Smoke/Co Listener

So far other users have reported success with:
Locks
Retrokit Zones

Functions that I’d love to hear feedback on:
CO Detector
Smoke Detector
3rd Party Z-wave switch (standard)
3rd Party Z-wave dimmer switch/light (brightness control)
3rd Party Z-wave fan (multi-level-switch set to Fan mode)

I’m also looking to add support for Ring smart lighting and 3rd party zwave sensors, but need people with those devices to help with testing.

Woooh I’m back up and running! I wish ring would have added a device prompt authentication rather than this archaic sms/email system

Hi all, another update. Thanks to all those who have tested the new script and addon. I have a few bugs reports, mostly device specific, but overall things seem to be working pretty well.

Since ring has eliminated anything other than 2FA authentication I have updated the script and add-on with a small web service with the goal to simplify the process of getting the refresh token, especially for Hass.io users.

In the new addon, when you press start and the ring_token config entry is empty, the script will start a small web service. Once you see the entry in the log that the web service has started, you can click the “OPEN WEB UI” button and walk through entering your username/password and 2FA response, it will then show a refresh token that you can copy and paste into the ring_token option.

The web server exits immediately after showing the token so the docker container is destroyed and the web server does not run if a ring_token exist in the config.

While the forms/web pages are crude, and have limited error checking, I’m thinking it might be OK for this very limited use case. Of course you’re welcome to continue to generate a refresh_token using the ring-auth-cli run on any node system, but with this you can do everything from within Hass.io. Feedback is welcome!

1 Like

Hi ,

Anyone seen this error ?

[s6-init] making user provided files available at /var/run/s6/etc…exited 0.
[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] done.
[services.d] starting services
[services.d] done.
ifelse: fatal: unable to exec /run.sh: Exec format error
[cmd] /run.sh exited 126
[cont-finish.d] executing container finish scripts…
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

I had not seen it, however, simply based on the error message, I had at least one idea of what it might be (missing shebang in run.sh), although I have no idea how it would work for my setup and not yours. Still, I pushed a quick update with that in it, because I didn’t think it would hurt. You can uninstall and reinstall the addon (should show 3.0.0b4) and let me know if it works for you.

did not help , did generate a key from CLI but no luck.

Can it be that im not using MQTT on HA ?

it still says 3.0 on the addon page

I wouldn’t think so because the error you are posting is before the script itself even starts. Basically the docker container is not even starting because “run.sh” is the command that starts everything within the container. I’d suggesting completely removing the addon and repository and re-adding since you didn’t see a bump in the version number.

What Hass.io version and HassOS version are you running? What platform?

Remove the link and now it works , thanks