chore(tools): qconnex-Migrationswerkzeug und HA-Integration ins Repo
qconnex-listen/ (OTA-Falle: AP + DHCP + Range-Server, Onboarding-Client) und ha-integration/ (Home-Assistant-custom_component ninlight) waren seit der Erfindung nur auf diesem Rechner. Bilder, Request-Log, hostapd-Log und PIDs ueber .gitignore draussen - die Images sind generierbar, sobald die Signierschluessel erreichbar sind. otaserve.py bildet jetzt auch die Montana-Black-Produkt-ID auf ledshield_rgb ab.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""Base entity for Ninlight devices."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import DEFAULT_PORT, DOMAIN
|
||||
from .coordinator import NinlightCoordinator, NinlightConfigEntry
|
||||
|
||||
|
||||
class NinlightEntity(CoordinatorEntity[NinlightCoordinator]):
|
||||
"""Common device info for every entity of one bulb."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(self, coordinator: NinlightCoordinator, entry: NinlightConfigEntry) -> None:
|
||||
super().__init__(coordinator, context=entry.entry_id)
|
||||
mac = (entry.unique_id or "unknown").lower()
|
||||
info = coordinator.info or {}
|
||||
# Deliberately no `connections={("mac", mac)}`: HA treats a MAC in `connections`
|
||||
# as a network-topology link, so a bulb the FRITZ!Box tracker already knows merged
|
||||
# into that router-adjacent device and its entity id fell back to the IP. The MAC
|
||||
# still identifies the device via unique_id; identifiers are the sole identity here.
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, mac)},
|
||||
# The bulb itself has no user-visible name field that survives rediscovery
|
||||
# cleanly, so the entry title (set from mDNS or by the user) names the device.
|
||||
name=entry.title,
|
||||
manufacturer="Klyqa",
|
||||
model=info.get("product_name") or info.get("product"),
|
||||
model_id=info.get("device_type"),
|
||||
sw_version=info.get("fw_version"),
|
||||
configuration_url=f"http://{entry.data['host']}:{entry.data.get('port', DEFAULT_PORT)}/",
|
||||
)
|
||||
|
||||
|
||||
def _entry_mac(entry: NinlightConfigEntry) -> str:
|
||||
mac: str = entry.unique_id or "unknown"
|
||||
return mac.lower()
|
||||
Reference in New Issue
Block a user