AlexxIT / WebRTC

Home Assistant custom component for real-time viewing of almost any camera stream using WebRTC and other technologies.
https://github.com/AlexxIT/Blog
MIT License
1.54k stars 183 forks source link

Feature Request: Privacy mode - blur & dim picture based on a boolean entity #624

Open alexruffell opened 11 months ago

alexruffell commented 11 months ago

When showing my Home Assistant Dashboard to others, or sharing it online, I prefer to blur out the camera feeds.

Using the picture-glance card, this is how I was achieving it:

type: picture-glance
title: Driveway - East
entities:
  - entity: input_boolean.driveway_east_camera_privacy
camera_image: camera.driveway_east_camera
aspect_ratio: '16:9'
camera_view: live
state_filter:
  'on': brightness(40%) blur(10px) saturate(0.0)
  'off': brightness(100%)
entity: input_boolean.driveway_east_camera_privacy

Example of the privacy mode: image

Now that I am using the webrtc-camera card I can't find a way to do it.

type: custom:webrtc-camera
entity: camera.driveway_east_camera
poster: camera.driveway_east_camera
title: East
media: video,audio
muted: true
digital_ptz:
  mouse_drag_pan: false
  mouse_wheel_zoom: false
  mouse_double_click_zoom: false
  touch_drag_pan: false
  touch_pinch_zoom: false
  touch_tap_drag_zoom: false
  persist: false

Would you kindly consider adding this feature?

AlexxIT commented 11 months ago

It's not very smart to protect your camera on the client side. This protection bypasses.

alexruffell commented 11 months ago

It is not a protection against unauthorized use or anything of the sort. I use the "privacy mode" when I take screenshots of the dashboards that include cameras, when I share my desktop (view only) to show something to those I help, or when I show Home Assistant on my phone to others. Streamers would also benefit from this.

If I need to be 100% sure that someone with dashboard access cannot see the feed, I can power down the camera (PoE) or disable HA's access to the NVR.

AlexxIT commented 11 months ago

url param supports Jinja2 https://github.com/AlexxIT/WebRTC#custom-card

alexruffell commented 11 months ago

Are you suggesting that I can write a template that resolves to the correct camera feed if privacy mode is off, and to nothing if privacy is on?

If so, it gets me close but would be nicer if the privacy on mode had a predefined look rather than an error message for inaccessible camera.

Will have to research this as I don't have a clue on how to do this off the top of my head.

AlexxIT commented 11 months ago

You can create some dummy stream with streaming static file. But template will work only with url, not with entity.

alexruffell commented 11 months ago

If I can't turn privacy on or off based on an entity then it seems this solution doesn't work for my case and I have to go back to the old card :( The picture-glance card is worse in nearly every way possible but I like 2 things about it: 1) state_filter allows me to implement my own custom privacy mode 2) It doesn't make it so obvious that the feeds are not loaded when you open the dashboard at first. With the awesome webrtc-camera card it is so obvious (black background with huge twirly circle until it loads) it is really annoying me to see how long it takes for the 5 feeds to load. I think I need to explore something in between HA and the NVR (maybe scrypted?) to make the feeds lighter (currently 4K, 264, 16Mbit streams)

nbris95 commented 4 months ago

Hi @alexruffell Been following some of your posts for some time and I'm actually now running into the exact issue you've mentioned above. Have you come to a solution that meets your requirements? Thanks!

alexruffell commented 3 months ago

@nbris95 I no longer use webrtc-camera as I went back to the original solution but I did adopt Scrypted in between my cameras/DVR and HA. Not perfect but overall it is ok.