Closed oliverrahner closed 5 years ago
If anyone wonder about it. I am planning to add Camera support in release 0.6
There will be a new node but I am not sure yet if this should be attachable to existing Services/Accesoriess or we should really create a new Accessory for Camera only.
@Shaquu, very nice to see some activity again on this repo 👍🏽
This addition would be great! - Thanks for the update!
Camera support will not come to 0.6.0 But 0.6.0 adds a lot required stuff for Camera implementation. I think that Camera will appear in 0.7.0.
I'm also considering adding some cameras to my home setup. What is missing right now to implement Camera Service? As I know, it only supports RTSP streams?
Time :) And I assume yes. Only RTSP is supported directly.
@Shaquu, you probably have seen this https://github.com/KhaosT/homebridge-camera-ffmpeg project, but in case you haven't, it might be useful to you.
The functional but not full featured one I’m using on a pi zero is https://github.com/moritzmhmk/homebridge-camera-rpi
@crxporter, I am not (yet) a camera user and I am very curious about how it looks on the Home App and or Eve App. Could you share some screenshots? 😃
This is how it looks right now - but the fun part is in the smart notifications. For example if I turn on homekit notifications for my motion detector when there is a camera and a door lock in the room then my "motion detected" alert is a view of the room with 2 buttons: one to turn on the room lights and one to unlock the door.
The 3rd screenshot is not from me but looks the same if I turn on the feature - however my buttons are "turn on lights" and "unlock door"
@crxporter, awesome! thanks for the screenshots and use-case :+1: , any recommendations for a good quality camera? I might consider buying one to play around :-)
I’m running on a pi zero w with the official pi camera! Works great I just stuck it on the wall with two sided tape.
Is it possible to stream RTSP from computer? If yes then please tell me how. If not the I will code blindly :)
IIRC VLC should be able to stream a file, see https://support.spinetix.com/wiki/Tutorial:Streaming_using_VLC HTH
I have managed to find a way to get snapshots of my camera and display them on the node-red Dashboard (Made for Android Users haha) Here is the flow:
(Snapshot is saved into the tmp folder which gets overwritten every 2 minutes)
I use the saved snapshots to send them to telegram when motion is detected while homekit alarm is active
I was wondering if maybe you can integrate the camera service to display the snapshots instead of trying to stream the camera feed on the favourites page in the homekit app?
The HomeKit protocol supports both snapshots and streamed video. There are homebridge programs out there that are capable of using this. The iPhone/iPad/etc will show the most recent snapshot in while connecting to the stream.
Yours is the first example I’ve seen using pictures files in node red.
Hopefully the devs find a winning setup! (though my wallet has other opinions, I don’t really have the spare cash to outfit my house with cameras!)
Prototype: https://i.imgur.com/rtDI1qF.mp4 (swipe to the bottom if video is outside of screen bounds). @crxporter you said that you are using api currently? Can you share your configuration? (those for stream for example -re etc. my current is -rtsp_transport tcp -i rtsp://192.168.0.227:8554/unicast)
@crxporter, no issues like this?
@RaymondMouthaan :
Just tested with varying results: Works on iPhone XS with newest release software (12.2) Works on MacBook running newest release (10.14.4) Does not work (I have the snapshot-only issue) on iPad running iOS beta 12.2
I'm updating the beta to the release version now, I don't use the iPad much... I'll update here in a few minutes.
Update complete - iPad still won't pull up live video.
@crxporter That's odd, I've the same issue with my iPhone X, still image works but live stream doesn't. While my good old iPad Air does the job well. I haven't test it on Mojave tho.
@RaymondMouthaan it looks like it's an issue with ios beta - so nothing unusual.
@Shaquu, I don't think it's a beta issue, because both of my devices run IOS 12.2 final...
It seems this bug is only present in devices that have at one point run the beta?
Is that true with your devices? My only “broken” one is the only one that ever ran a beta.
@crxporter as far as I remember, I never installed an beta on my iPhone X, but I did on an iPhone 6s which I had before ..
Interesting. I think best is to leave the issue for the other project to work out.
I’ll be more interested to get the node red camera abilities working... we’ve got the teaser from @shaquu, just need a test release!
Dear friends! Camera not working yet?
@freenetwork Not as yet, Shaquu is working on the next update (0.7.0) which will hopefully have the camera integration. A lot of progress has been made though so keep an eye on this
@RaymondMouthaan @crxporter and others. RTSP Camera landed on feature/camera branch. It is based on homebridge-camera-ffmpeg and you can find some help regarding configuration here. Please consider that it is work in progress.
You should be able to install it using (remember to navigate to your node-red location first!)
cd ~/.node-red/
npm install --save https://github.com/NRCHKB/node-red-contrib-homekit-bridged/tarball/feature/camera
To run node-red in debug mode (Camera aswell) run:
DEBUG=NRCHKB,NRCHKB_Camera node-red
Remember to backup your current node-red nodes as this release is unstable or test in different environment then production (recommended). All features and options are subject to change.
[ { "id": "118f3869.0f78b8", "type": "tab", "label": "Flow 1", "disabled": false, "info": "" }, { "id": "b29455f1.a9353", "type": "homekit-service", "z": "118f3869.0f78b8", "isParent": true, "bridge": "1e9e915f.22faaf", "parentService": "", "name": "Pi Camera", "serviceName": "CameraControl", "topic": "", "filter": false, "manufacturer": "Raspberry", "model": "Pi Zero", "serialNo": "0", "cameraConfigVideoProcessor": "ffmpeg", "cameraConfigSource": "-re -i rtsp://192.168.0.227:8554/unicast", "cameraConfigStillImageSource": "", "cameraConfigMaxStreams": 2, "cameraConfigMaxWidth": 1280, "cameraConfigMaxHeight": 720, "cameraConfigMaxFPS": 10, "cameraConfigMaxBitrate": 300, "cameraConfigVideoCodec": "libx264", "cameraConfigAudioCodec": "libfdk_aac", "cameraConfigAudio": false, "cameraConfigPacketSize": 1316, "cameraConfigVerticalFlip": false, "cameraConfigHorizontalFlip": false, "cameraConfigMapVideo": "0:0", "cameraConfigMapAudio": "0:1", "cameraConfigVideoFilter": "scale=1280:720", "cameraConfigAdditionalCommandLine": "-tune zerolatency", "cameraConfigDebug": false, "characteristicProperties": "{}", "x": 530, "y": 300, "wires": [ [] ] }, { "id": "1e9e915f.22faaf", "type": "homekit-bridge", "z": "", "bridgeName": "Bridge", "pinCode": "153-98-123", "port": "", "allowInsecureRequest": false, "manufacturer": "Apple", "model": "Mac OS", "serialNo": "1" } ]
Thanks @Shaquu for your work again, happy to be back!
However I don't have any cameras to try yet... but this looks really cool for me!
Here is example RTSP stream you could use for tests: rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov It's from https://www.wowza.com/demo/rtsp. It's 10 minutes animated clip.
EDIT: This video above fails for me in Home.app.
Anyway using FFmpeg I think you could stream image or video file... I think?
Yes I think I made something similar a few years back with ffmpeg. However this stream looks good for testing. I will try out and test it in my case - hope I can add some real cameras soon.
Well now I know my weekend plans!
If anyone has any pointers on getting this running with a pi zero camera I’d be happy to hear.
Edit - I see that @shaquu likely made his example with a pi zero. I’m off to build mine.
I have camera on pi0 but node-red is on Mac. So I use SRTP stream.
But to use camera from the same device you can try this: Here is how to install FFmpeg on raspberry. https://github.com/KhaosT/homebridge-camera-ffmpeg/wiki/Raspberry-PI
And here is an example for configuration for camera. https://github.com/KhaosT/homebridge-camera-ffmpeg/wiki/Tested-Configurations#raspberry-pi-zero-w--jessie--and-official-camera-module-v2
So instead of setting source to some RTSP stream you do this: "source": "-re -f video4linux2 -i /dev/video0"
Great news that this is being worked on, maybe some of the below info will help?
There's a good node red/rtsp guide on youtube I'm planning to watch in more detail: https://youtu.be/ihZWrJmbGFY
I'm using the Neos Smartcam which are extremely cheap from Amazon and can very easily be made to support RTSP by using the Dafang firmware: https://ryanfitton.co.uk/blog/install-dafang-custom-firmware-to-neos-smartcam/
It already seems to have Homebridge compatibility, but being honest I don't understand how it all works yet: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/master/README.md
I'm happy to test anything, in the meantime I will be reading more :)
My setup: Ras Pi 3 running node red, mosquitto mqtt broker Neos Smartcam running Dafang cfw (rtsp streaming)
I followed the instructions that @Shaquu sent and only hit one problem. When you run the npm install --save
... line, make sure you have your node-red folder open.
I had to first navigate to ~/.node-red/
on my pi. Didn't slow me down much, but others might not be so familiar. Too bad I finished the install over VPN and I can't add items to the home app over vpn :(
@877dev your profile picture just reminded me the camera I've been considering to try out - the esp32! Should be able to run an rtsp stream...
Yes this is really confusing in npm. I have used npm in other apps and I also saw that you can execute the commands everywhere but it will always use the current folder...
Sent from my iPhone
On 2019. Jun 21., at 14:15, crxporter notifications@github.com wrote:
I followed the instructions that @Shaquu sent and only hit one problem. When you run the npm install --save... line, make sure you have your node-red folder open.
I had to first navigate to ~/.node-red/ on my pi. Didn't slow me down much, but others might not be so familiar. Too bad I finished the install over VPN and I can't add items to the home app over vpn :(
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
Anyone wanting to try this out with us but don't want to spend a lot of money?
Should work great with the $10 webcam!
...I'm off to order one to swap out my current esp8266 in the garage...
@crxporter I just got a couple of esp32's, I will have to get them cameras now :) I mostly used esp8266's.
Also, I also in the past made this mistake of installing to the wrong directory, I sometimes wonder where did those files end up and are they happy :) Seriously though maybe I should clean them up, I have a "package-lock.json" file and "node-modules" folder in my home/pi folder which I think should not be there!
Sorry for bad instruction, sometimes I forget to focus on most important and I loose time on the least important :) I have fixed it in my original post. I have spent too much time on gif render (download iMovie, remove some frames, convert video to gif, crop it and cut again...) Will try to make it better next time! End of offtop.
I am really waiting for someone to implement this feature on real environment. Any feedback is very valuable - from functional working to the visual or description of the field. And one reminder as it is very important - make backup of your work and remember that anything here can be changed so don't get used to it.
When we finish entry phase of this feature I will need you guys to merge some KhaosT wiki pages to our wiki (with credits of course).
The camera setup should look like this:
DAMN! Edit: Website cache was the answer, thanks!
This can be a problem with website cache. After you install new version of NRCHKB remember to refresh whole website (instead of clicking Try again in node-red UI). Or if not working then try to clean browser cache.
Alright I've just got my camera working on my pi zero w.
For reference: pi zero w running a NoIR "official" pi camera.
1- installed a fresh raspbian and node-red on the pi.
2- installed FFmpeg instructions here, took FOREVER to build on the pi zero
3- navigate to ~/.node-red/
and installed the new branch with npm
4- set up item as my screenshot a couple comments up
Some comments:
And the obligatory screenshots so everyone knows I'm not lying (I'm not fancy with gifs like @Shaquu)
@crxporter cool dining room! I hope all lights are running on NRCHKB already :D Anyway, thanks for trying this. It is really helpfull to see it.
I think it really depends on camera and connection and all setup including libraries (and even configure options used during ffmpeg compile). And it is slower first time you connect to camera in node-red session (until restart) I think.
Please share your node form node-red (take pretty version and paste it with /details/summary/ tags like said here - I used it in README on feature/camera for reference) so other can benefit form your configuration better.
One thing to check. How many devices you can connect and try to view camera result (we have maxStreams value but what if we try to beat it?). After hour or something will camera be still connected to NRCHKB? (hour idle connection)
About snapshots. I have a feeling it doesn't work the way we think or it works bad in my implementation (for now). I am pretty sure that snapshot is last frame from video (in my case where stillImageSource is empty so Camera take snapshot from source itself). It would be cool if snapshot would be refreshed from time (new feature to add) to time or at least when we open Home.app it should be refreshed (maybe it does?).
all lights are running on NRCHKB already
How else would anyone turn on/off the lights in their house? If you look REALLY close you can make out the little esp01 controlling the LED strip under the cabinet.
Multiple devices: I can only get one streaming. It's also a VERY low frame rate. Might need to bump up my bitrate or something...
After 30 minutes it's still connected without issue. I will check back throughout the day.
As for snapshots - it can just be a link to a jpg file, right? We can just link it to ANY jpg and test...
[
{
"id": "457f5ce0.aa5a54",
"type": "homekit-service",
"z": "5c556f09.930f38",
"isParent": true,
"bridge": "d7cf985.0803ee8",
"parentService": "",
"name": "Camera",
"serviceName": "CameraControl",
"topic": "",
"filter": false,
"manufacturer": "Default Manufacturer",
"model": "Default Model",
"serialNo": "Default Serial Number",
"cameraConfigVideoProcessor": "ffmpeg",
"cameraConfigSource": "-re -f video4linux2 -i /dev/video0",
"cameraConfigStillImageSource": "-re -f video4linux2 -ss 0.9 -i /dev/video0 -vframes 1",
"cameraConfigMaxStreams": 2,
"cameraConfigMaxWidth": "1920",
"cameraConfigMaxHeight": "1080",
"cameraConfigMaxFPS": "20",
"cameraConfigMaxBitrate": "300",
"cameraConfigVideoCodec": "h264_omx",
"cameraConfigAudioCodec": "libfdk_aac",
"cameraConfigAudio": false,
"cameraConfigPacketSize": 1316,
"cameraConfigVerticalFlip": false,
"cameraConfigHorizontalFlip": false,
"cameraConfigMapVideo": "0:0",
"cameraConfigMapAudio": "0:1",
"cameraConfigVideoFilter": "scale=1280:720",
"cameraConfigAdditionalCommandLine": "-tune zerolatency",
"cameraConfigDebug": false,
"characteristicProperties": "{}",
"x": 320,
"y": 440,
"wires": [
[]
]
},
{
"id": "d7cf985.0803ee8",
"type": "homekit-bridge",
"z": "",
"bridgeName": "Cams",
"pinCode": "111-11-111",
"port": "",
"allowInsecureRequest": false,
"manufacturer": "Default Manufacturer",
"model": "Default Model",
"serialNo": "Default Serial Number",
"customMdnsConfig": false,
"mdnsMulticast": true,
"mdnsInterface": "",
"mdnsPort": "",
"mdnsIp": "",
"mdnsTtl": "",
"mdnsLoopback": true,
"mdnsReuseAddr": true
}
]
@Shaquu how do you do those little collapse arrows?
I am really looking for this esp01... :)
I have shortened your post by the way. It's longer to write and you have to remember how it goes but it's prettier:
<details>
<summary>My node-red item:</summary>
<pre><code>here would be the code</code></pre>
</details>
In my case I have noticed that framerate (bigger the worse) of the camera has performance impact on view fluency. You have many options here to tweak so that's a lot of fun
Regarding snapshots. I think yes. ffmpeg should accept images. But I didn't make it to work with urls so maybe you need local file path?
Based on #15, try to think of a generic way to add camera functionality to this project.
Todos would be: