New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Zoneminder availability sensor #20184

Merged
merged 4 commits into from Jan 17, 2019

Conversation

Projects
None yet
4 participants
@rohankapoorcom
Copy link
Member

rohankapoorcom commented Jan 17, 2019

Description:

In #18946, I hooked up the existing ZoneMinder entities with the availability of ZoneMinder. It would be useful to have this information available to automations. The simplest approach appears to be creating a new binary sensor platform.

This should be rebased and then merged after #20182.

Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#8206

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.
@balloob

This comment has been minimized.

Copy link
Member

balloob commented Jan 17, 2019

I'm not sure if I understand the purpose. Wouldn't users be able to just track the state of any Zoneminder entity and just check if it became unavailable?

@rohankapoorcom

This comment has been minimized.

Copy link
Member Author

rohankapoorcom commented Jan 17, 2019

I'm not sure if I understand the purpose. Wouldn't users be able to just track the state of any Zoneminder entity and just check if it became unavailable?

Yes (kind of), but this feels a little brittle to me. In my case I'm connected to a couple of different of ZoneMinder instances (one over a site to site vpn) and want to bounce the VPN if multiple things I'm connected to aren't connecting properly. It makes for a simpler automation for there to just be a binary sensor per ZoneMinder host, rather than looking through the camera entities and picking one from there. It could also be problematic if you moved cameras from one host to another and that was the camera you were using to track host availability.

Additionally, the cameras, switches and sensors are tracking the availability of the ZoneMinder monitor (the camera), this is tracking the availability of the ZoneMinder system. There's a bunch of situations where a single monitor could go offline but the ZoneMinder system is still connected.

@balloob
Copy link
Member

balloob left a comment

Sounds like a good use case.

@balloob balloob merged commit 5232df3 into home-assistant:dev Jan 17, 2019

5 checks passed

Hound No violations found. Woof!
WIP ready for review
Details
cla-bot Everyone involved has signed the CLA
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.002%) to 92.919%
Details

@wafflebot wafflebot bot removed the in progress label Jan 17, 2019

@rohankapoorcom rohankapoorcom deleted the rohankapoorcom:zoneminder-availability-sensor branch Jan 17, 2019

@rohankapoorcom

This comment has been minimized.

Copy link
Member Author

rohankapoorcom commented Jan 17, 2019

I'll update docs for this platform tonight.

mxworm added a commit to mxworm/home-assistant that referenced this pull request Jan 17, 2019

Merge branch 'dev' into current
* dev: (87 commits)
  Add JSON attribute topic to MQTT switch (home-assistant#20192)
  Add JSON attribute topic to MQTT light (home-assistant#20191)
  Add JSON attribute topic to MQTT cover (home-assistant#20190)
  Add a Zoneminder availability sensor (home-assistant#20184)
  Add command to refresh auth (home-assistant#20183)
  Distribute reconnect (home-assistant#20181)
  Embed zoneminder platforms into component (home-assistant#20182)
  Sensibo to use HA operation modes (home-assistant#20180)
  Remove color call to set lights to black. (home-assistant#20176)
  Updated frontend to 20190116.0
  Add support for deconz radios to zha component (home-assistant#20167)
  Add Xiaomi Airpurifier Pro V7 support (home-assistant#20093)
  Bump pynuki to 1.3.2 (home-assistant#20173)
  Strip login username in backend (home-assistant#20150)
  Upgrade aiohttp to 3.5.3 (home-assistant#19957)
  Log exceptions thrown by MQTT message callbacks (home-assistant#19977)
  Make imports relative in ZHA component (home-assistant#20020)
  imap_email_content: allow configuring folder to read. (home-assistant#20160)
  Migrate gpslogger to the automatically generated webhook (home-assistant#20079)
  Support device_class for rest sensor (home-assistant#20132)
  ...

@rohankapoorcom rohankapoorcom referenced this pull request Jan 18, 2019

Merged

Add docs for the ZoneMinder binary sensor #8206

2 of 2 tasks complete

@balloob balloob referenced this pull request Feb 6, 2019

Merged

0.87.0 #20794

alandtse added a commit to alandtse/home-assistant that referenced this pull request Feb 12, 2019

Add a Zoneminder availability sensor (home-assistant#20184)
* Embed zoneminder platforms into component

* Add a binary sensor for ZoneMinder availability

* Lint

* Add missing docstrings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment