koush / ha_scrypted

22 stars 4 forks source link

Feature request for camera entities in Home Assistant #8

Open dinki opened 1 year ago

dinki commented 1 year ago

Hi @koush ! I'm putting in a request as mentioned in Discord for including Home Assistant entities from Scrypted. These entities are more in line with what other NVR software provide and will make integration into HA ui and automation much easier. In particular, the camera entity is the most critical for my use case. Here is the relevant portion, for example, describing what Frigate exposes to Home Assistant via it's integration:

Entities Provided

Platform | Description -- | -- camera | Live camera stream (requires RTSP), camera for image of the last detected object. sensor | States to monitor Frigate performance, object counts for all zones and cameras. switch | Switch entities to toggle detection, recordings and snapshots. binary_sensor | A "motion" binary sensor entity per camera/zone/object.

Further information can be found here: https://docs.frigate.video/integrations/home-assistant/

with the github code they are using here: https://github.com/blakeblackshear/frigate-hass-integration

This example integration does provide access to snapshots/recordings/etc but my request is mainly for the entities listed above with camera being the most desirable to me though others may benefit from the swith and binary_sensor if including is not too difficult. I would be more than happy to help test as I know you are not a Home Assistant user.

Again, I thank you for the time you put into this project and for the effort you put into making it great!

koush commented 1 year ago

Regarding camera: what do you miss from the camera entity that you want in the NVR card?

The reason I am hesitant to create a camera entity is because it is a reduced experience from the iframe. I'd rather improve the iframe to fill any gaps.

dinki commented 1 year ago

dinki — 06/30/2023 8:44 AM Good morning @koush . In reference to your request for more information on the post I made at:

https://github.com/koush/ha_scrypted/issues/8

If you don't mind I'd like to use this chat to discuss. I will be more than happy to copy the relevant portions to github issue after if you'd like but this will be easier for me to communicate. I hope you do not mind.

Here's my HA dashboard for my four cameras (one is in BW mode for unknown reasons): Image When I click on one of these in the dashboard it pops open a live view of the camera: Image Further, if I double click the banner it makes it even larger plus option to full screen: Image

A lag of a few seconds does exist when viewing these as live stream. It's about four seconds which is fine for what I want. I have these set up using the rebroadcast rtsp links from Scrypted.

The advantage I have with these is that this provides not only an easy way to view these streams with capability of full screen that the current Scrypted HASS card does not allow, but it also allows for reduced bandwidth which is nice on mobile devices. The main view I showed above updates at a much slower rate but you can view the live stream by clicking on. Current implementation shows live stream always. I find this useful if I just want to take a quick look but don't need to do much more. It's comfortable.

Another benefit is that these camera.* entities are well supported in HASS for automations. I have about five or six automations that are triggered by events and HASS is capable of taking a snapshot of the current frame on a given camera and send that as a message to my phone. I did describe that portion above.

Further, this gives a much simpler install for the user as oppose to the current procedure. Ideally the user would install the integration, log in with Scrypted credentials, and the camera devices would populate. Bonus points for integrating door bell buttons and motion detects as messages as well.

I do not know how many HASS users are using Scrypted but I believe this would benefit all of HASS users and not just myself.

Please know that I do have this kind of working in HASS using the restream RTSP links but a simpler setup through a Scrypted integration would make things easier for me and others.

koush — 06/30/2023 10:50 AM but it also allows for reduced bandwidth which is nice on mobile devices what do you mean reduced bandwidth?

dinki — 06/30/2023 10:52 AM The cards are mostly idle when they display like they do on the first screenshot that show all four. Those images only update once a minute rather than at the full framerate. It will only show the live view when clicked on unless you decide to have it be always live which is similar to your implementation if I'm not mistaken. Having the reduced update will have a reduced impact on bandwidth if you choose to not show live like I am.

@koush koush — 06/30/2023 10:53 AM the scrypted cards refresh every 10 seconds

dinki — 06/30/2023 10:55 AM I thought I was seeing them update live but I guess I am mistaken.

koush — 06/30/2023 10:55 AM and theyre resized to fit the current dimensions of the card, dollars to donuts that even at a higher frequency they use less bandwidth Image they play inline when clicked yes

dinki — 06/30/2023 10:56 AM Okay, understood. That was more of a sidenote than anything. Thanks for clarifying.

koush — 06/30/2023 10:57 AM i'm not sure i can popup on click from an iframe, but i can navigate to the sidebar panel can probably fullscreen too what happens whne you clcik a HA camera entity card on mobile i cant imagine it does a popup. probably goes fullscreen?

slyoldfox — 06/30/2023 11:41 AM It pops up a player Image

dinki — 06/30/2023 12:31 PM @koush Correct. Pulls up the player as shown and you can full screen as desired with controls on the player. It really is nice. Part of the reason for the request with the additional benefit of being able to pull the snapshots easily in the automations.

alias: PRESENCE - Garage door open no one home send message description: "" trigger:

platform: state entity_id: group.someone_home from: "on" to: "off" condition:

condition: state entity_id: sensor.garage_door_x state: open action:

service: camera.snapshot data: filename: /config/www/snapshot_camera.doorbell target: entity_id: camera.doorbell_restream delay: hours: 0 minutes: 0 seconds: 2 milliseconds: 0 service: telegram_bot.send_photo data: file: /config/www/snapshot_camera.doorbell service: telegram_bot.send_message data: message: Garage is open and no one is home. Close Garage? inline_keyboard: Yes:/garagecontrol, No:/removekeyboard mode: single If group.someone_home goes from on to off (no one home) AND garage door is open THEN grab a snapshot of camera.doorbell_restream and send via telegram. The rest is for a popup asking if the garage should be sent message to close.

I do this to ensure the door is actually open as I have had false positives from my door sensor from time-to-time.


above copied from Discord. I will come back and edit for images later.

Carve commented 10 months ago

I would also love this capability for HA.

sfnemis commented 3 months ago

Hi,

I am a licensed user of Scrypted NVR with 7 licenses, and I am very happy with it. I am using it on my Proxmox server. I also use Home Assistant separately, and I have successfully configured the Scrypted NVR notification plugin for Home Assistant and the Scrypted Custom Card.

However, I want to access my Scrypted cameras using Home Assistant Automations.

For example:

When a person is detected on a camera connected to Scrypted, I want a sound to be played from one of the speakers connected to Home Assistant. I want to implement different scenarios. I have tried everything, but I cannot access Scrypted NVR or Scrypted Custom cards in the Home Assistant Automations section, so I cannot access the cameras or the events on the cameras.

Has anyone tried this before, or if anyone has any ideas, I would be very happy if you could share them.

Thanks,