Skip to content

Reolink add new number entities#87932

Merged
frenck merged 18 commits into
home-assistant:devfrom
starkillerOG:reolink_floodlight_bright
Mar 6, 2023
Merged

Reolink add new number entities#87932
frenck merged 18 commits into
home-assistant:devfrom
starkillerOG:reolink_floodlight_bright

Conversation

@starkillerOG
Copy link
Copy Markdown
Contributor

@starkillerOG starkillerOG commented Feb 12, 2023

Breaking change

Proposed change

Add Reolink control for:

  • floodlight brightness
  • volume
  • guard return time
  • motion sensitivity
  • AI sensitivity for
    • Face detection
    • People detection
    • Vehicle detection
    • Pet detection

Completing all reolink features with these PRs:

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
  • 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:

Comment thread homeassistant/components/reolink/number.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft February 12, 2023 19:03
@home-assistant
Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@starkillerOG starkillerOG marked this pull request as ready for review February 13, 2023 09:33
@home-assistant home-assistant Bot requested a review from frenck February 13, 2023 09:33
@starkillerOG starkillerOG marked this pull request as draft February 13, 2023 11:16
@starkillerOG
Copy link
Copy Markdown
Contributor Author

starkillerOG commented Feb 13, 2023

Floodlight brightness is going to be implemented as a light entity instead.
Once I made that PR, I will clean this PR to only have the small typing fixes etc.

First we need to decide how to implement the floodlight, see discussion here: #87943

Version bump to Reolink-aio 0.5.0 required, see PR #88594.

@starkillerOG starkillerOG mentioned this pull request Feb 13, 2023
19 tasks
@starkillerOG starkillerOG changed the title Reolink add floodlight brightness Reolink add floodlight brightness and volume control Feb 17, 2023
@starkillerOG starkillerOG marked this pull request as ready for review February 22, 2023 17:36
@starkillerOG starkillerOG changed the title Reolink add floodlight brightness and volume control Reolink add new number entities Feb 22, 2023
@starkillerOG
Copy link
Copy Markdown
Contributor Author

@frenck I have adressed all changes you requested, could you do another review?

Comment thread homeassistant/components/reolink/number.py Outdated
@starkillerOG starkillerOG mentioned this pull request Mar 3, 2023
19 tasks
Comment thread homeassistant/components/reolink/number.py Outdated
Comment thread homeassistant/components/reolink/number.py Outdated
Comment thread homeassistant/components/reolink/number.py Outdated
Comment thread homeassistant/components/reolink/number.py Outdated
Comment thread homeassistant/components/reolink/number.py Outdated
Comment thread homeassistant/components/reolink/number.py Outdated
Comment thread homeassistant/components/reolink/number.py Outdated
Comment thread homeassistant/components/reolink/number.py Outdated
Comment thread homeassistant/components/reolink/number.py Outdated
Comment thread homeassistant/components/reolink/number.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft March 6, 2023 08:57
@starkillerOG starkillerOG marked this pull request as ready for review March 6, 2023 09:16
@home-assistant home-assistant Bot requested a review from frenck March 6, 2023 09:16
Copy link
Copy Markdown
Member

@frenck frenck 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 @starkillerOG 👍

../Frenck

@frenck frenck merged commit b2166c3 into home-assistant:dev Mar 6, 2023
Comment on lines +70 to +81
ReolinkNumberEntityDescription(
key="floodlight_brightness",
name="Floodlight turn on brightness",
icon="mdi:spotlight-beam",
entity_category=EntityCategory.CONFIG,
native_step=1,
native_min_value=1,
native_max_value=100,
supported=lambda api, ch: api.supported(ch, "floodLight"),
value=lambda api, ch: api.whiteled_brightness(ch),
method=lambda api, ch, value: api.set_whiteled(ch, brightness=int(value)),
),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's the difference between this number entity and the light entity for the floodlight?

ReolinkLightEntityDescription(
key="floodlight",
name="Floodlight",
icon="mdi:spotlight-beam",
supported_fn=lambda api, ch: api.supported(ch, "floodLight"),
is_on_fn=lambda api, ch: api.whiteled_state(ch),
turn_on_off_fn=lambda api, ch, value: api.set_whiteled(ch, state=value),
get_brightness_fn=lambda api, ch: api.whiteled_brightness(ch),
set_brightness_fn=lambda api, ch, value: api.set_whiteled(ch, brightness=value),
),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See discussion above: #87932 (review)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I read up on the comment history in the PR.

Please add a code comment explaining the situation so we don't need to wonder what's going on when reading the code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍
CC @starkillerOG

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will add a code comment and some extra documentation because this is indeed not clear enough, just a moment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Documentation PR is here: home-assistant/home-assistant.io#26469

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Code comment PR is here: #89234

@github-actions github-actions Bot locked and limited conversation to collaborators Mar 7, 2023
@frenck frenck added the noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) label Mar 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

by-code-owner cla-signed integration: reolink new-feature noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) Quality Scale: No score small-pr PRs with less than 30 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants