Skip to content

Commit

Permalink
Add device_info
Browse files Browse the repository at this point in the history
Added device_info so the switch gets assigned to the device properly
  • Loading branch information
apetrycki committed Apr 17, 2024
1 parent 9495e17 commit 8d5523e
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 1 deletion.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 6 additions & 1 deletion custom_components/daikinskyport/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.entity_platform import AddEntitiesCallback

Expand All @@ -20,7 +21,7 @@
async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
"""Add a Daikin Skyport Weather entity from a config_entry."""
"""Add a Daikin Skyport Switch entity from a config_entry."""

data = hass.data[DOMAIN][entry.entry_id]
coordinator: DaikinSkyportData = data[COORDINATOR]
Expand Down Expand Up @@ -69,6 +70,10 @@ def turn_off(self, **kwargs: Any) -> None:
self.aux_on = False
self.async_write_ha_state()

@property
def device_info(self) -> DeviceInfo:
return self.data.device_info

async def async_update(self) -> None:
"""Get the latest state of the switch."""
_LOGGER.debug("Updating switch entity")
Expand Down

0 comments on commit 8d5523e

Please sign in to comment.