Skip to content
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 Ezviz siren entity #93612

Merged
merged 32 commits into from Aug 13, 2023
Merged

Conversation

RenierM26
Copy link
Contributor

@RenierM26 RenierM26 commented May 26, 2023

Proposed change

Add Ezviz siren entity.

EZVIZ calls this "Active Defence" and it could be a combination of Siren + Strobe or just a Strobe on some cameras.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

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

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

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link

Hey there @BaQs, mind taking a look at this pull request as it has been labeled with an integration (ezviz) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of ezviz can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign ezviz Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@RenierM26 RenierM26 marked this pull request as draft June 3, 2023 07:34
@RenierM26 RenierM26 marked this pull request as ready for review June 3, 2023 08:29
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
@RenierM26 RenierM26 marked this pull request as ready for review August 9, 2023 17:29
@gjohansson-ST
Copy link
Member

Final remarks. Please undraft when ready.

@gjohansson-ST gjohansson-ST marked this pull request as draft August 10, 2023 09:44
@RenierM26 RenierM26 marked this pull request as ready for review August 10, 2023 18:42
@home-assistant home-assistant bot marked this pull request as draft August 10, 2023 19:56
@RenierM26

This comment was marked as duplicate.

@RenierM26 RenierM26 marked this pull request as ready for review August 13, 2023 05:40
@RenierM26 RenierM26 marked this pull request as draft August 13, 2023 07:56
@RenierM26 RenierM26 marked this pull request as ready for review August 13, 2023 08:08
homeassistant/components/ezviz/siren.py Outdated Show resolved Hide resolved
self.coordinator.ezviz_client.sound_alarm, self._serial, 2
):
self._attr_is_on = True
evt.async_call_later(self.hass, OFF_DELAY, self.off_delay_listener)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if someone press turn on 30 seconds after the first on press?
Still going to turn off after the first 60 seconds or should you get a new 60 seconds?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see it resets, have added logic to reset the event.

Thanks for asking.

@home-assistant home-assistant bot marked this pull request as draft August 13, 2023 09:51
RenierM26 and others added 2 commits August 13, 2023 12:05
@RenierM26 RenierM26 marked this pull request as ready for review August 13, 2023 11:03
Copy link
Member

@gjohansson-ST gjohansson-ST left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thanks @RenierM26 👍

@gjohansson-ST gjohansson-ST merged commit 00c6015 into home-assistant:dev Aug 13, 2023
21 checks passed
@RenierM26 RenierM26 deleted the ezviz_siren_entity branch August 13, 2023 11:19
h3l1o5 pushed a commit to h3l1o5/ha_core that referenced this pull request Aug 14, 2023
* Initial commit

* Add siren entity

* Update coveragerc

* Cleanup unused entity description.

* Add restore and fix entity property to standards.

* Schedule turn off to match camera firmware

* Only add siren for devices that support capability

* Removed unused attribute and import.

* Add translation

* Update camera.py

* Update strings.json

* Update camera.py

* Cleanup

* Update homeassistant/components/ezviz/siren.py

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* use description

* Apply suggestions from code review

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* Update strings.json

* Dont inherit coordinator class.

* Add assumed state

* Update homeassistant/components/ezviz/siren.py

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* Reset delay listener if trigered

---------

Co-authored-by: G Johansson <goran.johansson@shiftit.se>
@github-actions github-actions bot locked and limited conversation to collaborators Aug 14, 2023
ir.async_create_issue(
self.hass,
DOMAIN,
"service_depreciation_sound_alarm",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deprecation

self.async_write_ha_state()

@callback
def off_delay_listener(self, now: datetime) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't allow calculating state in Home Assistant for device integrating integrations. The device should update its state. Please move the update to the 3rd party library.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants