Shinobi Camera Component

I can recommend using MotionEye for your surveilance system. I have 2 dedicated RPi with 4 camera’s each which are sending webhook alerts whenever there is a motion detected.

I’m usinge Node-Red to gather the motion video stream and display it on my TV (via Kodi) or send it to my mobile (via Telegram) when not at home.

I used Shinobi before as well but had problems with the integrations.

HI everyone - so a few people have been having issues with Shinobi and after a bit of messing around here is my successful install (on docker)
so been using Shinobi for a week now (quite a few different builds, but finally found one that works and VERY well too)
they also havent yet documented their Monitor states (set a custom mode like armed, that turns all cameras and motion detector on, or disarmed that sets all cameras motion detectors off)

So here is what i used for a docker set up on Synology…
Using this repo from Gitlab I cloned it

BUT i notice the image was pointing to the dev-microservices build - so i modified that in the docker-compose.yaml to use this:
image: migoller/shinobidocker:microservice-debian

it builds a separated db image and shinobi image.

keep an eye on the docker log, and once shinobi is ready goto:
http://<hostIP>:8080/super

use
username: [email protected]
password: admin

then create a new user account.
navigate http://<hostIP>:8080 and log in with the new account creds.

Add your monitors and use default settings.
In the Streamsection use MJPEG
Then in the Global Detector Settings Enabled = Yes
use defaults, but set indifference to say 2 or 3
Set save to SQL as yes
create regions (save at this point)

Wait for the monitor to update and then go back into settings.
under Motion Detection there is a section to send GET or send command (use as needed to tell HA motion) ie sent to Node-red or HA input_boolean.

Finally under Traditional Recording
set the video encoder to copy
[this will fix the issue where motion wasnt actually being recorded]

Now the ‘New’ monitor state - do this AFTER you have all your monitors set up
click on your username in the top left and click Monitors` and you'll see a list of monitors (and most importantly the URLs - copy the URL to your code editor). now the first part after the port is API Key, the part after /mjpeg/ is the group key``
ie:
http://192.168.1.31:8080/EtyFt0ylv3HQ2ZQzZBhWzDPxsv0NyN/mjpeg/x5Us8AVw59
API Key = EtyFt0ylv3HQ2ZQzZBhWzDPxsv0NyN
Group Key = x5Us8AVw59

To build the url to tell Shinobi what to do in a monitor state first set modes of the monitors within this state:

{
   "monitors": [
      {
         "mid": "monitor1",
         "mode": "start",
         "details": {
            "detector": "1"
         }
      },
      {
         "mid": "monitor2",
         "mode": "stop"
      }
   ]
}

start = WatchOnly (motion triggered if enabled)
stop = disabled
record = continual recording

detector: 0 = motion detection OFF
detector: 1 = motion detection ON

then you chose the name of the monitor state = [NAME OF STATE]

you can then use delete or insert (where insert is also used to modify``

So all assembled URL is:
http://192.168.1.31:8080/EtyFt0ylv3HQ2ZQzZBhWzDPxsv0NyN/monitorStates/x5Us8AVw59/[NAME_OF_STATE]/insert?data={“monitors”:[{“mid”:“monitor1”,“mode”:“start”,“details”:{“detector”:“1”}},{“mid”:“monitor2”,“mode”:“stop”}]}

if you forget or lose track of your monitor states you can get a list by using this url:
http://192.168.1.31:8080/EtyFt0ylv3HQ2ZQzZBhWzDPxsv0NyN/monitorStates/x5Us8AVw59

Hope this helps folks :smiley:

2 Likes

thanks @jaburges :smiley:

I’ve documented the Monitor States thingy :slight_smile: https://shinobi.video/docs/api#content-monitor-states-preset-configurations

1 Like

nice work and thanks again!!

Just got this working today. Now my montion detection is turned on when I set my alarm.

Thanks!

@felixsteghofer i’ve Been using Shinobi for a while now and wondered if you mind me forking your code and using it to learn a little more about how to build a component (and maybe - big maybe as still very new) Add some functionality? Finally got a chance to revisit this so would like to help out if I can?

It would be cool to create motion enable switches for each camera so you can then align different house alarm modes (or cleaners / guests) with different cameras on motion record. (As above a little different to start, stop, record).

It would also be cool to create a binary_sensor then tell Shinobi to send an on and off webhook to the binary sensor to report on motion. Would then be easy to ingest that into HA for other things.

I’ve manually created 2 custom states, and noodling this over in my head, I think this maybe too complex (at least for now) to build into the component. Zoneminder has a state switch in HA, where you specify the states etc. Given the JSON etc I think it maybe easier to just Have a user create a parent switch for the modes they need - say switch.Shinobi_arm_away
Then turn_on:
Camera1 motion on
Camera2 record
Camera3 record

Question if you have time - why did you chose to use the API key straight off the bat, and not use the users admin creds and retrieve the API key for that user? I noticed to have a permanent API key you need to specify an IP (or all with 0.0.0.0) - would it be good practice to use the user creds (and get login feedback) check for an API key, if not one, create one for current IP (or 0.0.0.0)? Trying to understand and learn :slight_smile:

Recently I also implemented a node-red flow downloading the latest video to config/www//latest.mp4
Then on motion when i’m Not home I can get an iOS with the attached video.
Would be interesting to be able make that file available for people to use in the same way (I just used downloader.download_file)

Finally you have hard coded MJPEG, was that just as you used that only? Or could you not get other formats/streams to work? I use HLS and works well in Shinobi as an FFMPEG Camera.
Sorry for all the questions :-p

sure :slight_smile: I am not using Shinobi anymore (no cams) so happy to see someone else improving this.

I played a bit with switches that invoke the Shinobi motion API but my cams did not have a easy way to trigger motions (e.g. over a HTTP POST) so I implemented this on Home Assistant side (like Zoneminder?!, have not looked into their component implementation that much).

It is usually bad practice to store plaintext passwords, usually better to use API keys (that is what “API keys” are meant for) which can be revoked/changed etc.

MJPEG was the protocol that worked best for me (indeed I think it was the only one that worked anyway) but as you can see in my READMEs TODO section that was something I wanted to have a closer look :wink:

1 Like

Awesome, will have a look.
Thank you :slight_smile:

Xeoma is a VERY competent nvr/cctv platform. Not free for the pro version but it is a one time cost per camera. Soon it will come with mqtt support
www.felenasoft.com/xeoma/en/

Hi, and HAPPY NEW YEAR!

As we now have the Hassio Addon, I was wondering if the actual camera component had moved any closed to becoming an official component?

Thanks

I just got the states stuff set up, all working great and now I can trigger my camera to be disabled when I’m home and running on mocap mode when I’m away using the rest_command service in Home Assistant. All working great in Shinobi.

Downside to this is that if I restart Home Assistant with the camera disabled (ie when I’m home!) it doesn’t detect the camera at all (error in log is “no active monitors found”), and so it doesn’t display in the cameras tab I set up in Home Assistant when I’m not home. I have to restart Home Assistant to get it to pick it up.

I don’t really like the idea of the camera being “on” the whole time I’m home so I don’t want to just have it set to “watch only” if I can help it. I suppose I can set up an automation that enables the camera and then restarts home assistant, but is there another way to handle this?

Hey @jaburges, I’m trying to figure out how I can have shinobi tell HA it’s seeing a motion event in one of the cameras. I’ve got a camera (monitor) setup and can’t figure out what to put in this URL field and what I have to do on the HA side to expect it?

I use node-red so sent the request to node-red

So, I am using Shinobi (non-pro) just fine. You need custom URLs in your configuration.yaml file.

1.Get your stream URL from Shinobi Menu>Monitors>Stream column
2. Now you have your Stream URL, but you might need a still images URL if you don’t want to stream video all the time, so rework your URL for stills. Here’s your Video URL
http://<Internal Server URL>/<Auth Key>/jmjpeg/<Your Group Key>/<Camera ID>
Here’s your stills URL
http://<Internal Server URL>/<Auth Key>/jpeg/<Your Group Key>/<Camera ID>/s.jpg

I use an external app for video so I’ve only configured my Stills URL. Here’s configuration.yaml for Shinobi.

camera:
  - platform: generic
    still_image_url: http://<Internal Server URL>/<Auth Key>/jpeg/<Your Group Key>/<Camera ID>/s.jpg 
    name: Front Walkway
    framerate: 1
  - platform: generic
    still_image_url: http://<Internal Server URL>/<Auth Key>/jpeg/<Your Group Key>/<Camera ID>/s.jpg
    name: Street Cam
    framerate: 1

i used motioneye and know discovered shinobi and is so mutch bether please made the addon again

1 Like

If you want, I need some testers for my nascent Shinobi CCTV custom component. If you use HACS and dont mind adding a custom repository add https://github.com/xannor/ha_shinobicctv as an integration and let me know if it works for you. BTW it only supports english right now and I am not sure how it would look if another language is used.

2 Likes

This is excellent, will try it out later.

One (actually 2) of the things that has kept me with Zoneminder using the Object vision hooks docker by dlandon is:

  1. Repeat detection - in shinobi if motion is detected then all things in the camera shot will be called out (the same 2 cars, or same 3 people). Creating kind of false alerts. I used a lot of node-red to look at changes in counted items but it should be simpler.

  2. Retrieving the video of the trigger from the web hook to send to an iOS alert (in Zoneminder its a base URL with event ID) I can not figure out how to send the specific video snippet from the info in the webhook?

I’d be curious as to your thoughts on either of these challenges :slight_smile:

Finally got round to setting up and works a charm - any plans on integration with the API to detect:

  1. Motion
  2. Objects
  3. Faces

I’m interested in this as well. Thanks for the effort.
Ill give it a shot.

Unfortunately, I have had much time to work on it, and right now I am not using it since its ONVIF support was less that I expected. The only motion support it has is either via its own monitors, or via manual trigger. I was hoping it would use the ONVIF events but right now it does not. So in the mean time I am just using an REO integration since that is what my cameras are and all I want is motion notifications in HA.

I was hoping to be able to use it as a centralized “NVR” and use the motion events from the cameras along with its own detector to have fairly accurate motion notification.

The other issue is their API is not very well documented, and motion events is not listed as part of it. It could be they saved that for part of their mobile paid portion.

I will keep an eye on it to see if the Shinobi CCTV projects gets to a point where it will work well with my camera’s, but until then the project is on hold. Anybody can feel free to fork it and continue if they want, and I am open to answering questions on it, I just don’t have the time, nor ambition right now to continue it.