Skip to content

Add Rituals Perfume Genie sensor platform#48270

Merged
bdraco merged 12 commits intohome-assistant:devfrom
milanmeu:add-rituals-sensor-platform
Apr 11, 2021
Merged

Add Rituals Perfume Genie sensor platform#48270
bdraco merged 12 commits intohome-assistant:devfrom
milanmeu:add-rituals-sensor-platform

Conversation

@milanmeu
Copy link
Copy Markdown
Contributor

@milanmeu milanmeu commented Mar 23, 2021

Proposed change

This PR adds the sensor platform to the rituals_perfume_genie integration.

  • Add entity.py for new DiffuserEntity class:
    • DiffuserSwitch extends DiffuserEntity
    • Remove duplicate functions from DiffuserEntity
  • Add DataUpdateCoordinator:
    • Create and register DataUpdateCoordinator
    • Remove async_update from DiffuserSwitch
  • Add new sensor platform:
    • Add sensor.py
    • Add sensor to async_forward_entry_setup
  • Add new consts to const.py

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)
  • 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.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

Comment thread homeassistant/components/rituals_perfume_genie/sensor.py
Comment thread homeassistant/components/rituals_perfume_genie/sensor.py Outdated
Copy link
Copy Markdown
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

Please see comment above

Comment thread homeassistant/components/rituals_perfume_genie/sensor.py Outdated
@hmmbob
Copy link
Copy Markdown
Contributor

hmmbob commented Apr 4, 2021

Verified - current code is successfully adding new sensors for Genie v2 (which does not have a battery)

image

Comment thread homeassistant/components/rituals_perfume_genie/entity.py Outdated
Comment thread homeassistant/components/rituals_perfume_genie/entity.py Outdated
Comment thread homeassistant/components/rituals_perfume_genie/__init__.py Outdated
Copy link
Copy Markdown
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

Please see comments above

@milanmeu milanmeu force-pushed the add-rituals-sensor-platform branch from 3a78e0f to d7c96ca Compare April 4, 2021 21:18
@milanmeu
Copy link
Copy Markdown
Contributor Author

milanmeu commented Apr 5, 2021

I made the requested changes and had to do a rebase for d7c96ca.

Failing tests:

FAILED tests/components/prometheus/test_init.py::test_view[pyloop] - assert '...
ERROR tests/components/shelly/test_config_flow.py::test_form[pyloop] - Runtim...

Copy link
Copy Markdown
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

Please resolve conflicts. Thanks!

Comment thread homeassistant/components/rituals_perfume_genie/sensor.py Outdated
Comment thread homeassistant/components/rituals_perfume_genie/sensor.py Outdated
Copy link
Copy Markdown
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

Please remove the icon for any entity with device_class

https://developers.home-assistant.io/docs/core/entity/#advanced-properties

milanmeu and others added 2 commits April 11, 2021 13:29
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: J. Nick Koston <nick@koston.org>
Comment thread homeassistant/components/rituals_perfume_genie/sensor.py Outdated
Copy link
Copy Markdown
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@bdraco bdraco merged commit 71e0e42 into home-assistant:dev Apr 11, 2021
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Please address the comments in a new PR. Thanks!

Comment thread homeassistant/components/rituals_perfume_genie/__init__.py
Comment thread homeassistant/components/rituals_perfume_genie/__init__.py
Comment thread homeassistant/components/rituals_perfume_genie/sensor.py
Comment thread homeassistant/components/rituals_perfume_genie/sensor.py
def extra_state_attributes(self):
"""Return the wifi state attributes."""
return {
ATTR_SIGNAL_STRENGTH: self.coordinator.data[HUB][SENSORS][WIFI][TITLE],
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 measurement is this?

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.

Same as the battery. The description of the state as shown in the app: low, medium, ...

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.

Remove it completely or make it a separate sensor entity.

Comment thread homeassistant/components/rituals_perfume_genie/switch.py
Comment thread homeassistant/components/rituals_perfume_genie/switch.py
Comment thread homeassistant/components/rituals_perfume_genie/switch.py
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 13, 2021
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.

5 participants