npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

homebridge-shinobi

v4.0.0

Published

A Homebridge plugin integrating Shinobi for motion detector cameras

Downloads

82

Readme

homebridge-shinobi

A Homebridge plugin integrating Shinobi for motion detector cameras

Installation

  1. Install Homebridge using: npm install -g homebridge
  2. Install this plugin: npm install -g homebridge-shinobi
  3. Update your configuration file. See a sample config.json snippet below.
  4. Ensure ffmpeg is installed and on the path.

NOTE: Currently there is no support for streaming audio from a camera.

Configuration

Example config.json entry:

"platforms": [
    {
        "platform": "Shinobi",
        "shinobi_api": "http://x.x.x.x:8080",
        "api_key": "xxx",
        "group_key": "house",
        "monitors": [
            {
                "monitor_id": "front"
            },
            {
                "monitor_id": "rear",
                "use_substream": true
            }
        ],
        "web_hook_port": "8443",
        "https_key_path": "/cert/privkey.pem",
        "https_cert_path": "/cert/fullchain.pem",
        "ffmpeg_input_args": "-fflags +genpts",
        "ffmpeg_process_args": "-vsync drop -vcodec copy -an"
    }
]

Where:

  • shinobi_api is the base URL for the Shinobi API
  • api_key is the Shinobi API key (configured in the Shinobi dashboard API menu)
  • group_key is a Shinobi group key
  • monitors contains a list of monitors consisting of:
    • monitor_id
    • use_substream if true will use configured sub-stream for the monitor.
  • web_hook_port is the port that the platform should listen on for motion event webhooks from Shinobi
  • ffmpeg_input_args are the arguments that are applied to the ffmpeg command before the -i flag (add -rtsp_transport tcp for poor network conditions)
  • ffmpeg_process_args are the arguments that are supplied to the ffmpeg command directly after the source stream URL

If the optional properties https_key_path and https_cert_path are configured to point at HTTPS key and cert files available on the Homebridge server the webhook server will be hosted on HTTPS.

Shinobi Integration

The specified shinobi_api and api_key will be used to make all Shinobi API requests.

Each of the specified monitor IDs will be used with the specified group_key to add a new accessory to the platform consistent of a Motion Sensor service and camera.

When viewing video, the plugin will use the information returned from the API for a specific Monitor to determine the source video stream to use with the following logic:

if use_substream == false
  if direct stream URL found in monitor config
    use direct stream URL
  else
    use the first proxy provided by shinobi in monitor config
else
  if direct sub-stream URL found in monitor config
    use direct sub-stream URL
  else
    integrate with the [Shinobi Dynamic Substream Functionality](https://hub.shinobi.video/articles/view/xm9HJFXI1XITt1y)
    use the first proxy provided by shinobi in monitor config

FFmpeg is used to stream from the determined source and forward to HomeKit. If possible, the video will not be re-encoded.

If the dynamic sub-stream functionality is in use, the plugin will:

on CONNECT:
  check substream enable state and toggle to on if required   

on DISCONNECT:
  check substream enable state and toggle to off if required   

Snapshot images for each Monitor are simply pulled from the Shinobi API. To ensure these are available, enable the JPEG API for each configured Monitor:

Edit Monitor

A webhook URL should be configured for each Monitor within the Shinobi 'Global Detector Settings' with the following format:

http[s]://<homebridge_ip>>:<web_hook_port>?mid=<monitors[index].monitor_id>&group=<group_key>

For example, assuming the Homebridge instance is available at 192.168.1.10 and using the above sample config, the two Monitors front and rear would have webhook URLs configured as:

https://192.168.1.10:8443?mid=front&group=house

and

https://192.168.1.10:8443?mid=rear&group=house

Help etc.

If you have a query or problem, raise an issue in GitHub, or better yet submit a PR!