Enable automation when browsing the dashboard

A bit tricky.

My camera is a Dafang running a modified fw. It sort of works using ffmpeg and I got a camera entity in HA.
In my lovelace dashboard I set up a camera card and the image is refreshed every 10 seconds.
But it is completely unreliable.

My idea is to build up an automation that every 10 seconds retrieve an image through the camera web interface that is so much faster. And then I will setup an image card to show that latest still.
The point is that this is meaningless if nobody is looking at the dashboard.
I would like to enable the above automation only when I open my browser and navigate to HA.
Is it possible? Some sort of “heart beat” that Lovelace could trigger on HA?

Thanks for any help!

My modified dafang has a perfectly good rtsp camera entity, no ffmpeg needed.

camera:
  - platform: generic
    still_image_url: https://root:[email protected]/cgi-bin/currentpic.cgi
    name: foyer
    verify_ssl: false
    authentication: digest
    stream_source: rtsp://dafang.lan:8554/unicast

Yeah my user and password are the firmware defaults. Shoot me.

You are the real hero!
I can’t shoot you… I’m still using a very old version of the fw hack. One without https.
But your configuration (apart from “http” instead of “https”) seems so much more stable than my old one using ffmpeg.

Thanks!

1 Like