GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Migrate tplink integration to new module-based library api by sdb9696 · Pull Request #117839 · home-assistant/core Conversation
|
|
Hey there @rytilahti, @TheGardenMonkey, @bdraco, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This could use some testing with an iot LightStrip.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| # If there is an effect in progress | ||
| # we have to set an HSV value to clear the effect | ||
| # we have to clear the effect | ||
| # before we can set a color temp | ||
| await self.device.set_hsv(0, 0, brightness) | ||
| await self._light_module.set_hsv(0, 0, brightness) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It might also be possible to call LightEffect.set_effect(LightEffect.LIGHT_EFFECTS_OFF) here but that needs to be tested with an iot` lightstrip.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Something that can be done in the light platform rewrite.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| """Test no migration happens if the original entity id still exists.""" | ||
| config_entry = MockConfigEntry(domain=DOMAIN, data={}, unique_id=MAC_ADDRESS) | ||
| config_entry.add_to_hass(hass) | ||
| dimmer = _mocked_dimmer() | ||
| dimmer = _mocked_device(alias="My dimmer", modules=[Module.Light]) | ||
| rollout_unique_id = MAC_ADDRESS.replace(":", "").upper() |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This test does not appear to work as I haven't set the device type to dimmer and it still passes (maybe because it's creating the migrated entity entry?). Although I notice the async_fix_dimmer_unique_id function added in #57346 is no longer present so maybe the test is redundant?
Also to get the async_setup_component to properly run I had to add wait_background_tasks=True so I wonder if we need to be adding that in other tests as well.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks good on the surface, I'll give it a try later.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
PR contains a number of fixes from testing with HA devices: - Fixes a bug with turning the light on and off via `set_state` - Aligns `set_brightness` behaviour across `smart` and `iot` devices such that a value of 0 is off. - Aligns `set_brightness` behaviour for `IotDimmer` such that setting the brightness turns on the device with a transition of 1ms. ([HA comment](home-assistant/core#117839 (comment))) - Fixes a typing issue in `LightState`. - Adds `ColorTempRange` and `HSV` to `__init__.py` - Adds a `state` property to the interface returning `LightState` for validating `set_state` changes. - Adds tests for `set_state`
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This is good to go, the platform code will be cleaned up in the following platform-specific PRs. Thanks for the PR! 🥇
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| """Representation of a TPLink Smart Light Strip.""" | ||
|
|
||
| device: SmartLightStrip | ||
| def __init__( |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We can get rid of this now, but that's something for the light platform rewrite 👍
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # If there is an effect in progress | ||
| # we have to set an HSV value to clear the effect | ||
| # we have to clear the effect | ||
| # before we can set a color temp | ||
| await self.device.set_hsv(0, 0, brightness) | ||
| await self._light_module.set_hsv(0, 0, brightness) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Something that can be done in the light platform rewrite.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
* Bump version to 0.7.0.dev0 * Convert SmartDeviceException->KasaException, SmartDevice->Device * Implement feature-based entities & convert switch platform over * Allow passing kwargs to descriptions * Disable all but explicitly enabled debug features per default * Convert SmartDeviceException->KasaException, SmartDevice->Device * Migrate tplink integration to new common module kasa library api * Add has_custom_effects check * Remove NO_SWITCH_DEVICE_MODULES const * Remove led test stuff * Migrate tplink integration to new module-based library api (#117839) Migrate the tplink integration to the new common module format of the kasa library api. Also includes a small dependency bump to pick up some bugfixes found during testing: https://github.com/python-kasa/python-kasa/releases/tag/0.7.0.dev1 See #117785 for an explanation of the approach for merging into the `tplink_rewrite` branch. --------- Co-authored-by: Teemu Rytilahti <[email protected]> * Remove leftover no switch module const --------- Co-authored-by: Teemu Rytilahti <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.