mirror of
https://github.com/gangoke/kobrax-lan-hass-component.git
synced 2026-06-10 05:02:12 +02:00
All entites working - Moved all existing functionality from custom_components/kobrax to custom_components/kobrax_lan. - Updated manifest, const, and configuration flow to reflect the new component structure. - Reimplemented API client, coordinator, entity, and platform files under the new component. - Added support for image entities and binary sensors. - Ensured compatibility with Home Assistant's latest standards and practices.
26 lines
877 B
Python
26 lines
877 B
Python
from __future__ import annotations
|
|
|
|
from homeassistant.helpers.device_registry import DeviceInfo
|
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
|
|
|
from .const import DOMAIN, MANUFACTURER
|
|
|
|
|
|
class KobraXEntity(CoordinatorEntity):
|
|
def __init__(self, coordinator, entry, key: str, name: str) -> None:
|
|
super().__init__(coordinator)
|
|
self._entry = entry
|
|
self._attr_unique_id = f"{entry.entry_id}_{key}"
|
|
self._attr_name = f"{entry.data['printer_name']} {name}"
|
|
self._attr_device_info = DeviceInfo(
|
|
identifiers={(DOMAIN, entry.entry_id)},
|
|
manufacturer=MANUFACTURER,
|
|
model="Kobra X",
|
|
name=entry.data["printer_name"],
|
|
configuration_url=entry.data.get("host"),
|
|
)
|
|
|
|
@property
|
|
def state_data(self) -> dict:
|
|
return self.coordinator.data or {}
|