Ring Device integration via MQTT w/ Video Streaming

It just reports what the ring app has. All mine show full also vs other components

As mentioned in another reply, the battery level reported is exactly the same as what is shown in the Ring app. These are not sophisticated devices, they use simple voltage monitoring to report battery status and the CR123A batteries that power these devices generally provide consistent voltage until near the end of their life, which is usually around 3 years, although Iā€™ve seen cases where such batteries last as long as 5 years before reporting any degradation.

If you are seeing a different value in the app vs what ring-mqtt is reporting, feel free to open an issue on the Github project page.

P.S. ā€“ Just for a reference, my devices are all 2 years old and all of them still show 100% battery in both the Ring app and in ring-mqtt.

Hi. Thank you for the excellent work on ring integration @tsightler and all the community members. Reading over this post, I was able to setup the ring device in home assistant. In the logs, i see the sensor update under ring alarm - so i believe this is working. However, I cant get it communicate with mqtt.

Please advise. I have pasted the configuration.

MQTT

logins:
  - username: mqttuser
    password: mqttpw
anonymous: true
customize:
  active: false
  folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false

Ring

enable_cameras: false
enable_modes: false
enable_panic: false
enable_volume: false
mqtt_host: <auto_detect>
mqtt_port: <auto_detect>
mqtt_user: mqttuser
mqtt_password: mqttpw
branch: addon
ring_token: ''
location_ids:
  - ''

This is following error message i see under MQTT

[WARN] Not found homeassistant on local database
1609913130: Socket error on client <unknown>, disconnecting.
1609913250: New connection from 172.30.32.1 on port 1883.
1609913250: Socket error on client <unknown>, disconnecting.
1609913370: New connection from 172.30.32.1 on port 1883.
1609913370: Socket error on client <unknown>, disconnecting.
1609913490: New connection from 172.30.32.1 on port 1883.
[WARN] Not found homeassistant on local database
1609913490: Socket error on client <unknown>, disconnecting.
1609913610: New connection from 172.30.32.1 on port 1883.
1609913610: Socket error on client <unknown>, disconnecting.

Are you using MQTT for anything else?
You installed Mosquito and not MQTT plus web client?
I would change anon to false
as well my working config has auto detect for user

logins:

  • username: xxxx
    password: xxxx
    anonymous: false
    customize:
    active: false
    folder: mosquitto
    certfile: fullchain.pem
    keyfile: privkey.pem
    require_certificate: false

enable_cameras: false
enable_modes: false
enable_panic: false
enable_volume: false
mqtt_host: <auto_detect>
mqtt_port: <auto_detect>
mqtt_user: <auto_detect>
mqtt_password: <auto_detect>
branch: addon
ring_token: ā€˜ā€™
location_ids:

  • ā€˜ā€™

@PapaLanc - Thank you for you reply.

I was able to solve the error. I had to configure my mosquitto mqtt correctly. Once the setup was done, it worked as expected.

Thank you.

Thanks for the update.

@tsightler Hi thank you so much for the addon. iā€™m a homeassistant newbie and have been learning quite a bit over the last month.

I somehow got your addon working for the first time a week or so ago but I ran into an issue where my entities showed up ā€œrestoredā€ yesterday and none of the devices were communicating with HA. I tried to uninstall/reinstall the addon and the addon seems to install and connect to ring just fine (2fa is fine etc) but once itā€™s up and running it doesnā€™t re-add the entities back in, it doesnā€™t even mention finding devices in the logs.

couple different avenues iā€™m curious of:

  1. the documentation mentions ā€œWith the 4.0 release of this addon, efforts have been made to dramatically simplify configuration.ā€ - do i actually have to build my own mqtt broker or is this handled in the process? do you have updated instructions for the homeassistant OS for start to finish? feel like iā€™m missing something here.

  2. when i deleted the ā€˜restoredā€™ entities that werenā€™t working anymore, did they get blacklisted somewhere in a config file that i need to clean up so they will be re-discoverable?

Iā€™m not sure what you mean by ā€œbuild your own mqtt brokerā€, but indeed you need an MQTT broker installed and configured. Typically this is done with the Mostquitto MQTT broker addon and by configuring the MQTT integration in Home Assistant. This is well covered in the Home Assistant documentation, IMO, so I donā€™t reproduce it for the addon, especially since it can change over time and itā€™s Home Assistant specific, not the addon. Of course you can also use the addon with other MQTT brokers, but thatā€™s not really a typical use case for Home Assistant. However, since it worked at some point Iā€™m going to guess MQTT is not the issue.

If youā€™re not seeing the devices in the log, then no devices are going to appear in Home Assistant, so you should start there. You can open an issue on the Github project and share your logs, but simply sharing a small snippet here might be enough, what is the last line that you see in the addon logs?

thanks for the response! so this morning i completely uninstalled ring-devices and the supervisor addon mqtt broker as well as the integration for the broker.

So, starting over I:

  1. installed mqtt broker supervisor addon
  2. created user mqttuser in my configure > users section of homeassistant
  3. configured MQTT Broker integration
  4. edit MQTT Broker Configuration:
    logins: []
    anonymous: false
    customize:
    active: false
    folder: mosquitto
    certfile: fullchain.pem
    keyfile: privkey.pem
    require_certificate: false

I then added a supervisor -> addon -> hamburger -> repositories -> https://github.com/tsightler/ring-mqtt-ha-addon

to add it to my UI

then i installed the ring devices addon, logged in to ring.com to activate 2FA, and then restarted the app again.

i tried with the default homeassistant user, tried with my user mqttuser, tried to give mqttuser admin rightsā€¦ nothingā€¦ each time i get this in logs:

The logs stop at location:

-------------------------------------------------------
| Ring Device Integration via MQTT                    |
| Addon for Home Assistant                            |
|                                                     |
| Report issues at:                                   |
| https://github.com/tsightler/ring-mqtt-hassio-addon |
-------------------------------------------------------
ring-mqtt.js version 4.2.1
Node version v12.18.4
NPM version 6.14.6
git version 2.26.2
-------------------------------------------------------
Using discovered MQTT Host: core-mosquitto
Using discovered MQTT Port: 1883
Using configured MQTT User: mqttuser
Using configured MQTT password: <hidden>
-------------------------------------------------------
Running ring-mqtt...
2021-01-25T17:22:08.892Z ring-mqtt Using configuration file: /data/options.json
2021-01-25T17:22:08.895Z ring-mqtt Reading latest data from state file: /data/ring-state.json
2021-01-25T17:22:08.962Z ring-mqtt Attempting connection to Ring API using saved refresh token.
2021-01-25T17:22:10.321Z ring-mqtt Connection to Ring API successful
2021-01-25T17:22:10.322Z ring-mqtt Starting connection to MQTT broker...
2021-01-25T17:22:10.438Z ring-mqtt File /data/ring-state.json saved with updated refresh token.
2021-01-25T17:22:10.555Z ring-mqtt MQTT connection established, processing locations...
2021-01-25T17:22:11.557Z ring-mqtt --------------------------------------------------------------------------------
2021-01-25T17:22:11.558Z ring-mqtt Found new location <scrubbed> with id <scrubbed>

and the logs in the broker:


[13:18:54] INFO: Setup mosquitto configuration
[13:18:54] WARNING: SSL not enabled - No valid certs found!
[13:18:54] INFO: No local user available
[13:18:54] INFO: Initialize Hass.io Add-on services
[13:18:54] INFO: Initialize Home Assistant discovery
[13:18:54] INFO: Start Mosquitto daemon
1611598734: mosquitto version 1.6.3 starting
1611598734: Config loaded from /etc/mosquitto.conf.
1611598734: Loading plugin: /usr/share/mosquitto/auth-plug.so
1611598734: |-- *** auth-plug: startup
1611598734:  ā”œā”€ā”€ Username/password checking enabled.
1611598734:  ā”œā”€ā”€ TLS-PSK checking enabled.
1611598734:  ā””ā”€ā”€ Extended authentication not enabled.
1611598734: Opening ipv4 listen socket on port 1883.
1611598734: Opening ipv6 listen socket on port 1883.
1611598734: Opening websockets listen socket on port 1884.
1611598734: Warning: Mosquitto should not be run as root/administrator.
1611598734: New connection from 172.30.33.6 on port 1883.
1611598734: New connection from 172.30.32.1 on port 1883.
[INFO] found mqttuser on Home Assistant
1611598734: New client connected from 172.30.33.6 as mqttjs_8667b7b1 (p2, c1, k60, u'mqttuser').
[INFO] found homeassistant on local database
1611598734: New client connected from 172.30.32.1 as 5KEUfLpAwlCdo9wNH9D3DX (p2, c1, k60, u'homeassistant').
1611598789: Socket error on client mqttjs_8667b7b1, disconnecting.
1611598793: New connection from 172.30.33.6 on port 1883.
1611598793: New client connected from 172.30.33.6 as mqttjs_cba60607 (p2, c1, k60, u'homeassistant').
1611600534: Saving in-memory database to /data/mosquitto.db.
1611602335: Saving in-memory database to /data/mosquitto.db.

If it is hanging at the ā€œFound locationā€ message then the most likely cause is that the hub for that location is offline, either on cellular backup, or a lighting hub or something that is offline. The only thing that is happening at that point is a query for devices and the underlying API will basically wait forever if a hub device is offline and I donā€™t currently have any timeout. Please make sure all of your locations and hubs (alarms and smart lighting hubs) show as online in the app.

If you have access to shared locations from other people, then they must also be online during script startup. If you still have problems you should open an issue on the Github project page rather than attempt to troubleshoot it here on the forum.

1 Like

ahhhh damn - i just bought the mailbox sensor and itā€™s currently installed but disconnected as is the hub it uses!

dang, iā€™ll fire them back up and see if the issue resolves :slight_smile:

Iā€™ll let you know, thank you @tsightler!

btw, a little cleanup and my previous post might make a decent starter guide lol

hi @tsightler that did the trick - all the devices flooded back in, thanks again :slight_smile:

@tsightler Did you ever find a way to bypass a sensor while arming from HA?

@btilly The underlying API does support a method to do this, but I havenā€™t implemented it in ring-mqtt to this point. I can see a couple of options:

  1. Provide a virtual toggle switch to enable/disable automatic bypass of sensors during arming (and probably an option to set the default behavior). This is probably the cleanest, safest, and most flexible as it would not change existing behavior for the vast majority of people, which is important. Users could override the default behavior to always auto-bypass if they want, or could even write automations to do things like automatically enable bypass mode when certain sensors are open (say windows) but not others. This is probably my preferred approach.

  2. Provide an option to automatically bypass on arm if initial arming fail. This is probably the easiest, but least flexible and it makes me a little concerned to always automatically bypass for arming, but at least a user would have to choose this specifically.

  3. Leverage ā€œNight modeā€ for arming with bypass. Ring alarms donā€™t really have a night mode, but the Home Assistant MQTT integration does, and the ring-client-api has an option that can be set which causes arming to Night Mode to automatically bypass and arm Home or Away (based on the configuration). Itā€™s fairly easy to implement this, and it give users the option to arm with or without bypass similar to option 1, but Iā€™m not sure itā€™s very intuitive to know that arming with Night Mode automatically bypasses sensors.

My current lean is to implement option 1, but Iā€™m open to feedback here. Admittedly, I probably wonā€™t have time to work on this for at least a few weeks anyway, unless I get some unexpected free time.

@tsightler I would also think that option 1 is the right way to go. I am still new to MQTT - I have just been playing around with it in node-red. Does Ring Alarm just need a MQTT message to arm it while bypassing sensors? What would that message look like (or where can I go to look at all valid message types to ring alarm?). Sorry if that is a basic questions, I am ā€œlearning modeā€ right now.

As stated above, ring-mqtt does not have any bypass options currently implemented, so thereā€™s no way to trigger bypass using it. The ideas above were options of how bypass could be implemented in ring-mqtt in the future since the underlying ring-client-api, on which ring-mqtt is built, does support it.

I hope to implement this feature one day, but I donā€™t know when I will manage to get the time to work on it. It shouldnā€™t be too difficult, but it requires writing the code for the virtual switch to enable/disable bypass, for the option to set the default state of that switch, and, if the bypass option is enabled, a function to detect faulted sensors into an array and pass them as part of the arming function. None of this is particularly difficult, but will require coding and testing and I just donā€™t have the time right now.

Thanks Tsightler! I appreciate the additional information. I am off to go read up on ring-client-api!

Itā€™s pretty easy to do with ring-client-api. Normally to arm/disarm you call location.armHome() or location.armAway(), both of those support passing an array of zids (i.e. sensor ids) that you wish to bypass. So, code wise, you have to know the specific devices that need to be bypassed before you call armHome/armAway, itā€™s not just a simple bypass flag.

Just FYI for those waiting for this feature, Iā€™ve published version 4.4.0 which includes a switch to enable ā€œArming Bypass Modeā€. The default state is ā€œoffā€ so no change of existing behavior, however, if ā€œArming Bypass Modeā€ swtich is toggled to ā€œonā€ position then any arming commands will automatically bypass any faulted contact sensors.

You could build some pretty cool automations with this, such as enabling bypass mode only when you are home and are performing arm_home command, or enabling bypass only when certain groups of sensors are faulted while other groups are not, or even a sequence where bypass arming is enabled only if a specific condition is met.

Note that standard arming is always retries 5 times, to give any transient sensor faults time to clear, however, if you toggle the bypass option ā€œonā€ during a retry it will automatically bypass any sensors during the retry event. You can take advantage of this behavior by attempting an arming event, checking in a few seconds if it has succeeded, and then implementing logic to enable bypass only if certain sensors are faulted, then disabling bypass immediately after arming state is achieved.

Basically the possibilities for using bypass options are limited only by your ability to write automations. Feedback is welcome.

1 Like

Hi. Since updating to the newest version (just installed it, didnā€™t reconfigure anything) all my Ring Alarm devices (base station, contact sensors and motion sensors) have just turned to unavailable. The only thing still working is my ring doorbell. No one else have this? Still working fine in the ring appā€¦