Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
timon37 Tomasz Borowik committed Dec 23, 2024
1 parent d2c3c2e commit acb6f6b
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion custom_components/bermuda/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async def async_setup_entry(hass, entry, async_add_devices):


class BermudaBinarySensor(BermudaEntity, BinarySensorEntity):
"""bermuda binary_sensor class."""
"""permuda binary_sensor class."""

@property
def name(self):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/bermuda/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

from .log_spam_less import BermudaLogSpamLess

NAME = "Bermuda BLE Trilateration"
DOMAIN = "bermuda"
NAME = "Permuda BLE Mapping"
DOMAIN = "permuda"
DOMAIN_DATA = f"{DOMAIN}_data"
# Version gets updated by github workflow during release.
# The version in the repository should always be 0.0.0 to reflect
Expand Down
2 changes: 1 addition & 1 deletion custom_components/bermuda/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def _get_or_create_device(self, address: str) -> BermudaDevice:
mac = format_mac(address).lower()
self.devices[mac] = device = BermudaDevice(address=mac, options=self.options)
device.address = mac
device.unique_id = mac
device.unique_id = DOMAIN + mac
return device

async def _async_update_data(self):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/bermuda/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect

from .const import SIGNAL_DEVICE_NEW
from .const import *
from .entity import BermudaEntity

if TYPE_CHECKING:
Expand Down Expand Up @@ -69,7 +69,7 @@ class BermudaDeviceTracker(BermudaEntity, BaseTrackerEntity):

_attr_should_poll = False
_attr_has_entity_name = True
_attr_name = "Bermuda Tracker"
_attr_name = "Permuda Tracker"

@property
def unique_id(self):
Expand Down
9 changes: 5 additions & 4 deletions custom_components/bermuda/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def device_info(self):
model = None

if self._device.is_scanner:
connection = {(dr.CONNECTION_NETWORK_MAC, self._device.address.lower())}
connection = {(dr.CONNECTION_NETWORK_MAC, DOMAIN + self._device.address.lower())}
elif self._device.address_type == ADDR_TYPE_IBEACON:
# ibeacon doesn't (yet) actually set a "connection", but
# this "matches" what it stores for identifier.
Expand All @@ -121,7 +121,7 @@ def device_info(self):
elif self._device.address_type == ADDR_TYPE_PRIVATE_BLE_DEVICE:
# Private BLE Device integration doesn't specify "connection" tuples,
# so we use what it defines for the "identifier" instead.
connection = {("private_ble_device", self._device.address.lower())}
connection = {(DOMAIN_PRIVATE_BLE_DEVICE, self._device.address.lower())}
# We don't set the model since the Private BLE integration should have
# already named it nicely.
# model = f"IRK: {self._device.address.lower()[:4]}"
Expand All @@ -135,6 +135,7 @@ def device_info(self):
domain_name = DOMAIN_PRIVATE_BLE_DEVICE
else:
connection = {(dr.CONNECTION_BLUETOOTH, self._device.address.upper())}
# connection = {(DOMAIN_PRIVATE_BLE_DEVICE, self._device.address.upper())}
# No need to set model, since MAC address will be shown via connection.
# model = f"Bermuda: {self._device.address.lower()}"

Expand Down Expand Up @@ -201,6 +202,6 @@ def _cached_ratelimit(self, statevalue: Any, interval: int | None = None):
def device_info(self):
"""Implementing this creates an entry in the device registry."""
return {
"identifiers": {(DOMAIN, "BERMUDA_GLOBAL")},
"name": "Bermuda Global",
"identifiers": {(DOMAIN, "PERMUDA_GLOBAL")},
"name": "Permuda Global",
}
4 changes: 2 additions & 2 deletions custom_components/bermuda/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"domain": "bermuda",
"name": "Bermuda BLE Trilateration",
"domain": "permuda",
"name": "Permuda BLE Mapping",
"bluetooth": [
{
"connectable": false,
Expand Down
16 changes: 8 additions & 8 deletions custom_components/bermuda/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def device_new(address: str, scanners: list[str]) -> None:


class BermudaSensor(BermudaEntity, SensorEntity):
"""bermuda Sensor class."""
"""permuda Sensor class."""

@property
def unique_id(self):
Expand Down Expand Up @@ -130,7 +130,7 @@ def entity_registry_enabled_default(self) -> bool:
def device_class(self):
"""Return de device class of the sensor."""
# There isn't one for "Area Names" so we'll arbitrarily define our own.
return "bermuda__custom_device_class"
return "permuda__custom_device_class"

@property
def extra_state_attributes(self) -> Mapping[str, Any] | None:
Expand Down Expand Up @@ -320,7 +320,7 @@ def native_value(self):


class BermudaGlobalSensor(BermudaGlobalEntity, SensorEntity):
"""bermuda Global Sensor class."""
"""permuda Global Sensor class."""

_attr_has_entity_name = True

Expand All @@ -332,7 +332,7 @@ def name(self):
@property
def device_class(self):
"""Return de device class of the sensor."""
return "bermuda__custom_device_class"
return "permuda__custom_device_class"


class BermudaTotalProxyCount(BermudaGlobalSensor):
Expand All @@ -346,7 +346,7 @@ def unique_id(self):
"Uniquely identify this sensor so that it gets stored in the entity_registry,
and can be maintained / renamed etc by the user.
"""
return "BERMUDA_GLOBAL_PROXY_COUNT"
return "PERMUDA_GLOBAL_PROXY_COUNT"

@property
def native_value(self) -> int:
Expand All @@ -370,7 +370,7 @@ def unique_id(self):
"Uniquely identify this sensor so that it gets stored in the entity_registry,
and can be maintained / renamed etc by the user.
"""
return "BERMUDA_GLOBAL_ACTIVE_PROXY_COUNT"
return "PERMUDA_GLOBAL_ACTIVE_PROXY_COUNT"

@property
def native_value(self) -> int:
Expand All @@ -394,7 +394,7 @@ def unique_id(self):
"Uniquely identify this sensor so that it gets stored in the entity_registry,
and can be maintained / renamed etc by the user.
"""
return "BERMUDA_GLOBAL_DEVICE_COUNT"
return "PERMUDA_GLOBAL_DEVICE_COUNT"

@property
def native_value(self) -> int:
Expand All @@ -418,7 +418,7 @@ def unique_id(self):
"Uniquely identify this sensor so that it gets stored in the entity_registry,
and can be maintained / renamed etc by the user.
"""
return "BERMUDA_GLOBAL_VISIBLE_DEVICE_COUNT"
return "PERMUDA_GLOBAL_VISIBLE_DEVICE_COUNT"

@property
def native_value(self) -> int:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/bermuda/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async def async_setup_entry(hass, entry, async_add_devices):


class BermudaBinarySwitch(BermudaEntity, SwitchEntity):
"""bermuda switch class."""
"""permuda switch class."""

async def async_turn_on(self, **kwargs): # pylint: disable=unused-argument
"""Turn on the switch."""
Expand Down
4 changes: 2 additions & 2 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "Bermuda BLE Trilateration",
"name": "Permuda BLE Mapping",
"hacs": "1.6.0",
"homeassistant": "2024.6",
"render_readme": true,
"zip_release": true,
"filename": "bermuda.zip",
"filename": "permuda.zip",
"hide_default_branch": true
}

0 comments on commit acb6f6b

Please sign in to comment.