Then if you already have an nvr, why are you trying to access the camera directly?
Also - lol @ it doesn’t come native with ha. Of course it doesn’t. But you can still test it for free, you just need to actually go read instead of crap on a good idea.
Because I want to see the camera in the homeassistant front-end. Both the camera and homeassistant are on the same network. Homeassistant has to interact directly with the camera anyway for various other reasons like automations.
I literally have an RTSP URL that will show me what I want to put in a card, which should be simple. Why would I want to depend on an entire third-party integration just to show me a picture or video in software that can already do this? Worst-case, it’s probably easier to configure the generic camera by editing files in .homeassistant than to install a whole local NVR. The problem is generic camera in configuration.yaml has been deprecated, so none of the documentation will tell me what to put in there.
Try restarting or clearing your cache, because you should be able to add it as a generic camera. If you are just getting the please wait dialog for longer than reasonable, something is wrong with your installation. You should get a dialog with a place to set up a still image url, a rtsp etc, like this
I’ve restarted homeassistant multiple times. I’ve also tried logging in with a brand new browser with a new home directory, to guarantee nothing weird was being cached browser side.
I guess the problem is that it’s attempting to install software and failing, but then rather than report the error it just hangs forever. These are possibly the relevant syslog entries:
Mar 25 23:44:03 rpi homeassistant[28364]: ERROR: Failed building wheel for ha-av
Mar 25 23:44:03 rpi homeassistant[28364]: ERROR: Could not build wheels for ha-av, which is required to install pyproject.toml-based projects
It seems to be dying when compiling src/av/container/core.c because of an undeclared identifier AVFMT_FLAG_PRIV_OPT. Hmm… I know C, but I have no idea how to fix things inside pip inside homeassistant.
My point is that there are a LOT of NVRs out there that integrate with HA - BlueIris among them - and then you can view whatever camera you like from the NVR in HA without the need to directly access the camera from HA. In addition, you can get a whole host of other information exposed for use, depending on what is made available by the NVR (motion detection, object detection, ALPR, etc).
Regardless, you seem hellbent on trying to use a deprecated method of getting less information than you otherwise could, possibly even with the NVR you currently have (which I don’t see that you’ve identified).
I’m sure your system works well for you. My system works well for me, except for this new situation where it would be nice to have an extra picture in my cards, and I need to figure out why I can’t install the generic camera integration. I have a very tight integration between home assistant and my cameras. For example, one of my cameras is right near an outdoor PIR curtain detector, so I need to disable IR illumination whenever the alarm is set for that zone, and reenable afterwards when the alarm is disarmed (or alarming). I also have various automations for things like lights when I cross certain lines. The fact that axis fence guard shows up as a native homeassistant entity automatically makes these very easy to set up and debug. When my doorbell rings or people loiter in front of my house, I can send myself an android notification with a picture and pre-selected actions like unlocking the gate (via gpio integration) and playing a recording asking a delivery person to leave the package inside the gate (via shell integration). Some of my automations involve combining state from multiple different integrations. For example, I have a helper input_boolean that’s true if I returned home in the last 5 minutes based on presence detection. If that’s the case, and it’s night, and a particular axis fence guard event has fired, then I turn on a particular set of lights.
I’m sure it’s possible to do all of these things using a closed source NVR. The NVR may even be better at some of them. But the fact is that homeassistant works really well for me, and I know how to use it, and I prefer to use open source when practical. I’m sure there would be other annoyances trying to integrate an NVR with my setup. Your point is noted that Blue Iris is a really nice NVR, and it might work for some people, but it’s not what I’m going to use, and since this is the homassistant forum, let’s get back to talking about how to solve this with homeassistant.
As for which NVR I use, well the cameras themselves already store one copy of the video on their SD cards, so anyone who breaches my house can destroy that copy by destroying the camera (or the house). So it only makes sense for my second copy to be off premises, and since it’s probably not too hard to tie my forum handle to my real identity, I’d rather not disclose the particular service that I use, other than to say I still want homeassistant to work with my cameras when the Internet is down, which wouldn’t be the case with that service. For anyone seeking a service, I don’t really like my service enough to recommend it–just google “axis cloud nvr” to find a bunch of mostly equivalent vendors, probably all of them less slick than Blue Iris–but the point is I hardly need to use it because unless my cameras are destroyed, I get everything I need between homeassistant and the axis firmware itself.
I’m using Python 3.10.10, but the issue is more the C compiler and header files. I’m using archlinux arm on a Raspbery Pi 4b, but in 32-bit mode (armv7l) because a long time ago I couldn’t get the GPIO inputs to work in 64-bit mode. I’m willing to migrate to 64-bit if the raspberry pi gpio integration supports input now. (It used to depend on some deprecated trigger mode configuration through the /sys file system that wasn’t available in the 64-bit kernel.) I could also bite the bullet and just use an esphome for inputs, but I don’t have WiFi when the power is down. (The inputs are for a latch monitor, so I can lock electric strikes as soon as a gate is opened. The stikes are on a UPS, but I could just use a backup timer or something.)
In general, homeassistant always compiles things from C/C++ source when I upgrade. I’m a C++ developer, so could probably fix the issues in the code, but I don’t know that much about the Phython ecosystem unfortunately. In particular, I’d need to be able to restart the build process after editing the source code, and have no idea what’s going on inside homeassistant and pip. I’d love any pointers for this, or for using pre-compiled libraries to speed upgrades. Archlinux arm uses rolling releases, so precompiled binaries might not work. Periodically I have to force homeassistant to recompile everything if I upgrade and no longer have an old shared library it linked against.
It’s possible that if something else is accessing the RTSP stream already that the camera simply isn’t capable of handling another stream. If that’s the case, you can try to use an RTSP proxy like this one and have all the things that need the RTSP stream access the proxy, and only have the proxy connect directly to the camera.
Generic camera wasn’t deprecated, just configuring generic camera in the configuration.yaml file. I thought that my issue was just a front-end issue and that I could use the generic camera by bypassing the web and configuring the rtsp stream directly. However, I now understand that the problem was that a python package was failing to install because of a C compilation problem.
Is there a way to use an RTSP stream (or motion jpeg) that doesn’t involve the generic camera integration? Because the one thing I know for sure is that the RTSP stream for the second camera works fine when I test it outside of homeassistant.
I tested the RTSP outside of homeassistant and it works fine. My problem is that the generic camera integration doesn’t work for me, because it relies on a deprecated and now removed constant AVFMT_FLAG_PRIV_OPT in ffmpeg. Because I’m using a rolling release distribution (arch linux arm), I probably have too new a version of ffmpeg.
Well, I made some progress, but am not there yet. First issue was getting generic camera to allow me to attempt to add one, which means getting ha-av to install on arch linux arm. ha-av is not compatible with ffmpeg 6, so I downloaded ffmpeg-2:5.1.2-2-armv7h.pkg.tar.xz from the ad24 arch linux arm archive and installed it with the command sudo pacman -U ffmpeg-2:5.1.2-2-armv7h.pkg.tar.xz. [If you are reading this post significantly after March, 2023, or not running arch linux arm, or if the integrations page will let you add a geneneric camera, you can skip this step and proceed with ffmpeg 6 or whatever is installed on your system.]
The next issue was just getting an RTSP stream that worked for me. I checked this on my desktop by running mpv rtsp://username:password@my-cam.lan/axis-media/media.amp?camera=2 until I found the camera number that I wanted (2 in this case). More information on URLs for accessing Axis cameras is available in Axis’s VAPIX documentation. I was similarly able to get a still image by visiting http://my-cam.lan/axis-cgi/jpg/image.cgi?camera=2 in my browser.
Unfortunately, now when I go to add the generic camera, no matter which options I try (and to anyone reading I highly recommend you not try basic authentication rather than digest), the dialog comes back with “Unknown error occurred.” I’m using the same URLs I tested with my browser and mpv, just without the username and password which have their own fields in the dialog.
Yup, and that one works great, so we have a winner. Thank you!
Just for the record, the video URL is http://my-cam.lan/axis-cgi/mjpg/video.cgi?camera=2 and the still URL is http://my-cam.lan/axis-cgi/jpg/image.cgi?camera=2.