added more models
This commit is contained in:
1 parent
84ef34d01d
commit
1b34ac7f45
3 files changed
+24
-1
No files matched your search
@@ -37,6 +37,7 @@ def device_info(entry: ConfigEntry) -> DeviceInfo:
|
|||||||
identifiers={(DOMAIN, entry.data.get(CONF_ADDRESS))},
|
identifiers={(DOMAIN, entry.data.get(CONF_ADDRESS))},
|
||||||
name=entry.title,
|
name=entry.title,
|
||||||
manufacturer=MANUFACTURER,
|
manufacturer=MANUFACTURER,
|
||||||
|
model=get_type_by_bt_name(entry.title),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -46,3 +47,23 @@ def get_unique_id(name: str, sensor_type: str | None = None):
|
|||||||
if sensor_type is not None:
|
if sensor_type is not None:
|
||||||
return f"{sensor_type}.{res}"
|
return f"{sensor_type}.{res}"
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
def get_type_by_bt_name(bt_name: str):
|
||||||
|
"""Get the device type."""
|
||||||
|
dev_type = "Unknown"
|
||||||
|
if bt_name.startswith("AC200M"):
|
||||||
|
dev_type = "AC200M"
|
||||||
|
elif bt_name.startswith("AC300"):
|
||||||
|
dev_type = "AC300"
|
||||||
|
elif bt_name.startswith("AC500"):
|
||||||
|
dev_type = "AC500"
|
||||||
|
elif bt_name.startswith("AC60"):
|
||||||
|
dev_type = "AC60"
|
||||||
|
elif bt_name.startswith("EB3A"):
|
||||||
|
dev_type = "EB3A"
|
||||||
|
elif bt_name.startswith("EP500"):
|
||||||
|
dev_type = "EP500"
|
||||||
|
elif bt_name.startswith("EP600"):
|
||||||
|
dev_type = "EP600"
|
||||||
|
return dev_type
|
||||||
@@ -4,6 +4,8 @@
|
|||||||
"bluetooth": [
|
"bluetooth": [
|
||||||
{ "local_name": "AC200M*" },
|
{ "local_name": "AC200M*" },
|
||||||
{ "local_name": "AC300*" },
|
{ "local_name": "AC300*" },
|
||||||
|
{ "local_name": "AC500*" },
|
||||||
|
{ "local_name": "AC60*" },
|
||||||
{ "local_name": "EB3A*" },
|
{ "local_name": "EB3A*" },
|
||||||
{ "local_name": "EP500*" },
|
{ "local_name": "EP500*" },
|
||||||
{ "local_name": "EP600*" }
|
{ "local_name": "EP600*" }
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ async def async_setup_entry(
|
|||||||
# Generate device info
|
# Generate device info
|
||||||
_LOGGER.error("Creating sensors for device %s", entry.data.get(CONF_ADDRESS))
|
_LOGGER.error("Creating sensors for device %s", entry.data.get(CONF_ADDRESS))
|
||||||
device_info = dev_info(entry)
|
device_info = dev_info(entry)
|
||||||
async_add_entities(Battery(coordinator, device_info))
|
async_add_entities([Battery(coordinator, device_info)])
|
||||||
|
|
||||||
|
|
||||||
class PollingCoordinator(DataUpdateCoordinator):
|
class PollingCoordinator(DataUpdateCoordinator):
|
||||||
|
|||||||
Reference in new issue
Block a user