-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from P-Storm/fix/multiple-devices
Fixes multiple devices grouped weird
- Loading branch information
Showing
10 changed files
with
195 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from __future__ import annotations | ||
|
||
from homeassistant.config_entries import ConfigEntry | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers import device_registry as dr | ||
from homeassistant.helpers.device_registry import DeviceInfo | ||
from custom_components.button_plus.buttonplushub import ButtonPlusHub | ||
|
||
from .const import DOMAIN, MANUFACTURER | ||
|
||
|
||
class BarModuleDevice: | ||
def __init__(self, hass: HomeAssistant, entry: ConfigEntry, hub: ButtonPlusHub, connector_id: int) -> None: | ||
self.device_registry = dr.async_get(hass) | ||
|
||
self.device = self.device_registry.async_get_or_create( | ||
config_entry_id=entry.entry_id, | ||
connections={(DOMAIN, hub.config.info.device_id)}, | ||
name=f"{hub._name} BAR Module {connector_id}", | ||
model="Bar module", | ||
manufacturer=MANUFACTURER, | ||
suggested_area=hub.config.core.location, | ||
identifiers={ | ||
(DOMAIN, f"{hub._hub_id} BAR Module {connector_id}") | ||
}, | ||
via_device=(DOMAIN, hub.hub_id) | ||
) | ||
|
||
class DisplayModuleDevice: | ||
def __init__(self, hass: HomeAssistant, entry: ConfigEntry, hub: ButtonPlusHub) -> None: | ||
self.device_registry = dr.async_get(hass) | ||
|
||
self.device = self.device_registry.async_get_or_create( | ||
config_entry_id=entry.entry_id, | ||
connections={(DOMAIN, hub.config.info.device_id)}, | ||
name=f"{hub._name} Display Module", | ||
model="Display Module", | ||
manufacturer=MANUFACTURER, | ||
suggested_area=hub.config.core.location, | ||
identifiers={ | ||
(DOMAIN, f"{hub._hub_id} Display Module") | ||
}, | ||
via_device=(DOMAIN, hub.hub_id) | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.