8000 Refactor SmartThings by joostlek · Pull Request #137940 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Refactor SmartT 10000 hings #137940

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

Merged
merged 102 commits into from
Feb 26, 2025
Merged

Conversation

joostlek
Copy link
Member
@joostlek joostlek commented Feb 8, 2025

Proposed change

This PR is aiming to migrate SmartThings to an oauth based integration.

pySmartThings/pysmartthings@0.7.8...v1.2.0

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)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

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
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format 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.

To help with the load of incoming pull requests:

@joostlek joostlek marked this pull request as ready for review February 24, 2025 22:34
@edenhaus
Copy link
Member

Sanity check of pysmartthings==1.2.0 done ✔️

)
if (ocf := device.status[MAIN].get(Capability.OCF)) is not None:
Copy link
Member

Choose a reason for hiding this comment

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

Can ocf be typed? Maybe a TypedDict

So we can avoid all the casts

8000
Copy link
Member Author

Choose a reason for hiding this comment

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

the downside is mostly the .value and that you need both a TypedDict and a dataclass to achieve the same (while this is something I want to change in the future as I want to be able to get this data from multiple sources other than ocf)

Choose a reason for hiding this comment

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

The ocf capability is also in the deprecated list of capabilities, so depending on it might not be future proof. see https://developer.smartthings.com/docs/devices/capabilities/deprecated

name="Gas Meter Volume",
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
device_class=SensorDeviceClass.GAS,
state_class=SensorStateClass.MEASUREMENT,
)
],
},
Capability.illuminance_measurement: {
Attribute.illuminance: [
# no fixtures
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# no fixtures

Probbaly leftover from tests. Please remove all

Copy link
Member Author

Choose a reason for hiding this comment

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

I left these intentionally because I want to make sure everything is tested, but I don't have the data for this one, and I have the suspicion some are documented but never used

@home-assistant home-assistant bot marked this pull request as draft February 25, 2025 16:22
@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@joostlek joostlek marked this pull request as ready for review February 26, 2025 13:04
@home-assistant home-assistant bot requested a review from edenhaus February 26, 2025 13:04
Copy link
Member
@edenhaus edenhaus left a comment

Choose a reason for hiding this comment

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

Thanks @joostlek 👍

I will revert this PR if it will break my washing machine 😃
Joking or maybe not :P

name="Carbon Monoxide Detector",
)
]
},
Capability.carbon_monoxide_measurement: {
Attribute.carbon_monoxide_level: [
# no fixtures
Copy link
Member

Choose a reason for hiding this comment

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

Please remove all similar comments in a follow up PR as these are test comment in the production code

@edenhaus edenhaus merged commit bb12002 into home-assistant:dev Feb 26, 2025
46 checks passed
@edenhaus edenhaus added the noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) label Feb 26, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Feb 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed integration: smartthings new-feature noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) Quality Scale: No score small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0