Skip to content

Commit

Permalink
Add mac address connection (#13)
Browse files Browse the repository at this point in the history
* Add mac_address as connection identifier

* Bump version to v0.1.9
  • Loading branch information
jbouwh authored Sep 1, 2022
1 parent 56f528e commit ef87f63
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions custom_components/elro_connects/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
from homeassistant.const import ATTR_NAME, CONF_API_KEY, CONF_HOST, CONF_PORT
from homeassistant.core import Event, HomeAssistant, callback
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.device_registry import EVENT_DEVICE_REGISTRY_UPDATED
from homeassistant.helpers.device_registry import (
EVENT_DEVICE_REGISTRY_UPDATED,
format_mac,
)
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.entity import DeviceInfo, EntityDescription
from homeassistant.helpers.update_coordinator import (
Expand Down Expand Up @@ -247,10 +250,14 @@ def device_info(self) -> DeviceInfo:
"""Return info for device registry."""
# connector
device_registry = dr.async_get(self.hass)
mac_address = format_mac(self._connector_id[3:])
device_registry.async_get_or_create(
model="K1 (SF40GA)",
config_entry_id=self._entry.entry_id,
identifiers={(DOMAIN, self._connector_id)},
identifiers={
(DOMAIN, self._connector_id),
(dr.CONNECTION_NETWORK_MAC, mac_address),
},
manufacturer="Elro",
name=f"Elro Connects K1 {self._connector_id}",
)
Expand Down
2 changes: 1 addition & 1 deletion custom_components/elro_connects/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"requirements": ["lib-elro-connects==0.5.3"],
"codeowners": ["@jbouwh"],
"iot_class": "local_polling",
"version": "0.1.9"
"version": "0.1.10"
}
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.8
0.1.9

0 comments on commit ef87f63

Please sign in to comment.