[ci skip] home assistant integration

This commit is contained in:
2026-02-19 14:34:58 +11:00
parent 7d0ce52c27
commit d72e88ab7b
15 changed files with 1397 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
"""Shared entity base for Victron MK2 MQTT."""
from __future__ import annotations
from homeassistant.helpers.entity import Entity
from .coordinator import VictronMqttBridge
class VictronMqttEntity(Entity):
"""Base entity bound to shared MQTT bridge."""
_attr_should_poll = False
_attr_has_entity_name = True
def __init__(self, bridge: VictronMqttBridge) -> None:
self.bridge = bridge
@property
def device_info(self):
"""Return the shared device info."""
return self.bridge.device_info
async def async_added_to_hass(self) -> None:
"""Register for coordinator updates."""
self.async_on_remove(self.bridge.async_add_listener(self._handle_bridge_update))
def _handle_bridge_update(self) -> None:
self.async_write_ha_state()