-
-
Notifications
You must be signed in to change notification settings - Fork 38.3k
Use DeviceInfo Class S #58338
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
Use DeviceInfo Class S #58338
Changes from 3 commits
f9c3746
d09e4f3
32e68be
3180f75
0c78693
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ | |
| async_dispatcher_connect, | ||
| async_dispatcher_send, | ||
| ) | ||
| from homeassistant.helpers.entity import Entity | ||
| from homeassistant.helpers.entity import DeviceInfo, Entity | ||
| from homeassistant.helpers.event import async_track_time_interval | ||
| from homeassistant.helpers.typing import ConfigType | ||
|
|
||
|
|
@@ -409,6 +409,12 @@ def __init__(self, device: DeviceEntity) -> None: | |
| """Initialize the instance.""" | ||
| self._device = device | ||
| self._dispatcher_remove = None | ||
| self._attr_device_info = DeviceInfo( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a functional change, things like name won't update anymore. Was this intentional?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have smartthings and my testing confirms integration is functional as before except for the obvious, no name updates.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But that is intentional?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, @andrewsayre as the codeowner of the smartthings integration, do you agree? |
||
| identifiers={(DOMAIN, device.device_id)}, | ||
| manufacturer="Unavailable", | ||
| model=device.device_type_name, | ||
| name=device.label, | ||
| ) | ||
|
|
||
| async def async_added_to_hass(self): | ||
| """Device added to hass.""" | ||
|
|
@@ -427,16 +433,6 @@ async def async_will_remove_from_hass(self) -> None: | |
| if self._dispatcher_remove: | ||
| self._dispatcher_remove() | ||
|
|
||
| @property | ||
| def device_info(self): | ||
| """Get attributes about the device.""" | ||
| return { | ||
| "identifiers": {(DOMAIN, self._device.device_id)}, | ||
| "name": self._device.label, | ||
| "model": self._device.device_type_name, | ||
| "manufacturer": "Unavailable", | ||
| } | ||
|
|
||
| @property | ||
| def name(self) -> str: | ||
| """Return the name of the device.""" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.