Shinobi - CCTV video software

Have you been able to get this to work with the http binding? I am trying:

Switch  Camera_01   "Force Alarm [%s]"  <switch>  (Motion)  {http=">[ON:POST:http://10.88.64.201:8080/r0g0Ni3BlVGNo5dMSLOyhLzMWWpskDWh/monitor/0nHEcQE/001/record] >[OFF:POST:http://10.88.64.201:8080/r0g0Ni3BlVGNo5dMSLOyhLzMWWpskDWh/monitor/0nHEcQE/001/start]"}
Switch  Camera_02   "Force Alarm [%s]"  <switch>  (Motion)  {http=">[ON:POST:http://10.88.64.202:8080/EwxVKJdtCQKoi6QcDfzjDxc5VxMk9TCx/monitor/Zulg439/002/record] >[OFF:POST:http://10.88.64.202:8080/EwxVKJdtCQKoi6QcDfzjDxc5VxMk9TCx/monitor/Zulg439/002/start]"}
Switch  Camera_03   "Force Alarm [%s]"  <switch>  (Motion)  {http=">[ON:POST:http://10.88.64.203:8080/Au7LgNWaDNb2P5FcogC0Mx8BQa0zxrzT/monitor/Jw41yUR/003/record] >[OFF:POST:http://10.88.64.203:8080/Au7LgNWaDNb2P5FcogC0Mx8BQa0zxrzT/monitor/Jw41yUR/003/start]"}

It does not like POST for some reason, but it does work with CURL.

[root@lisa openhab2]# curl http://10.88.64.203:8080/Au7LgNWaDNb2P5FcogC0Mx8BQa0zxrzT/monitor/Jw41yUR/003/record
{
   "ok": true,
   "msg": "Monitor mode changed : record",
   "cmd_at": "2018-01-26 15:35:48"
}[root@lisa openhab2]# curl http://10.88.64.203:8080/Au7LgNWaDNb2P5FcogC0Mx8BQa0zxrzT/monitor/Jw41yUR/003/start
{
   "ok": true,
   "msg": "Monitor mode changed : start",
   "cmd_at": "2018-01-26 15:35:52"
}[root@lisa openhab2]#

I think by default curl does a GET, not a POST. A quick scan of the API looks like all of these commands are expecting GETS so try using that in your Items and see if that works.

2 Likes

Changed from POST to GET and now it works!

1 Like

@sipvoip @rlkoshak This was actually my first change to play with the API, and I’ve had the same success with GET! I’m really happy you guys both like it so far.

@rlkoshak I agree that it looks like Shinobi doesn’t currently have a way to share its motion events via its API, though I’m going to install the motion plugin and play around with it.

It looks like there’s a plugin in development to connect Home Assistant and Shinobi, though it doesn’t look like importing motion events is an option yet there either. I’ll plan to keep an eye on their efforts, though I doubt I have the skills to duplicate it in a binding.

I posted a question about this over on the Shinobi forum.

1 Like

I’m happy to report that I have motion events successfully importing in to openHAB!

My Items file:

Switch  Camera_01_Force     "Force Alarm [%s]"    {http=">[ON:GET:http://192.168.1.2:8082/[apikey]/monitor/[groupkey]/[monitorid]/record] >[OFF:GET:http://192.168.1.2:8082/[apikey]/monitor/[groupkey]/[monitorid]/start]"}
Switch  Camera_02_Force     "Force Alarm [%s]"    {http=">[ON:GET:http://192.168.1.2:8082/[apikey]/monitor/[groupkey]/[monitorid]/record] >[OFF:GET:http://192.168.1.2:8082/[apikey]/monitor/[groupkey]/[monitorid]/start]"}
Switch  Camera_01_Motion    "Camera 1 Motion"     {expire="1m,OFF"}
Switch  Camera_02_Motion    "Camera 2 Motion"     {expire="1m,OFF"}

Then I followed the instructions on the Shinobi Motion Detection docs page to get the motion detection plugin working.

Next, I opened up my monitor settings pages (each one is done separately. Hit “Advanced” at the bottom, and make sure it says “Detector: Motion Connected” on the left. Click that heading, turn Enabled to “Yes,” and Command on Trigger, to “Yes.” Then, put the curl command in the “command” field - here’s one of mine:

curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "http://192.168.1.2:8080/rest/items/Camera_01_Motion"

I’d also suggest making a few tweaks. Mine was way too sensitive so I turned the “indifference” up to 500 (in both the monitor page and the region edit page), though I’ll need to mess with it further. I’d also turn “Allow Next Command” down significantly, I set mine to 1 to match the minute in the Expire binding.

And, it works! I can’t believe it was that easy.

6 Likes

Goodbye Zoneminder, hello Shinobi!

Thanks for posting. I guess my weekend project priorities have changed.

Compared to other systems I can’t believe how easy Shinobi is to use. We don’t really even need a binding.

2 Likes

But I have not been able to start it (configure) yet in docker container…

Well, it does say the docker deployment is not officially supported so I’m not surprised. I’ll probably deploy it to an existing VM.

Hey. Currently I’m working on a custom docker image for Shinobi CCTV based on Shinobi Pro . I’ll let you know when you will be able to find it at Docker Hub, if you’re interested in. Right now I’m fighting some issues regarding True Type Fonts and timestamps related to Alpine Linux.

3 Likes

I’m going to be setting up Shinobi within the next week and will try to integrate with OH. I’m keeping an eye on this thread.

Great! Hope it goes well for you!

I have build custom docker images for Shinobi CCTV based on Shinobi Pro. Thanks to MoeIsCool for his great work and inspiration. You will find it on Docker Hub https://hub.docker.com/r/migoller/shinobi/ .
The Alpine images fails right now on Shinobi’s timestamp features because because Alpine’s ffmpeg package is missing the configuration “–enable-libfreetype”. Compiling ffmpeg from the sources did not the trick.
That’s why I decided to add a Debian based docker image; Debian’s ffmpeg package does not miss any required configuration options. API-access is working so Dome’s items should be able to access Shinobi’s monitors and groups.
I’ll add some stuff for setting up the database on remote MariaDB or MySQL servers. Right now you’ll find a script and corresponding sql-files on GitHub https://github.com/MiGoller/docker-shinobi/tree/master/sql .

2 Likes

hey there, i was trying your docker image but i couldn’t get it to run :frowning: i got this error. please help

docker: Error response from daemon: OCI runtime create failed: container_linux.go:296: starting container process caused "exec: \"/opt/shinobi/docker-entrypoint.sh\": permission denied": unknown.

also thank you very much for taking the time to build up an image :smiley: this has always been a pain for me, ugh.

1 Like

Hey Moe. Thank you for your feedback. Looks like the execution permission is missing on docker-entrypoint.sh. I’ll fix this and let you know. You will find this issue on https://github.com/MiGoller/docker-shinobi/issues/2 .

Hey Moe. I’ve just updated both images, alpine and debian, on Docker Hub. Building the images succeeds locally and on Docker Hub. I’m running my debian image, which I pulled from Docker Hub, without any errors while starting up. Can you give it a try, please? Regards.

thank you for taking a look so quickly :smiley: i just checked it out and the web panel is now visible! :smiley: but it looks like SQL didn’t connect :frowning: i wonder if im just doing this wrong :confused:

I tried running service mysql start but it doesn’t recognize it as a command

the command i use to start the docker image is docker run -d -p 8081:8080 migoller/shinobi

hey so ive been spending some time with your sweet docker image and it was exactly what i was planning to try next. Pulling straight from git like a boss!!

Does that mean i can delete all the docker stuff from the shinobi repo?

I’ve also made a fork of your image and gonna make it so it uses SQLite3.

Thank you very much!!! you don’t know how much it means to me! Believe shinobi will be so much better because of you! :smiley:

Here also marks the day Shinobi will support Docker.

1 Like

Right now, both images do not include any MySQL or MariaDB packages. Why? Well, I tried to strip down the image sizes to the minimum. Please have a look at https://github.com/MiGoller/docker-shinobi/tree/master/sql to get the sources and setup-script for the database. The script is inspired by Moe and designed to run on the MariaDB server, but stripped down for the database setup: https://github.com/moeiscool/Shinobi/blob/master/INSTALL/ubuntu.sh .

But I recognized as well, that I’ll have to install at least the MySQL client tools package to the image to be able, to automatically setup a new database for Shinobi if it’s not existing. I’m working on that. Probably there will be a docker compose file to run a composition of different images or containers for the Shinobi ecosystem.

Nice! Adding SQLite as a basic DB would make it more easier to run Shinobi for testing purposes, etc. without the need of setting up MySQL or MariaDB servers.