amcrest2mqtt icon indicating copy to clipboard operation
amcrest2mqtt copied to clipboard

Create a Home Assistant add-on

Open dchesterton opened this issue 3 years ago • 29 comments

dchesterton avatar Feb 08 '21 23:02 dchesterton

+1

Or at least document the registry for use in Portainer or the like.

omayhemo avatar Feb 08 '21 23:02 omayhemo

@omayhemo I got it up and running through portainer a little bit ago. Pretty straight forward:

In Portainer select Containers in the left pane > +Add Container Name: Enter in a name you want to use Registry: DockerHub Image docker.io: dchesterton/amcrest2mqtt:latest Always pull the image: toggle on Skip Network ports configuration section

Advanced container settings Network: I set the network to my home assistant instance, user preferences may vary here. Env: Environment Variables - this is the critical section. The settings below are what I used to get it working with home assistant. Screen Shot 2021-02-24 at 9 11 29 PM Click the +add environment variable button for the amount of variables you want to enter. I only needed to add the section outlined in red. The rest were added automatically when I deployed the container.

Restart Policy: Set to unless stopped

Go back up to Actions: Click Deploy this container

brushj avatar Feb 25 '21 03:02 brushj

If it's not too much work, could we get an arm7 build so we can run this on a raspberry pi please? edit: Ah never mind I figured out how to do it, and have got one hosted here now: snozzley/amcrest2mqtt Hope that is ok?

Can now have it running on my raspberry pi almost like it's a real hassio addon :)

snozzley avatar May 06 '21 23:05 snozzley

I've added support for arm7 builds (and other platforms while I was working on it) so you can use my image now if you want 😄

dchesterton avatar May 07 '21 00:05 dchesterton

@omayhemo I got it up and running through portainer a little bit ago. Pretty straight forward:

In Portainer select Containers in the left pane > +Add Container Name: Enter in a name you want to use Registry: DockerHub Image docker.io: dchesterton/amcrest2mqtt:latest Always pull the image: toggle on Skip Network ports configuration section

Advanced container settings Network: I set the network to my home assistant instance, user preferences may vary here. Env: Environment Variables - this is the critical section. The settings below are what I used to get it working with home assistant.

Click the +add environment variable button for the amount of variables you want to enter. I only needed to add the section outlined in red. The rest were added automatically when I deployed the container.

Restart Policy: Set to unless stopped

Go back up to Actions: Click Deploy this container

I already have Portainer running on my HA. I added a Container with all required specifications. The container was deployed and it is now running.

What do I have to do next? What do I have to add to my configuration.yaml file to watch the events?

leonardomrc avatar May 22 '21 18:05 leonardomrc

I already have Portainer running on my HA. I added a Container with all required specifications. The container was deployed and it is now running.

What do I have to do next? What do I have to add to my configuration.yaml file to watch the events?

I was working through this myself tonight. If you haven't already figured it out, you'll need to setup an MQTT broker (in my case I setup as another docker container). You'll then need to setup the MQTT integration in HA. Assuming you enabled auto discovery, HA will automatically discover your Amcrest and prompt you to add it to a room. It will also add the appropriate entities which you can then add to the HA GUI via the Entity card.

Good luck!

dereitz avatar Jul 01 '21 02:07 dereitz

If you want, I can create a PR for this issue. But I'd like to get some idea of how you would like this to be implemented. Since I believe that the hassio image shouldn't wrap your original container, so it would replace it but that would make your image hassio specific. Wrapping seems to be an option too but in that case I wouldn't know how to get the addon configuration options in.

robsonke avatar Aug 01 '21 18:08 robsonke

I'd like it to be obfuscated. Install the Add-On, use the configuration screen to apply the variables, Log screen for trace. No additional containers. You'll get much larger adoption I have little doubt.

omayhemo avatar Aug 01 '21 18:08 omayhemo

Thanks, I'd welcome a PR if you have time 🙂 I definitely don't want the image to be hassio specific. I think it should be possible to pass the configuration options in as environment variables but I haven't looked into it in detail.

dchesterton avatar Aug 03 '21 17:08 dchesterton

Totally agree on that, but it makes it harder because hassio has base images with everything pre-installed. But I'll look into putting what I need in the wrapping image.

robsonke avatar Aug 03 '21 19:08 robsonke

FYI, I have a working local addon now. I'll wrap it in a repo and give you the option to fork/copy it. I'll try to do that later today.

robsonke avatar Aug 08 '21 11:08 robsonke

Here you go: https://github.com/robsonke/hassio-addons

Main page: image

Configuration: image

Startup log: image

Do whatever you want with it, my goal is to just have this in Hassio together with all other add-ons. Copy/fork/refer my repo, change the descriptions (they're still very brief), add icons (that would be nice).

robsonke avatar Aug 08 '21 16:08 robsonke

Rob's amcrest2mqtt addon installed easily and is working fine for me... (installed on RasPi4).

GaryOkie avatar Aug 17 '21 18:08 GaryOkie

Works for me also. Thanks Rob! Would be nice to see this pulled in to the main repo or even added to the Community Addon section.

Ixian avatar Aug 18 '21 20:08 Ixian

Thanks very much for doing this Rob. I will look to merge it into the main repo when I can but I'm snowed under at the moment so it won't be for a while.

dchesterton avatar Aug 18 '21 21:08 dchesterton

Thanks Rob -- I appreciate having it tied to my HA instance for backup purposes and having everything in one place Thanks dchesterton for the extensive work on creating the app and sharing with everyone

trickiegt avatar Dec 02 '21 18:12 trickiegt

Thanks Rob! I've been running yours for awhile on my HA instance, and it's been stable. @dchesterton any chance of getting it centralized/merged in here so we don't have to daisy-chain repos? No rush, just curious how you're schedule's looking :P

mr-ransel avatar Jan 03 '22 17:01 mr-ransel

While I greatly appreciated having amcrest2mqtt supported as an add-on initially, I'm no longer using it.

If the only thing you are using MQTT for is to fetch events from Amcrest or Dahua cameras/doorbell please be advised that it's really no longer necessary. Both the core Amcrest integration and the custom Dahua integration now handle event passing directly in HASS automations.

The ability to access doorbell press events, any motion event, etc., is all now available without requiring MQTT. The custom Dahua integration even has the option to automatically create binary sensors for selected events.

I should add that I had zero problems with amcrest2mqtt, and when it was the only game in town for event handling, it was great.

GaryOkie avatar Jan 03 '22 19:01 GaryOkie

While I greatly appreciated having amcrest2mqtt supported as an add-on initially, I'm no longer using it.

If the only thing you are using MQTT for is to fetch events from Amcrest or Dahua cameras/doorbell please be advised that it's really no longer necessary. Both the core Amcrest integration and the custom Dahua integration now handle event passing directly in HASS automations.

The ability to access doorbell press events, any motion event, etc., is all now available without requiring MQTT. The custom Dahua integration even has the option to automatically create binary sensors for selected events.

I should add that I had zero problems with amcrest2mqtt, and when it was the only game in town for event handling, it was great.

That's not necessarily true for all amcrest cameras. I run an ad110 doorbell camera and neither the AMCREST (cant get doorbell ring events) or DAHUA (motion notification come through every 30 seconds, video feed not working) integrations work well for me. Could be I have not invested the time on it but anything more then 30 minutes is more time then I have. The amcrest2mqtt add-on has been fairly flawless and easy to setup for me.

back to the subject of this thread it would be great though to have it all in one repo, though i have it installed and working so it will be of little benefit to me :).

briodan avatar Jan 05 '22 02:01 briodan

The purpose of amcrest2mqtt was to expose all amcrest/dahua events since the camera integrations did not have this support built in. Now they do. My point was that you can use the updated camera integrations event capability natively and simplify things a bit.

Your issue with the Amcrest integration not supporting doorbell events is no longer the case. You check for the CallNoAnswered event in the same way as you do with amcrest2mqtt, just without needing MQTT . And as to motion events occurring far too much, that could be due to checking for VideoMotion events from the AD110. This is the default for the Amcrest integration's motion binary sensor. On the AD110, look for the "AlarmLocal/Start/Stop" events instead in your automations.

GaryOkie avatar Jan 05 '22 03:01 GaryOkie

If the only thing you are using MQTT for is to fetch events from Amcrest or Dahua cameras/doorbell please be advised that it's really no longer necessary. Both the core Amcrest integration and the custom Dahua integration now handle event passing directly in HASS automations.

The ability to access doorbell press events, any motion event, etc., is all now available without requiring MQTT. The custom Dahua integration even has the option to automatically create binary sensors for selected events.

Is AI data available via the Amcrest integration? E.g., I use "human" from my AD410 doorbell cam.

Worth noting, too, that I currently use amcrest2mqtt with Homeseer, not Home Assistant, so it's still a critical tool in my bag as the best (only?) way to get the camera data into my automations. But I'm gradually moving a few things over to Home Assistant.

cc4005 avatar Jan 05 '22 13:01 cc4005

Sure - not just "AI Data", but just like amcrest2mqtt, the HASS Amcrest and Dahua integrations enable ALL events. This definitely includes AD410 human motion events.

See https://community.home-assistant.io/t/amcrest-video-doorbell-ad110-initial-impressions/171290/301?u=garyokie for examples.

And of course if you are happy with the way your setup is now, then "if ain't broke..."

GaryOkie avatar Jan 05 '22 13:01 GaryOkie

Sure - not just "AI Data", but just like amcrest2mqtt, the HASS Amcrest and Dahua integrations enable ALL events. This definitely includes AD410 human motion events.

See https://community.home-assistant.io/t/amcrest-video-doorbell-ad110-initial-impressions/171290/301?u=garyokie for examples.

And of course if you are happy with the way your setup is now, then "if ain't broke..."

Thank you for the reply and link.

cc4005 avatar Jan 05 '22 14:01 cc4005

The purpose of amcrest2mqtt was to expose all amcrest/dahua events since the camera integrations did not have this support built in. Now they do. My point was that you can use the updated camera integrations event capability natively and simplify things a bit.

Your issue with the Amcrest integration not supporting doorbell events is no longer the case. You check for the CallNoAnswered event in the same way as you do with amcrest2mqtt, just without needing MQTT . And as to motion events occurring far too much, that could be due to checking for VideoMotion events from the AD110. This is the default for the Amcrest integration's motion binary sensor. On the AD110, look for the "AlarmLocal/Start/Stop" events instead in your automations.

not to deviate too much from this thread but the documentation for either integration does not list any information on the type of events you need to monitor for or link to where you can get more information. Like I said I expected this information to be available somewhere just didn't get the time to look it up.

While technically there might not be a need for the add-on as the functionality is already there in integrations, the add-on makes the process transparent from an end user perspective. Not needing to monitor event logs to find the exact one I need or having to write event triggers simplifies things and allows more people to use it.

briodan avatar Jan 05 '22 15:01 briodan

It's worth noting that the add-on exposes all events to the amcrest2mqtt/XXX/event topic too so if the built in sensors don't work for you for whatever reason, you can also use them 😀

Personally I prefer to abstract functionality out of Home Assistant and use MQTT as the communication layer between. But I can understand that some prefer the functionality to be built-in. It's good that we have options though! 🙂

dchesterton avatar Jan 05 '22 16:01 dchesterton

You're absolutely right briodan - the docs for both integrations don't provide much detail at all on how to set up event triggers. Much of this info had to be found haphazardly in the forum. However, the custom Dahua integration does provide the abstraction capability to create binary sensors for doorbell press, etc., using the HASS configuration manager to select the events you want to trigger on.

Daniel - if a HASS user is using a different camera integration, such as ffmpeg or generic, then I fully agree that using MQTT is the best approach to provide the necessary event handling communications. Before your great work providing this, some of us were using python script hacks. But now that amcrest/dahua integrations are transmitting ALL camera events to the HASS bus, there is a duplication of subscribing to these events when using amcrest2mqtt in conjunction. (Core Amcrest is using python-amcrest to subscribe as does amcrest2mqtt, the other integration uses Dahua-VTO library).

The need to handle events with numerous cameras was also a major factor for me in using the core Amcrest integration in a HASS OS build.

It definitely is good to have these options, and have very much appreciated all your work in this.

GaryOkie avatar Jan 05 '22 16:01 GaryOkie

First, I really do appreciate your helpfulness and trying to help people solve for their individual setups @GaryOkie, more people on the internet should be like you, and many of the solutions you pointed out are great for many situations!

But also, when someone asks for an update on if a feature-request will be moved to the primary repo, I am sure you can see that a list of reasons why they should stop using this project and use others is probably not what they were hoping for. That said, I appreciate your recommendations, but this might not be the appropriate venue.

mr-ransel avatar Jan 07 '22 19:01 mr-ransel

@mr-ransel - I actually agree with you that this was not an appropriate place to provide awareness of alternative event handling. I've regretted making these posts here.

My apologies to all.

GaryOkie avatar Jan 07 '22 19:01 GaryOkie

And another Addon made by someone else... @ikifar2012 https://github.com/ikifar2012/amcrest2mqtt-addon/blob/master/README.md

No need for a community store link for this one, here is your link... ICYDK, everything in the community store is maintained by Frenck (a Nabu-Casa employee), his are the only ones there. Besides the official ones, all others are repo by repo...

Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.

https://github.com/ikifar2012/amcrest2mqtt-addon

Perhaps an edit of the main readme pointing out the add-ons that you know about using your software would be handy and you could close this issue...

UPDATE... Did the editing first pass for you, it's in a PR now.

SirGoodenough avatar Mar 09 '22 22:03 SirGoodenough