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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename set_wifi_led_* to set_led_* for xiaomi_miio #68629

Conversation

rytilahti
Copy link
Member

Breaking change

To consolidate the services to allow further extensions, the following changes have been made:

  • Service switch_set_wifi_led_on is renamed to switch_set_led_on
  • Service switch_set_wifi_led_off is renamed to switch_set_led_off
  • State attribute wifi_led is renamed to led

Proposed change

The upstream is moving towards having common APIs which involves some renaming some existing properties and methods,
causing deprecation warnings at homeassistant's code.
This PR converts the switch platform to use the new names, and also takes the opportunity to consolidate the naming scheme to be consistent with upstream.

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

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:

@probot-home-assistant
Copy link

This pull request needs to be manually signed off by @home-assistant/core before it can get merged.
(message by ReviewEnforcer)

@project-bot project-bot bot added this to Needs review in Dev Mar 24, 2022
@probot-home-assistant
Copy link

Hey there @syssi, @starkillerOG, @bieniu, mind taking a look at this pull request as it has been labeled with an integration (xiaomi_miio) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@project-bot project-bot bot moved this from Needs review to By Code Owner in Dev Mar 24, 2022
if self._device_features & FEATURE_SET_WIFI_LED == 1 and state.wifi_led:
self._state_attrs[ATTR_WIFI_LED] = state.wifi_led
if self._device_features & FEATURE_SET_LED == 1 and state.led:
self._state_attrs[ATTR_LED] = state.led
Copy link
Member

Choose a reason for hiding this comment

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

An LED shouldn't be an attribute and have their own services for control. It should just be a light entity with entity category "config".

Copy link
Member

Choose a reason for hiding this comment

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

The new name is a bit misleading. The LED is a "WiFi connection indicator" and can be disabled to not annoy the owner. Do you agree to use a switch entity using the entity category "config" in this case?

Copy link
Member

Choose a reason for hiding this comment

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

Yes. Sonos does something similar with status light:

image

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, I created this PR just to fix the deprecated warning so I will close this now. The real solution is to improve the backend library to allow creating entities based on what is supported by the given device, and remove all custom services altogether.

I put some thoughts on this topic in #67058 (comment) but I'm afraid I won't personally have any free time in the future to pursue this.

@github-actions
Copy link

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@github-actions github-actions bot added the stale label Apr 23, 2022
@rytilahti
Copy link
Member Author

If someone is reading this issue and thinks about working on it, see #67058 (comment) for ideas how to do it properly.

@rytilahti rytilahti closed this Apr 25, 2022
Dev automation moved this from By Code Owner to Cancelled Apr 25, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 26, 2022
@rytilahti rytilahti deleted the xiaomi_miio/fix/remove_deprecated_calls branch May 11, 2022 22:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Cancelled
Development

Successfully merging this pull request may close these issues.

xiaomi_miio/switch.py:924: DeprecationWarning: Call to deprecated function wifi_led (Use led())
5 participants