Putting live video from (almost) any web/ip camera into your dashboard

Put your web/ip cam into tinyCam (or suchlike).
Activate the webserver in tinyCam.
Get the url for that camera (for example, for tinyCam it is like this):

http(s)://your_tinyCam_webserver_ip:your_tinyCam_webserver_port/axis-cgi/mjpg/video.cgi?user=blah&pwd=blahdeblah&camera=1&resolution=320x240

Add this driver to your Hubitat system:

preferences {
        input("src", "text", title: "iFrame Url",  required: true)
    }
metadata {
    definition (name: "iFrame", namespace: "srp", author: "srp") {
        capability "Switch"
        attribute "myFrame", "text"
    }
}
def on() {
    sendEvent(name: "switch", value: "on")
    sendEvent(name: "myFrame", value: "<div style='height: 100%; width: 100%'><iframe src='${src}' style='height: 100%; width:100%; border: none;'></iframe><div>")
}
def off() {
    sendEvent(name: "switch", value: "off")
}
def installed() {
    on()
}

Create a new device using this driver, and put your webcam url above into the html address for this device.

Create or access the dashboard you want to add your cameras to. Add the iFrame device you just created.

Presto!

(sorry the house is a bit of a mess, we have the in-laws staying :weary:) :rofl:

[updated: - see below, no need for the iFrame driver, just use an Image tile]

7 Likes

Update:

Woops, its even easier than that.
No need to add the iFrame driver.

Just create a simple image tile.
Put the url into either the image or the background image field. Using background scales the image to fill the tile which is perfect. You can adjust the resolution in the url itself of course.

Presto!
(and yes, the view updates live video, without needing any refresh parameter)

2 Likes

This work great. Thanks.

I tried something like this driver awhile back. It worked however after the video was activated the driver details page would just spin and spin and never load. Did you see any similar issues?

Definitely use the image tile instead of iframe. Click on the image tile will give you full screen of the tile image. One downside to image tile is that the refresh rate can not go lower than 1 second.

Don't you wish cam drivers had built in barrel distortion correction :slight_smile:

i didnt put any refresh rate/time into the tile. Just leave it blank and it was playing live video feed from the webcam for me no problem :slight_smile:

Can this work with RTSP directly from a camera?

Not sure. I doubt it. This method uses the webserver of tinyCam to provide a url that the image tile can display. TinyCam does support RTSP cameras (it's the connection type I'm using for my Samsung cam) but I'm not sure if it's possible to connect that directly to a dashboard.

1 Like

No, this method will not work with an RTSP stream.

It is possible to place a link to the RTSP stream over top of an image or MJPEG stream, upon which you can click the link and open the RTSP stream. If the background of the image is completely transparent and the link name is just whitespace, you don't even notice it's above the image. That's what I do with my cameras.

1 Like