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 fixture for p300 1.0.15 #915

Merged
merged 1 commit into from
Jun 10, 2024
Merged

Conversation

rytilahti
Copy link
Member

@rytilahti rytilahti commented May 13, 2024

This version adds auto-off for individual strip sockets.

@sdb9696 sdb9696 force-pushed the janitor/add_updated_p300_fixture branch from c1bdb28 to 9843fbe Compare June 9, 2024 08:51
@sdb9696
Copy link
Collaborator

sdb9696 commented Jun 9, 2024

I'm guessing this is erroring initially because the parent device does not support auto_off but reports it in the same way as the ks240 reports it's child device features?

I think once #964 is merged we can use the test framework changes in that PR to ensure we call the module on the child devices for this use case. We'd also need to extend the module logic so it actually performs the child query.

I'm thinking we may be able to improve on the current logic around not adding modules that the parent reports but doesn't really support (i.e. ks240). Rather than simply not adding it if the child reports it we could instead implement the _is_supported to look in the parent device info for the appropriate property, i.e. "auto_off_status", "fan_speed_level", "brightness" and not add them that way. I actually think this might already work for the ks240 so will try it out tomorrow.

@rytilahti
Copy link
Member Author

I'm guessing this is erroring initially because the parent device does not support auto_off but reports it in the same way as the ks240 reports it's child device features?

Correct.

I think once #964 is merged we can use the test framework changes in that PR to ensure we call the module on the child devices for this use case.

I'm not sure we can do this type of magic, at least not on all devices, as each individual socket have their own auto off timers.

We'd also need to extend the module logic so it actually performs the child query.

Yes, this would fix it for P300. We probably do not want to perform all child module queries as most of the times the information is already available, but we could use a logic on specific modules to check which extra queries to run?

Rather than simply not adding it if the child reports it we could instead implement the _is_supported to look in the parent device info for the appropriate property, i.e. "auto_off_status", "fan_speed_level", "brightness" and not add them that way.

Sounds worth trying out 👍

@sdb9696
Copy link
Collaborator

sdb9696 commented Jun 10, 2024

I'm guessing this is erroring initially because the parent device does not support auto_off but reports it in the same way as the ks240 reports it's child device features?

Correct.

I think once #964 is merged we can use the test framework changes in that PR to ensure we call the module on the child devices for this use case.

I'm not sure we can do this type of magic, at least not on all devices, as each individual socket have their own auto off timers.

We'd also need to extend the module logic so it actually performs the child query.

Yes, this would fix it for P300. We probably do not want to perform all child module queries as most of the times the information is already available, but we could use a logic on specific modules to check which extra queries to run?

Rather than simply not adding it if the child reports it we could instead implement the _is_supported to look in the parent device info for the appropriate property, i.e. "auto_off_status", "fan_speed_level", "brightness" and not add them that way.

Sounds worth trying out 👍

#966 removes the switch hardcoding for not adding unsupported modules to the parent.

The P300 with child auto_off should now be supported with #967.

rytilahti pushed a commit that referenced this pull request Jun 10, 2024
Replaces the logic to skip adding child modules to parent devices based
on whether a device is a wall switch and instead relies on the
`_check_supported` method. Is more future proof and will fix issue with
the P300 with child `auto_off` modules
#915 not supported on the
parent.
rytilahti pushed a commit that referenced this pull request Jun 10, 2024
Required for the P300 firmware update with `auto_off` module on child
devices. Will query child modules for parent devices that are not hubs.

Coverage will be fixed when the P300 fixture is added
#915
This adds auto-off to the device, but it seems to be using different commands to control it.
@rytilahti rytilahti force-pushed the janitor/add_updated_p300_fixture branch from 9843fbe to 2ffb62c Compare June 10, 2024 14:47
Copy link

codecov bot commented Jun 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.49%. Comparing base (db6276d) to head (2ffb62c).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #915      +/-   ##
==========================================
+ Coverage   91.33%   91.49%   +0.16%     
==========================================
  Files          83       83              
  Lines        5539     5539              
  Branches     1349     1349              
==========================================
+ Hits         5059     5068       +9     
+ Misses        374      369       -5     
+ Partials      106      102       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rytilahti rytilahti merged commit 447d829 into master Jun 10, 2024
27 checks passed
@rytilahti rytilahti deleted the janitor/add_updated_p300_fixture branch June 10, 2024 15:00
@sdb9696 sdb9696 added the maintenance Project improvements and maintenance label Jun 10, 2024
@sdb9696 sdb9696 mentioned this pull request Jun 10, 2024
sdb9696 added a commit that referenced this pull request Jun 10, 2024
## [0.7.0.dev4](https://github.com/python-kasa/python-kasa/tree/0.7.0.dev4) (2024-06-10)

[Full Changelog](0.7.0.dev3...0.7.0.dev4)

**Implemented enhancements:**

- Support smart child modules queries [\#967](#967) (@sdb9696)
- Do not expose child modules on parent devices [\#964](#964) (@sdb9696)
- Do not add parent only modules to strip sockets [\#963](#963) (@sdb9696)

**Project maintenance:**

- Better checking of child modules not supported by parent device [\#966](#966) (@sdb9696)
- Add fixture for p300 1.0.15 [\#915](#915) (@rytilahti)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Project improvements and maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants