Closed MartiMan79 closed 3 years ago
Hello! Interesting question. If I understand you right, you want to point a homekit camera at any random image.
It is plenty easy to send still images to this node, just point it to any accessible image.
Now, a "video stream" for ffmpeg might be more difficult but shouldn't be that bad, right? Has anyone ever tried pointing the video feed at a jpg image?
...give me a couple minutes... I'll be right back.
Got it.
Change the /home/pi/snap.jpeg
to wherever your jpeg file lives. Stream any jpeg, png, probably gif? Or a set of images if you want to shuffle through a folder or something, you can use *.jpeg
as the file name.
Some tuning can be done, it seems to "break" in the event my still is a partial file when ffmpeg loads it (I'm using wget to download a still from my camera).
[{"id":"f22f9433.de8c4","type":"homekit-service","z":"e9d44372.de7a58","isParent":true,"bridge":"e3c37654.e6ac38","parentService":"","name":"Taj Majal","serviceName":"CameraControl","topic":"","filter":false,"manufacturer":"NRCHKB","model":"0.130.2","serialNo":"Default Serial Number","firmwareRev":"0.130.2","hardwareRev":"0.130.2","softwareRev":"0.130.2","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"-loop 1 -r 2 -i /home/pi/snap.jpeg","cameraConfigStillImageSource":"-i /home/pi/snap.jpeg","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":"1920","cameraConfigMaxHeight":"1080","cameraConfigMaxFPS":"10","cameraConfigMaxBitrate":"3000","cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1920:1080","cameraConfigAdditionalCommandLine":"-tune stillimage -preset ultrafast","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","waitForSetupMsg":false,"outputs":3,"x":390,"y":1580,"wires":[[],[],[]]},{"id":"e3c37654.e6ac38","type":"homekit-bridge","bridgeName":"Taj Majal","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"NRCHKB","model":"0.130.2","serialNo":"Default Serial Number","firmwareRev":"0.130.2","hardwareRev":"0.130.2","softwareRev":"0.130.2","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}]
Occasionally I get partial downloads:
Of course this should be fixable, just need to do some tuning. I hope this is at least close to what you're looking for?
Have fun!
Super, works like a charm!
With your example the image with the file as source shows up immediately.
Now even an html link that renders the image to png works fine! Only bottleneck here is Grafana because it takes up 75% of my system resources (RPi4b-8GB) to render the images. They also take about 10 seconds to load each and chromium keeps rendering in the background until the Home app is closed again. So my idea of having 6 graphs per room (Temp & RSSI of Homematic devices) is not feasible on an RPi...
I'm looking into html2canvas now to see if I can automate the rendering at a specific time of the day (once per hour) to cancel the constant rendering initiated by the home app when opened.
I will close the issue as my question is answered and will add my findings for a less system intensive solution.
@MartiMan79 Just one comment on that. What a cool idea to present something different in the home.app. A very good example for it is always worth to "thinking around the corner". Thanks for the inspiration!!!
So, after some searching I came to the conclusion that a time triggered Grafana rendering saved to file would be my best option.
I put in delays of 15 seconds with the node-red-contrib-interval-multiples-timer per rendering as it takes about 10 seconds to complete and I don't want to stress my setup too much. The PNG images are being overwritten by node-red-contrib-image-tools each 15 mins.
This is my setup for a 24h, 48h and weekly temperature chart integration into the home app. Grafana is running in combination with influxdb and OpenHAB2 because of my pivccu3 setup with Homematic heating.
Please feel free to add more sophisticated solutions as I'm a noob coming from Elec-Mech & PLC engineering.
[{"id":"8390bcfd.1e3fb8","type":"tab","label":"Grafana rendering","disabled":false,"info":""},{"id":"f22f9433.de8c4","type":"homekit-service","z":"8390bcfd.1e3fb8","isParent":true,"bridge":"2be93bda.f25d74","parentService":"","name":"Temp 6h","serviceName":"CameraControl","topic":"","filter":false,"manufacturer":"NRCHKB","model":"0.130.2","serialNo":"Default Serial Number","firmwareRev":"0.130.2","hardwareRev":"0.130.2","softwareRev":"0.130.2","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"-loop 1 -r 2 -i /home/pi/grafana_renders/master_6h.png","cameraConfigStillImageSource":"-i /home/pi/grafana_renders/master_6h.png","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":"1920","cameraConfigMaxHeight":"1080","cameraConfigMaxFPS":"10","cameraConfigMaxBitrate":"3000","cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1920:1080","cameraConfigAdditionalCommandLine":"-tune stillimage -preset ultrafast","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","waitForSetupMsg":false,"outputs":3,"x":1120,"y":40,"wires":[[],[],[]]},{"id":"78c16874.75194","type":"homekit-service","z":"8390bcfd.1e3fb8","isParent":true,"bridge":"2be93bda.f25d74","parentService":"","name":"Temp Day","serviceName":"CameraControl","topic":"","filter":false,"manufacturer":"NRCHKB","model":"0.130.2","serialNo":"Default Serial Number","firmwareRev":"0.130.2","hardwareRev":"0.130.2","softwareRev":"0.130.2","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"-loop 1 -r 2 -i /home/pi/grafana_renders/master_day_temp.png","cameraConfigStillImageSource":"-i /home/pi/grafana_renders/master_day_temp.png","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":"1920","cameraConfigMaxHeight":"1080","cameraConfigMaxFPS":"10","cameraConfigMaxBitrate":"3000","cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1920:1080","cameraConfigAdditionalCommandLine":"-tune stillimage -preset ultrafast","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","waitForSetupMsg":false,"outputs":3,"x":1120,"y":100,"wires":[[],[],[]]},{"id":"6adc6437.973f1c","type":"homekit-service","z":"8390bcfd.1e3fb8","isParent":true,"bridge":"2be93bda.f25d74","parentService":"","name":"Temp Week","serviceName":"CameraControl","topic":"","filter":false,"manufacturer":"NRCHKB","model":"0.130.2","serialNo":"Default Serial Number","firmwareRev":"0.130.2","hardwareRev":"0.130.2","softwareRev":"0.130.2","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"-loop 1 -r 2 -i /home/pi/grafana_renders/master_week_temp.png","cameraConfigStillImageSource":"-i /home/pi/grafana_renders/master_week_temp.png","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":"1920","cameraConfigMaxHeight":"1080","cameraConfigMaxFPS":"10","cameraConfigMaxBitrate":"3000","cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1920:1080","cameraConfigAdditionalCommandLine":"-tune stillimage -preset ultrafast","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","waitForSetupMsg":false,"outputs":3,"x":1130,"y":160,"wires":[[],[],[]]},{"id":"96668799.c4d6d8","type":"jimp-image","z":"8390bcfd.1e3fb8","name":"Temp 24h","data":"http://192.168.0.20:3000/render/d-solo/-YH5Oqigk/heating-graph-6h?orgId=1&refresh=5s&panelId=6&width=1000&height=500&tz=Europe%2FLuxembourg","dataType":"str","ret":"img","parameter1":"/home/pi/grafana_renders/master_6h.png","parameter1Type":"str","parameter2":"","parameter2Type":"msg","parameter3":"","parameter3Type":"msg","parameter4":"","parameter4Type":"msg","parameter5":"","parameter5Type":"msg","parameter6":"","parameter6Type":"msg","parameter7":"","parameter7Type":"msg","parameter8":"","parameter8Type":"msg","sendProperty":"payload","parameterCount":1,"jimpFunction":"write","selectedJimpFunction":{"name":"write","fn":"write","description":"Write to file. NOTE: You can specify an alternative file extension type to change the type. Currently support types are jpg, png, bmp.","parameters":[{"name":"filename","type":"str","required":true,"hint":"Name of the file","defaultType":"str"}]},"x":800,"y":40,"wires":[[]]},{"id":"6a2b7d7.7181e04","type":"jimp-image","z":"8390bcfd.1e3fb8","name":"Temp 48h","data":"http://192.168.0.20:3000/render/d-solo/ckmSrRZRz/heating-graph-day?orgId=1&refresh=5s&panelId=6&width=1000&height=500&tz=Europe%2FLuxembourg","dataType":"str","ret":"img","parameter1":"/home/pi/grafana_renders/master_day_temp.png","parameter1Type":"str","parameter2":"","parameter2Type":"msg","parameter3":"","parameter3Type":"msg","parameter4":"","parameter4Type":"msg","parameter5":"","parameter5Type":"msg","parameter6":"","parameter6Type":"msg","parameter7":"","parameter7Type":"msg","parameter8":"","parameter8Type":"msg","sendProperty":"payload","parameterCount":1,"jimpFunction":"write","selectedJimpFunction":{"name":"write","fn":"write","description":"Write to file. NOTE: You can specify an alternative file extension type to change the type. Currently support types are jpg, png, bmp.","parameters":[{"name":"filename","type":"str","required":true,"hint":"Name of the file","defaultType":"str"}]},"x":800,"y":100,"wires":[[]]},{"id":"a9af9397.e54be8","type":"jimp-image","z":"8390bcfd.1e3fb8","name":"Temp week","data":"http://192.168.0.20:3000/render/d-solo/htNXrgWgz/heating-graph-week?orgId=1&refresh=5s&panelId=6&width=1000&height=500&tz=Europe%2FLuxembourg","dataType":"str","ret":"img","parameter1":"/home/pi/grafana_renders/master_week_temp.png","parameter1Type":"str","parameter2":"","parameter2Type":"msg","parameter3":"","parameter3Type":"msg","parameter4":"","parameter4Type":"msg","parameter5":"","parameter5Type":"msg","parameter6":"","parameter6Type":"msg","parameter7":"","parameter7Type":"msg","parameter8":"","parameter8Type":"msg","sendProperty":"payload","parameterCount":1,"jimpFunction":"write","selectedJimpFunction":{"name":"write","fn":"write","description":"Write to file. NOTE: You can specify an alternative file extension type to change the type. Currently support types are jpg, png, bmp.","parameters":[{"name":"filename","type":"str","required":true,"hint":"Name of the file","defaultType":"str"}]},"x":810,"y":160,"wires":[[]]},{"id":"9e67458c.ec05b","type":"interval-multiples-timer","z":"8390bcfd.1e3fb8","interval":"900000","payload":"","topic":"","name":"Payload each 15 min","x":300,"y":40,"wires":[["2ca9d1eb.5ca366","96668799.c4d6d8","224dc80d.50a228"]]},{"id":"2ca9d1eb.5ca366","type":"delay","z":"8390bcfd.1e3fb8","name":"15 sec Delay","pauseType":"delay","timeout":"15","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":610,"y":100,"wires":[["6a2b7d7.7181e04"]]},{"id":"224dc80d.50a228","type":"delay","z":"8390bcfd.1e3fb8","name":"30 sec Delay","pauseType":"delay","timeout":"30","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":610,"y":160,"wires":[["a9af9397.e54be8"]]},{"id":"2be93bda.f25d74","type":"homekit-bridge","bridgeName":"NodeHAB Master bedroom","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"NRCHKB","model":"1.2.0","serialNo":"Default Serial Number","firmwareRev":"1.2.0","hardwareRev":"1.2.0","softwareRev":"1.2.0","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}]
@MartiMan79 great work :) If you could let us know what are the nodes you are using. At least 2 of them are unknown to me.
I see JIMP - which is a kind of slow graphics processor thing (I use it for cat detection) and some kind of cron job node?
I've recently switched from built in inject nodes for cron and am now using "cron plus"
...but the real question I came back to ask @MartiMan79 - you say you're experienced in mechanical engineering and PLC? Do you have any experience designing schematics and/or PCBs?
If yes, please join us at our discord server If no, please still join us!
@Shaquu
If you could let us know what are the nodes you are using.
I updated the info in the concerned post.
@crxporter
...but the real question I came back to ask @MartiMan79 - you say you're experienced in mechanical engineering and PLC? Do you have any experience designing schematics and/or PCBs?
I have experience in ePlan which is schematics yes, but only 3-phase powered industrial control cabinets. Slightly upscaled from what you are referring to ;) PLC-wise I'm a PLC application engineer using Siemens equipment mainly. Customer needs automated industrial processes and I combine all devices with the necessary logic controlling them. But I'm not active anymore in this field for about 5 years now, family father now ;) Home automation keeps my ambitions fed so that's why I'm here...
Super node, got my Homematic-OpenHAB2-NodeRed-Homekit system running the way I want but:
This might be a very bold question... I know there will be a lot of people that would like to see a Grafana or any image based integration into Homekit.
Webview is non existent in the home app but does anyone know of a way to create a virtualised ffmpeg stream of an image? And on top of that, make it accessible for the camera stream node?
Not a programmer, just an engineer with an idea ;)
The other option would be to use EVE but Fake-Gato history is not available for Node-Red as from what I understand...