init home-assistant

This commit is contained in:
2026-11-19 15:15:32 -05:00
parent 2e81d9d300
commit feec6ef9fb
19230 changed files with 3335526 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
"""Support for monitoring the state of UpCloud servers."""
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DATA_UPCLOUD
from .entity import UpCloudServerEntity
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the UpCloud server binary sensor."""
coordinator = hass.data[DATA_UPCLOUD].coordinators[config_entry.data[CONF_USERNAME]]
entities = [UpCloudBinarySensor(coordinator, uuid) for uuid in coordinator.data]
async_add_entities(entities, True)
class UpCloudBinarySensor(UpCloudServerEntity, BinarySensorEntity):
"""Representation of an UpCloud server sensor."""
_attr_device_class = BinarySensorDeviceClass.POWER