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

Implement action feature #849

Merged
merged 2 commits into from
Apr 23, 2024
Merged

Implement action feature #849

merged 2 commits into from
Apr 23, 2024

Conversation

rytilahti
Copy link
Member

@rytilahti rytilahti commented Apr 20, 2024

Adds FeatureType.Action making it possible to expose features like "reboot", "test alarm", "pair" etc.

The attribute_getter is no longer mandatory, but it will raise an exception if not defined for other types than actions.
Trying to read returns a static string <Action>.
This overloads the set_value to call the given callable on any value.

This also fixes the play and stop coroutines of the alarm module to await the call.

@rytilahti rytilahti added the enhancement New feature or request label Apr 20, 2024
Copy link

codecov bot commented Apr 20, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 3 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (master@203bd79). Click here to learn what that means.
Report is 11 commits behind head on master.

Files Patch % Lines
kasa/smart/modules/alarmmodule.py 50.00% 2 Missing ⚠️
kasa/feature.py 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master     #849   +/-   ##
=========================================
  Coverage          ?   89.12%           
=========================================
  Files             ?       67           
  Lines             ?     4671           
  Branches          ?     1149           
=========================================
  Hits              ?     4163           
  Misses            ?      421           
  Partials          ?       87           

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

@rytilahti
Copy link
Member Author

Action might be a better name for this, considering how homeassistant-centric Button is.

@rytilahti rytilahti mentioned this pull request Apr 23, 2024
3 tasks
@rytilahti rytilahti requested a review from sdb9696 April 23, 2024 16:26
@rytilahti rytilahti marked this pull request as ready for review April 23, 2024 16:26
@rytilahti rytilahti changed the title Implement button feature Implement action feature Apr 23, 2024
Copy link
Collaborator

@sdb9696 sdb9696 left a comment

Choose a reason for hiding this comment

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

lgtm

@rytilahti rytilahti merged commit 6e5cae1 into master Apr 23, 2024
29 checks passed
@rytilahti rytilahti deleted the feat/button_feature branch April 23, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants