Code Monkey home page Code Monkey logo

ring-hassio's Introduction

ring-hassio

Support the author on Patreon

Archived

This repo has been archived - please consider forking to continue development.

About

A Home Assistant add-on to enable live streams of Ring Cameras. This add-on wraps around Dgreif's excellent work and exposes a livestream.

DOT NOT run this add-on with 24-hour streaming - use this addon by starting it on-demand

Installation

  1. Add this GitHub repository to your supervisor (not HACS) add-on store.
  2. Configure your Ring Refresh Token and port (see configuration below).
  3. Start the "Ring Livestream" add-on. Check for errors in the logs.
  4. For remote access, open up the port in your router.
  5. Open the stream at http://homeassistant.local:port/public/stream.m3u8 to make sure it works before going any further. We recommend using VLC or equivalent.
  6. Add a camera to Home Assistant, such as:
    camera:
      - platform: generic
        name: Ring Livestream
        stream_source: http://homeassistant.local:port/public/stream.m3u8
        still_image_url: http://homeassistant.local:port/public/stream.m3u8
    (Don't worry about the still_image_url not pointing to an actual image, we are not going to use it, but it is required.)
  7. Add a card Picture Glance card to your UI, set the 'Camera Entity` to the camera you have just created.
  8. Done! Enjoy your shiny new livestream!

Configuration

Example configuration:

ring_refresh_token: your_refresh_token
camera_name: Front Door
  • You need to create a refresh token - see https://github.com/dgreif/ring/wiki/Refresh-Tokens on how to do that. Note that you will have to have node and npm installed on your machine.
  • The camera name is the name entred when setting up the camera in the Ring app.

Taking a snapshot

Currently the addon does not support taking snapshots, but when it does this is the configuration you will need: In order to use the snapshot service, you will need to following settings in your configuration.yaml:

homeassistant:
  whitelist_external_dirs:
    - /config/tmp

You can then call the snapshot service like this:

service: camera.snapshot
entity_id: [entityID]
filename: tmp/foo.jpg

Some users reported success to create a snapshot using:

  - platform: ffmpeg
    input: http://hassio.local:port/public/stream.m3u8

Battery conservation

A workaround to start/stop streaming (and avoid quick discharge) in Hassio is to start the addon on demand. To do this set up a sensor and switch:

sensor:
  - platform: rest
    resource: "http://hassio.local:port/api/hassio/addons/xxxxxxxx_ringlivestream/info"
    headers:
      Authorization: "Bearer [Long_Lived_Access_Token]"
      Content-Type: application/json
    name: ring_addon_state
    value_template: "{{value_json['data']['state']}}" 
 
switch:
  - platform: template
    switches:
      ring_live_stream:
        value_template: "{{ is_state('sensor.ring_addon_state', 'started') }}"
        turn_on:
          service: hassio.addon_start
          data:
            addon: xxxxxxxx_ringlivestream
        turn_off:
          service: hassio.addon_stop
          data:
            addon: xxxxxxxx_ringlivestream
  • for the sensor you will need the URL of the Info page on the Ring Livestream add-on page.
  • a [Long_Lived_Access_Token] can be generated on your profile page in Home Assistant (https://hassio.local:port/profile), scroll all the way to the bottom.
  • To get the 8 chars code "xxxxxxxx_ringlivestream" get them from the same URL.

ring-hassio's People

Contributors

brahmah avatar derekl0576 avatar dgreif avatar harryjholmes avatar jeroenterheerdt avatar luci-11 avatar richardhopton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ring-hassio's Issues

addon dont work

Hello,

Thank you for this addon.
I have installed the token but I have this error and I can't access the cameras.

[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. (node:198) UnhandledPromiseRejectionWarning: HTTPError: Response code 500 (Internal Server Error) at Request.<anonymous> (/ring-hassio/ring_hassio/node_modules/got/dist/source/as-promise/index.js:117:42) at processTicksAndRejections (internal/process/task_queues.js:95:5) (Use node --trace-warnings ...to show where the warning was created) (node:198) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:198) [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. [cmd] /ring-hassio/ring_hassio/run.sh exited 0 [cont-finish.d] executing container finish scripts... [cont-finish.d] done. [s6-finish] waiting for services.

Can you help me?

Ring token

Thanks for detailed steps, it was a breeze to follow but got stuck at the last one.

Where exactly in Home Assistant (which file or section) to add following:

{
"ring_refresh_token": your_refresh_token
}
Any pointers in README would be awesome!

UnhandledPromiseRejectionWarning: HTTPError: Response code 404 (Not Found)

Hello there,

First of all, thank you for this amazing add-on :)
It is one of the reason I moved my HomeAssistant configuration from Docker to a VM so I can use it.

It was working perfectly until the beginning of this week, the add-on doesn't start anymore and I have the following message inside the logs:

[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.
(node:198) UnhandledPromiseRejectionWarning: HTTPError: Response code 404 (Not Found)
    at Request.<anonymous> (/ring-hassio/ring_hassio/node_modules/got/dist/source/as-promise/index.js:117:42)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:198) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:198) [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.
[cmd] /ring-hassio/ring_hassio/run.sh exited 0
[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 tried the following actions but it still not working:

  • re-install the add-on (Current version: 1.35)
  • generate a new token
  • make sure that the device name match the one defined in Ring Application.

Any idea where the issue might come from?

Thanks in advanced for your answer,

Tom

Not getting the stream to work

Hello and thanks for this amazing add-on

I've followed the installation and started the Ring Livestream. I've checked the refresh token many times and I've also opened the correct ports. But no live stream. I am new to programming and making everything work.

[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.
Checking If Voordeur Is the same as the camera we are looking for (Front Door)
output directory: public/
Started server, listening on port 3000.
(node:198) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'streamVideo' of undefined
    at /ring-hassio/ring_hassio/livestream.js:194:53
    at step (/ring-hassio/ring_hassio/livestream.js:34:23)
    at Object.next (/ring-hassio/ring_hassio/livestream.js:15:53)
    at fulfilled (/ring-hassio/ring_hassio/livestream.js:6:58)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:198) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:198) [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.

Maybe you could help me fix it.

Unclear on start/stop

I am unclear on what to sub for the xxxxxxxx in resource: "http://hassio.local:port/api/hassio/addons/xxxxxxxx_ringlivestream/info".

The description says "To get the 8 chars code "xxxxxxxx_ringlivestream" get them from the same URL." but that makes it sound like I need the xxxxxxxx to even get to the URL. Which URL? Can anyone clarify these instructions for me?

Also, I understand making the sensor and switch, but how do you actually toggle the switch? The add-on works great, but it is constantly running and, as pointed out in another issue, this stops me from getting motion notifications from Ring.

Thanks @jeroenterheerdt for your work on this!

Error installing this addon

Not sure why it doesn't want to install? (HassOS 3.8)
20-02-08 04:37:12 INFO (SyncWorker_10) [hassio.docker.addon] Start build d4b7a20a/armv7-addon-ringlivestream:0.0.2
20-02-08 04:37:21 ERROR (SyncWorker_10) [hassio.docker.addon] Can't build d4b7a20a/armv7-addon-ringlivestream:0.0.2: The command '/bin/bash -o pipefail -c apk add --no-cache nodejs=12.14.0-r0 npm=12.14.0-r0 ffmpeg git && cd / && git clone https://github.com/jeroenterheerdt/ring-hassio && cd ring-hassio/ring_hassio && npm install --unsafe-perm && chmod a+x run.sh' returned a non-zero code: 2

hass.io on Synology DSM - docker does not start

Hi @jeroenterheerdt
This docker seems all setup as per the instructions, however at start it throws the following and exits. I have failed to run this in the manual mode also, unfortunately.

I am testing this on a Synology DSM DS918+ - this might be the reason...but you can feel how close you are...ideas?

ifelse: fatal: unable to exec /ring-hassio/ring_hassio/run.sh: Exec format error | stderr
[cmd] /ring-hassio/ring_hassio/run.sh exited 126 | stdout
[cont-finish.d] executing container finish scripts... | stdout
[cont-finish.d] done. | stdout
[s6-finish] waiting for services. | stdout
[s6-finish] sending all processes the TERM signal.

Install fails

Hi,

Added this repo to the add-in store and hit the install button on the ring-hassio add in page.

Nothing, just spins its wheels for as long as you have patience for (I left it running for 10 mins..), no error messages in the logs or on screen.

Worse still, this totally bricked my HA install, everything stopped working, including those services working in other docker containers run by the HassOS supervisor. First time I've had to physically power off my system in 18 months...

arch armv7l
chassis embedded
dev false
docker true
docker_version 19.03.11
hassio true
host_os HassOS 4.12
installation_type Home Assistant OS
os_name Linux
os_version 4.19.127-v7
python_version 3.8.3
supervisor 235
timezone Europe/London
version 0.114.3
virtualenv false

Won't install:

Not sure why it won't install but it gives me this message:

The command '/bin/bash -o pipefail -c apk add --no-cache nodejs npm ffmpeg git && cd / && git clone https://github.com/jeroenterheerdt/ring-hassio && cd ring-hassio/ring_hassio && npm install --unsafe-perm && chmod a+x run.sh' returned a non-zero code: 4

Full log from supervisor:
21-02-06 12:31:05 INFO (SyncWorker_3) [supervisor.docker.addon] Starting build for 44c60309/armv7-addon-ringlivestream:1.35
21-02-06 12:31:09 ERROR (SyncWorker_3) [supervisor.docker.addon] Can't build 44c60309/armv7-addon-ringlivestream:1.35: The command '/bin/bash -o pipefail -c apk add --no-cache nodejs npm ffmpeg git && cd / && git clone https://github.com/jeroenterheerdt/ring-hassio && cd ring-hassio/ring_hassio && npm install --unsafe-perm && chmod a+x run.sh' returned a non-zero code: 4
21-02-06 12:31:09 ERROR (SyncWorker_3) [supervisor.docker.addon] Build log:
Step 1/13 : ARG BUILD_FROM

Step 2/13 : FROM $BUILD_FROM

---> 21461176cb52

Step 3/13 : ENV LANG C.UTF-8

---> Using cache

---> c3ae1ed6f3ba

Step 4/13 : SHELL ["/bin/bash", "-o", "pipefail", "-c"]

---> Using cache

---> bdeeff9fa32f

Step 5/13 : EXPOSE 3000/tcp

---> Using cache

---> 2a77a3157c48

Step 6/13 : RUN apk add --no-cache nodejs npm ffmpeg git && cd / && git clone https://github.com/jeroenterheerdt/ring-hassio && cd ring-hassio/ring_hassio && npm install --unsafe-perm && chmod a+x run.sh

---> Running in 225fe263cc2e

fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/armv7/APKINDEX.tar.gz

WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/main: temporary error (try again later)

fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/armv7/APKINDEX.tar.gz

WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/community: temporary error (try again later)

ERROR: unable to select packages:

ffmpeg (no such package):
required by: world[ffmpeg]
git (no such package):
required by: world[git]
nodejs (no such package):
required by: world[nodejs]
npm (no such package):
required by: world[npm]

Removing intermediate container 225fe263cc2e

Live Mode always on preventing motion/door bell notifications

Hi there,

I was finally able to get this installed but now I'm not getting motion notifications at all. I looked at my ring app history and noticed that it shows that live view is being accessed all the time which is preventing the notifications because it thinks someone is watching. Has anyone else came across this issue?

Thank you,
Kayla

+-10 second delay on livestream

Hey @jeroenterheerdt , thanks for the great work on the plugin. I'm currently trying it out with my ring doorbell 2 and it all seems to work, except that I always have a delay of +-10 seconds when viewing.

Steps tried:

  1. I start the plugin
  2. I open up home assistant with the camera feed (tried with VLC too, same effect)
  3. I walk to my door, and all video has this 10s delay

When I watch the live feed with the official ring app, I don't have any delay (< 1s).

Do you experience the same?

Home Assistant Full Snapshot from 16 to 150 Mb

Yesterday I implemented your repository into my Home Assistant.
Everything works fine. Every day I make a full snapshot.
Yesterday, before installation of your repository the full snapshot file was 16 Mb.
The snapshot today is 150 Mb!
Can you clarify this and eventually how to avoid this high disk usage

ring doorbell does not communicate

Hello, I have noticed that when I turn on the addon, the ring doorbell device does not communicate when someone presses the doorbell, I mean that at the HA level and in the ring app there is no notification of any kind until a few minutes have passed.
Sorry for my English, the google translator is helping me.

Image is always 0KB

Everything works as in the addon starts and turns off and the file is created but its 0KB. If I delete the actual file it creates, sometimes it doesnt even create a new file for some reason but the addon is running

I have a delay of 8 seconds and also increased to 12 seconds to give the addon time to load. Thats too long as what ever may happen, would have happened but I understand the addon needs to load up. Am I missing something here ?

I have a CCTV camera too and that works no problems. Its just the Ring doorbell

Does anyone else have this issue or got around it ?

Thanks

Can't seem to retrieve the stream

I've installed the add-on and followed the installation.

I can get the stream to work on VLC, but I can't get it to work on the video streamer on HA. Also the on/off is not working, but that might be because of the stream not working. I didn't get an error.

Error Call has ended - Restarting server - Server closed! and no livestream

Hi,
Yesterday I was able to start and stop the add-on and after a start I received livestreams.
After start of the add-on today I got below log:

[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.
Checking If Voordeur Is the same as the camera we are looking for (Voordeur)
Matched Voordeur
output directory: public/
Started server, listening on port 3000.
Call has ended
Restarting server
Server closed!
(node:198) UnhandledPromiseRejectionWarning: Error: SIP request made after call was destroyed
at SipCall.request (/ring-hassio/ring_hassio/node_modules/ring-client-api/lib/api/sip-call.js:117:35)
at SipCall.sendKeyFrameRequest (/ring-hassio/ring_hassio/node_modules/ring-client-api/lib/api/sip-call.js:188:21)
at SipCall. (/ring-hassio/ring_hassio/node_modules/ring-client-api/lib/api/sip-call.js:216:24)
at Generator.next ()
at fulfilled (/ring-hassio/ring_hassio/node_modules/ring-client-api/lib/api/sip-call.js:5:58)
(node:198) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:198) [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.
Checking If Voordeur Is the same as the camera we are looking for (Voordeur)
Matched Voordeur
output directory: public/
Started server, listening on port 3000.

Restarted Home Assistant, tried again and it worked for 1 time (below normal log in working order).
What could be the reason of the above behaviour, and more important, could it be resolved?

[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.
Checking If Voordeur Is the same as the camera we are looking for (Voordeur)
Matched Voordeur
output directory: public/
Started server, listening on port 3000.
socket 0 opened
requested uri: /public/stream.m3u8
mapped filename: public/stream.m3u8
sending file: public/stream.m3u8
socket 1 opened
socket 0 closed
requested uri: /public/stream19.ts
mapped filename: public/stream19.ts
sending file: public/stream19.ts
socket 2 opened
requested uri: /public/stream20
And so on....

Two Factor Authentication

Hi,

Thank you for this great add-on, it is what I was looking for a long time!

I cannot seem to get it to work however. After starting the addon I get the following error:

[services.d] done.
(node:195) UnhandledPromiseRejectionWarning: Error: Your Ring account is configured to use 2-factor authentication (2fa).  See https://github.com/dgreif/ring/wiki/Two-Factor-Auth for details.
    at RingRestClient.<anonymous> (/ring-hassio/ring_hassio/node_modules/ring-client-api/lib/api/rest-client.js:121:27)
    at Generator.throw (<anonymous>)
    at rejected (/ring-hassio/ring_hassio/node_modules/ring-client-api/lib/api/rest-client.js:6:65)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
(node:195) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:195) [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.
[cmd] /ring-hassio/ring_hassio/run.sh exited 0

The page linked doesn't exist, but after digging through the issues in the used library I found that Ring has enabled 2FA by default, and it should now work through an access token (see dgreif/ring#256 and https://github.com/dgreif/ring/wiki/Refresh-Tokens).
The only option in this add-on however is to input username and password.

How can I get it to work with the refresh tokens?

Stream not streaming in HASS

Hi i installed you addon, and followed the installation guide, and the settings seems to be working.
Because when i start the addon, and open web ui i can see the stream.

But the generic camera i setup in hass, is not working and not showing in the interface. settings for the camera:

platform: generic
name: Front door live
stream_source: http://***:3000/public/stream.m3u8
still_image_url: http://***:3000/public/stream.m3u8

When i check the log on has i do get a error.

Logger: homeassistant.components.generic.camera
Source: components/generic/camera.py:162 
Integration: generic (documentation, issues) 
First occurred: 1:15:27 AM (2996 occurrences) 
Last logged: 1:34:56 AM

Error getting new camera image from Front door live: Server disconnected
Error getting new camera image from Front door live: Cannot connect to host ***:3000 ssl:default [Connect call failed ('***, 3000)]
Error getting new camera image from Front door live: [Errno 104] Connection reset by peer

Can you please tell my what may be causing this error? (Log)

[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. output directory: public/ Started server, listening on port 3720. Call has ended Server closed! /ring-hassio/ring_hassio/node_modules/rxjs/internal/util/hostReportError.js:4 setTimeout(function () { throw err; }, 0); ^ TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received an instance of Object at Object.unlinkSync (fs.js:1126:10) at SafeSubscriber._next (/ring-hassio/ring_hassio/livestream.js:202:28) at SafeSubscriber.__tryOrUnsub (/ring-hassio/ring_hassio/node_modules/rxjs/internal/Subscriber.js:205:16) at SafeSubscriber.next (/ring-hassio/ring_hassio/node_modules/rxjs/internal/Subscriber.js:143:22) at Subscriber._next (/ring-hassio/ring_hassio/node_modules/rxjs/internal/Subscriber.js:89:26) at Subscriber.next (/ring-hassio/ring_hassio/node_modules/rxjs/internal/Subscriber.js:66:18) at ReplaySubject.Subject.next (/ring-hassio/ring_hassio/node_modules/rxjs/internal/Subject.js:60:25) at ReplaySubject.nextInfiniteTimeWindow (/ring-hassio/ring_hassio/node_modules/rxjs/internal/ReplaySubject.js:48:31) at SipSession.callEnded (/ring-hassio/ring_hassio/node_modules/ring-client-api/lib/api/sip-session.js:176:33) at SafeSubscriber._next (/ring-hassio/ring_hassio/node_modules/ring-client-api/lib/api/sip-session.js:149:35) { code: 'ERR_INVALID_ARG_TYPE' } [cmd] /ring-hassio/ring_hassio/run.sh exited 1 [cont-finish.d] executing container finish scripts... [cont-finish.d] done. [s6-finish] waiting for services. [s6-finish] sending all processes the TERM signal.

Thank you

fatal: unable to exec /ring-hassio/ring_hassio/run.sh: Exec format error

Hi
I have just installed this addon on hassio and get the following errors:

[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 /ring-hassio/ring_hassio/run.sh: Exec format error [cmd] /ring-hassio/ring_hassio/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.

Not sure if anyone else has the same problem? I am running on an arm instance so that shouldn't be an issue but do have 2fa enabled?

Live view isn't live

When I view my live stream, I'm getting an old view (as long ago as three days sometimes). I just started the service and viewed a car driving by 10 minutes ago. Now, every time I view, the same stream of that car going by plays. What is going on with this?

Livestream is not working

I installed everything according to the instructions on raspberry pi 4. I generated a token. I have defined a new camera as well. The broadcast transmission window starts but the broadcast is not available.

@curl:

curl -i 'http://local:3000/public/stream.m3u8'
HTTP/1.1 200 OK
Content-Type: application/vnd.apple.mpegurl
Date: Wed, 26 Aug 2020 16:49:27 GMT
Connection: keep-alive
Transfer-Encoding: chunked

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:17
#EXTINF:1.920000,
stream17.ts
#EXTINF:2.048000,
stream18.ts
#EXTINF:1.920000,
stream19.ts
#EXTINF:1.920000,
stream20.ts
#EXTINF:1.920000,
stream21.ts
#EXTINF:1.920000,
vstream22.ts

@logs:

[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.
output directory: public/
Started server, listening on port 3000.
socket 0 opened
requested uri: /public/stream.m3u8
mapped filename: public/stream.m3u8
sending file: public/stream.m3u8
socket 0 closed
Call has ended
Restarting server
Server closed!
output directory: public/
Started server, listening on port 3000.

Unfortunately stream is not available in home assistant and vlc as well.

Works for 10-15 seconds

Watching it in VLC works for 15 seconds than I get:
socket 1 closed
err: Error: remote peer disconnected
at TLSSocket. (/ring-hassio/ring_hassio/node_modules/sip/sip.js:584:43)
at TLSSocket.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1220:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
err: Error: remote peer disconnected
at TLSSocket. (/ring-hassio/ring_hassio/node_modules/sip/sip.js:584:43)
at TLSSocket.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1220:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
err: Error: remote peer disconnected
at TLSSocket. (/ring-hassio/ring_hassio/node_modules/sip/sip.js:584:43)
at TLSSocket.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1220:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Call has ended

Any ideas?

Update to the latest ring api

You are currently on 6.1.1 which is way old. He fixed quite a few things with streaming that works in all home router setups. Mine was not able to work until I updated to the latest....FYI.

file not found - No stream

I have an unraid server with a Hassio VM. I installed ring-hassio in Supervisor Add-ons and configured it with a Refresh Token and I start it. All seems well except there is no stream in Web or in VLC. If i go to the /public/stream.m3u8 url I only see:

file not found: %s

Log only shows:


[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.
Checking If Ring Cam Is the same as the camera we are looking for (Ring Cam)
Matched Ring Cam
output directory: public/
Started server, listening on port 3000.
socket 0 opened
requested uri: /index.html
requested uri: /favicon.ico
mapped filename: favicon.ico
file not found: favicon.ico
socket 0 closed
socket 1 opened
requested uri: /public/stream.m3u8
mapped filename: public/stream.m3u8
sending file: public/stream.m3u8
requested uri: /public/stream.m3u8
mapped filename: public/stream.m3u8
sending file: public/stream.m3u8
socket 1 closed
err: Error: remote peer disconnected
at TLSSocket. (/ring-hassio/ring_hassio/node_modules/ring-client-api/lib/api/sip.js:557:38)
at TLSSocket.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1317:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
Call has ended
Restarting server
Server closed!
Checking If Ring Cam Is the same as the camera we are looking for (Ring Cam)


It repeats continuously from "Checking if..." all the way down to the err. If it matters I can load the camera in the ring app. I also did try removing and re-adding ring-hassio. Very new to HA so probably something I did :)

Improvement to add-on with on demand configuration

I saw your add-on and thought it can be improved using a setup that I have on my home assistant server.

It uses https://github.com/aler9/rtsp-simple-server which is an awesome golang based rtsp server / client in combination with https://github.com/dgreif/ring.

It supports on demand automatically and only uses one ring stream no matter how many clients connect, and by not using HLS and using only rtsp it avoids the 10 second minimum lag that HLS has.

My nodejs script that calls dgreif/ring forwards all its arguments to ffmpeg and looks like this

import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { readFile, writeFile } from 'fs/promises';
import ringClientApi from 'ring-client-api';

const CONFIG_PATH = process.env.CONFIG_PATH || '/etc/ring-ffmpeg.json';

async function updateSavedToken({ newRefreshToken, oldRefreshToken }) {
	console.log('Refresh Token Updated: ', newRefreshToken);
	if (!oldRefreshToken) return;
	const currentConfig = await readFile(CONFIG_PATH, 'utf8');
	const updatedConfig = currentConfig.replace(oldRefreshToken, newRefreshToken);
	await writeFile(CONFIG_PATH, updatedConfig);
}

const ffmpegArgs = { 
	audio: [], video: [],
	output: process.argv.slice(2),
};

async function main() {
	const { refreshToken, ffmpegPath } = JSON.parse(await readFile(CONFIG_PATH, 'utf8'));
	const ringApi = new ringClientApi.RingApi({ ffmpegPath, refreshToken });
	ringApi.onRefreshTokenUpdated.subscribe(updateSavedToken);
	const [camera] = await ringApi.getCameras();
	const session = await camera.createSipSession({ skipFfmpegCheck: true });
	await session.start(ffmpegArgs);
}

// handle exit signals
for (const signal of ['SIGINT','SIGTERM','SIGQUIT']) {
	process.on(signal, () => {
		console.log(`Received ${signal}, exiting...`);
		process.exit();
	});
}

main();

The script can be easily adapted to take in refreshToken from the environment instead of a file.

Then in rtsp-simple-server I take advantage of an option where it can launch on demand only when someone actually tries to request an rtsp stream and it will stop streaming as soon as all clients disconnect, it will also duplicate the stream if multiple connections are made, and so only one connection will be made to ring even if many connections are made to rtsp-simple-server. My config looks like this:

rtspDisable: no
protocols: [tcp]
rtspAddress: 127.0.0.1:8554

rtmpDisable: yes

hlsDisable: no
hlsAddress: 127.0.0.1:8888
hlsSegmentCount: 4
hlsSegmentDuration: 2s

paths:
  all:
    fallback:
    disablePublisherOverride: no

  ring:
    source: record
    runOnDemand: /usr/local/lib/ring-ffmpeg/index.mjs -acodec aac -vcodec copy -f rtsp rtsp://localhost:$RTSP_PORT/$RTSP_PATH
    runOnDemandRestart: yes
    runOnDemandStartTimeout: 20s
    runOnDemandCloseAfter: 5s

The key part is that when using runOnDemand rtsp-simple-server will do the work of running the binary and closing it when home assistant disconnects, and it will dynamically open a port and tell the node script what port to send out to.

Combining these two items we can have a true on demand rtsp stream very easily.

Issue with HTTP

This add on seems to use http.
my HA is secured with HTTPS inside and outside.
Does this interfere with the way livestream works as its an HTTP URL ?
any ways to update the stream URL to https ?
I see in the logs the following error

Error opening stream http://:3000/public/stream.m3u8

Logger: libav.tcp
Source: components/stream/worker.py:79
First occurred: 10:50:24 AM (10 occurrences)
Last logged: 11:41:57 AM

Connection to tcp://:3000 failed: Connection refused

Do i have to go back to using NGINX to use Reverse proxy and have secure access only from outside home and leave LAN on HTTP ?

How do HA users using this plugin, securely access the live stream ?

file not found

Ive built my own container based on your Dockerfile to run without HassIO. (modified to make options.json give the correct values in run.sh)

When running the server:

output directory: public/
Started server, listening on port 3000.
socket 0 opened
requested uri: /public/stream.m3u8
mapped filename: public/stream.m3u8
file not found: public/stream.m3u8
socket 0 closed

curl:

$ curl -i 'http://192.168.67.11:3000/public/stream.m3u8'
HTTP/1.1 404 Not Found
Content-Type: text/plain
Date: Wed, 22 Jul 2020 08:49:08 GMT
Connection: keep-alive
Transfer-Encoding: chunked

file not found: %s

Is there any way to increase logging?

Battery Conservation

This add on is great by the way. I can access ring doorbell streams successfully. I am trying to conserve the battery of the doorbell and the connection doesn't seem to close when home assistant stops viewing the stream. Looking at the logs the stream numbers just keeps increasing. Is there anyway to stop streaming and reopen upon new connection.

Thanks in Advance
@jeroenterheerdt

Default Ring addon url?

I want to create a sensor to detect if the addon is active or not.
My HA runs in a VM with Debian, so my OS is Home Assistant OS 5.10.
I had a look to find the addon in the HA filestructure but couldn't find it.
The config folder has a subfolder 'addons' but this folder is empty

How to take screenshots

Hi There,

Thanks for the 1.3 update! Fixes the previous issue ๐Ÿ‘

Can you help with more details on how to take screenshots?

Attempting to use the following creates a .m3u8 file into the .jpg file:

service: camera.snapshot
entity_id: [entityID]
filename: tmp/foo.jpg

foo.jpg:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:28
#EXTINF:2.000000,
stream28.ts
#EXTINF:2.000000,
stream29.ts
#EXTINF:2.000000,
stream30.ts
#EXTINF:2.000000,
stream31.ts
#EXTINF:2.000000,
stream32.ts
#EXTINF:2.000000,
stream33.ts

I am trying to mainly use the add-on to take screenshots and notify my devices of any rings, so this is key :)

Thank you!

Create sensor to understand when the addon is ready

I have managed to create a switch in the configuration as suggested under "Battery Conservation" section of the github README page.
I am now trying to record a stream by enabling the addon after motion is detected by the official Ring addon (via binary_sensor_front_motion).
If I create a single automation with following actions: <1> switch ring-hassio addon ON, <2>record mp4 file from the livestream, <3>switch ring-hassio OFF --> the automation does not seem to work and I never get <2> to record the stream. (it seems the ring-hassio addon does not get enabled by <1>)
If I run three separate automations <1>, followed by <2>, then <3>, I get my recording stored correctly, and with automation <3> the livestream gets correctly turned off, so that I can catch motions with the official Ring App.
What am I doing wrong? Do I need to add any waits in the single automation?

I attempted to create the addon sensor with "platform:rest" in the configuration, after grabbing the [Long_Lived_Access_Token] from the (https://hassio.local:port/profile) page, as described in the README, but I cannot see any sensor after rebooting HA.
Having a sensor would help debugging the single automation.

Use docker without Hass.io

What is the suggested image to build from? Can you add steps in the README for building the image and running container for those not using Hassio.

Cant install addon

The command '/bin/bash -o pipefail -c apk add --no-cache nodejs npm ffmpeg git && cd / && git clone https://github.com/jeroenterheerdt/ring-hassio && cd ring-hassio/ring_hassio && npm install --unsafe-perm && chmod a+x run.sh' returned a non-zero code: 4

Shows after trying to install addon from store

Unable to add to Motioneye

Hi everyone,
the livestream works great in vlc or frontend, but I'm trying to add it to motioned but it says "non supported network camera". Checking on internet I found that it might be a problem of url: I need the mjpeg url instead of the normal one. Is there a way to find this mjpeg url?
Thanks in advance for the help!

Installation Token required

Hello, I guess I'm too stupid. Use HA Hassoio, core-2021.4.4, supervisor-2021.03.9. How can I install the token update, including the missing programs?

installation doesn't work...

I'have tried several times to install ring-hassio but it has been always unsuccessful...
my logs said
`21-03-23 08:16:45 INFO (SyncWorker_2) [supervisor.docker.addon] Starting build for f9d01d82/aarch64-addon-ringlivestream:1.35
21-03-23 08:16:53 ERROR (SyncWorker_2) [supervisor.docker.addon] Can't build f9d01d82/aarch64-addon-ringlivestream:1.35: The command '/bin/bash -o pipefail -c apk add --no-cache nodejs npm ffmpeg python git && pip install flask flask_restful json subprocess os cd / && git clone https://github.com/uvejota/ring-hassio && cd ring-hassio/ring_hassio && npm install --unsafe-perm && chmod a+x run.sh' returned a non-zero code: 1
21-03-23 08:16:53 ERROR (SyncWorker_2) [supervisor.docker.addon] Build log:
Step 1/13 : ARG BUILD_FROM
Step 2/13 : FROM $BUILD_FROM
---> 4412fd7c8229
Step 3/13 : ENV LANG C.UTF-8
---> Using cache
---> 161c176f2921
Step 4/13 : SHELL ["/bin/bash", "-o", "pipefail", "-c"]
---> Using cache
---> b8fd85ad8e54
Step 5/13 : EXPOSE 3000/tcp
---> Using cache
---> eaed256c9593
Step 6/13 : RUN apk add --no-cache nodejs npm ffmpeg python git && pip install flask flask_restful json subprocess os cd / && git clone https://github.com/uvejota/ring-hassio && cd ring-hassio/ring_hassio && npm install --unsafe-perm && chmod a+x run.sh
---> Running in 840d9f13096d
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/aarch64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/aarch64/APKINDEX.tar.gz
ERROR: unable to select packages:

python (no such package):
required by: world[python]
Removing intermediate container 840d9f13096d`

and my config is :

System Health

version core-2021.3.4
installation_type Home Assistant OS
dev false
hassio true
docker true
virtualenv false
python_version 3.8.7
os_name Linux
os_version 5.4.83-v8
arch aarch64
timezone Europe/Paris
Home Assistant Community Store
GitHub API ok
Github API Calls Remaining 4924
Installed Version 1.11.3
Stage running
Available Repositories 778
Installed Repositories 17
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Hass.io
host_os Home Assistant OS 5.12
update_channel stable
supervisor_version supervisor-2021.03.6
docker_version 19.03.13
disk_total 28.6 GB
disk_used 3.3 GB
healthy true
supported true
board rpi4-64
supervisor_api ok
version_api ok
installed_addons Samba share (9.3.0), File editor (5.2.0), Terminal & SSH (9.1.0), Duck DNS (1.12.5), SQLite Web (3.0.1), AppDaemon 4 (0.5.0)
Lovelace
dashboards 1
resources 12
views 13
mode storage

Cannot read property 'streamVideo' of undefined at /ring-hassio/ring_hassio/livestream.js:194:53

Hi , I ended up with 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.
Checking If Ingresso principale Is the same as the camera we are looking for (Front Door)
output directory: public/
Started server, listening on port 3000.
(node:198) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'streamVideo' of undefined
at /ring-hassio/ring_hassio/livestream.js:194:53
at step (/ring-hassio/ring_hassio/livestream.js:34:23)
at Object.next (/ring-hassio/ring_hassio/livestream.js:15:53)
at fulfilled (/ring-hassio/ring_hassio/livestream.js:6:58)
(node:198) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:198) [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.
socket 0 opened
socket 0 closed
socket 1 opened
socket 2 opened
requested uri: /
requested uri: /public/stream.m3u8
mapped filename: public/stream.m3u8
file not found: public/stream.m3u8
socket 2 closed
socket 1 closed
socket 3 opened
socket 4 opened
requested uri: /index.html
requested uri: /public/stream.m3u8
mapped filename: public/stream.m3u8
file not found: public/stream.m3u8
socket 4 closed
socket 3 closed
socket 5 opened
socket 6 opened
requested uri: /public/stream.m3u8
mapped filename: public/stream.m3u8
file not found: public/stream.m3u8
socket 6 closed
socket 5 closed

Device RING Video Doorbell Elite
Can you please help me ?

Video doesn't play from the HA lovelace UI

Addon is running. Opening the URL in VLC shows the video stream. But when clicking on the camera in the UI it keeps showing the spinning wheel.

When inspecting the HTML this is the video part:

When I open the http piece in the browser I get a 404 not found error

This is the entry in my configuration.yaml

camera:

Support for multiple cameras

I have several ring security cameras in addition to the doorbell. This is working for the doorbell but can this be configured to support the security cameras also?

Refresh Tokens now have an expiry.

The referenced refresh token material in the readme now indicates that Ring added an expiry to the refresh tokens. It seems it is now required to continuously update the token and store the value locally. Can this functionality be added to this project?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.