-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
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
Refactor SmartThings #137940
Conversation
Sanity check of |
) | ||
if (ocf := device.status[MAIN].get(Capability.OCF)) is not None: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# no fixtures |
Probbaly leftover from tests. Please remove all
There was a problem hiding this comment.
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
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
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
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: