Skip to content
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

Added device with deviceInfo based on device name, type, model and firmware version #28

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion custom_components/intesishome/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.event import async_call_later
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from homeassistant.helpers.entity import DeviceInfo


from . import DOMAIN
Expand Down Expand Up @@ -111,7 +112,7 @@ async def async_setup_entry(
IntesisAC(ih_device_id, device, controller)
for ih_device_id, device in ih_devices.items()
],
update_before_add=True,
update_before_add=False,
)
else:
await async_setup_platform(hass, config, async_add_entities)
Expand Down Expand Up @@ -575,3 +576,23 @@ def target_temperature(self) -> float | None:
if self._power and self.hvac_mode not in [HVACMode.FAN_ONLY, HVACMode.OFF]:
return self._target_temp
return None

@property
def device_info(self) -> DeviceInfo:
"""Return the device info."""
controller_model = None
controller_fw_version = None
if hasattr(self._controller, "get_model"):
controller_model = self._controller.get_model(self._device_id)
if hasattr(self._controller, "get_fw_version"):
controller_fw_version = self._controller.get_fw_version(self._device_id)
return DeviceInfo(
identifiers={
# Serial numbers are unique identifiers within a specific domain
(DOMAIN, self._controller.controller_id, self._device_id)
},
name=self._device_name,
manufacturer=self._device_type.capitalize(),
model=controller_model,
sw_version=controller_fw_version
)
Loading