-
-
Notifications
You must be signed in to change notification settings - Fork 37.2k
Use DeviceInfo Class T-V #58445
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 T-V #58445
Changes from all commits
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 |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ | |
| async_dispatcher_connect, | ||
| async_dispatcher_send, | ||
| ) | ||
| from homeassistant.helpers.entity import DeviceInfo | ||
| from homeassistant.helpers.entity_platform import AddEntitiesCallback | ||
| from homeassistant.helpers.update_coordinator import DataUpdateCoordinator | ||
|
|
||
|
|
@@ -180,27 +181,27 @@ async def async_update(self) -> None: | |
| is_on = await self._device.get_power_state(log_api_exception=False) | ||
|
|
||
| if is_on is None: | ||
| if self._attr_available: | ||
| if self.available: | ||
|
Contributor
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. Is this a deliberate change? |
||
| _LOGGER.warning( | ||
| "Lost connection to %s", self._config_entry.data[CONF_HOST] | ||
| ) | ||
| self._attr_available = False | ||
| return | ||
|
|
||
| if not self._attr_available: | ||
| if not self.available: | ||
|
Contributor
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. Is this a deliberate change? |
||
| _LOGGER.info( | ||
| "Restored connection to %s", self._config_entry.data[CONF_HOST] | ||
| ) | ||
| self._attr_available = True | ||
|
|
||
| if not self._attr_device_info: | ||
| self._attr_device_info = { | ||
| "identifiers": {(DOMAIN, self._attr_unique_id)}, | ||
| "name": self._attr_name, | ||
| "manufacturer": "VIZIO", | ||
| "model": await self._device.get_model_name(log_api_exception=False), | ||
| "sw_version": await self._device.get_version(log_api_exception=False), | ||
| } | ||
| if not self.device_info: | ||
|
Contributor
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. Is this a deliberate change? |
||
| self._attr_device_info = DeviceInfo( | ||
| identifiers={(DOMAIN, self._attr_unique_id)}, | ||
| manufacturer="VIZIO", | ||
| model=await self._device.get_model_name(log_api_exception=False), | ||
| name=self.name, | ||
| sw_version=await self._device.get_version(log_api_exception=False), | ||
| ) | ||
|
|
||
| if not is_on: | ||
| self._attr_state = STATE_OFF | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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 revert all the changes that don't have tests and you haven't tested.