mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Add a device to the sun (#90517)
This commit is contained in:
parent
87c4659520
commit
cf628dbf23
@ -15,6 +15,8 @@ from homeassistant.components.sensor import (
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import DEGREE
|
from homeassistant.const import DEGREE
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.device_registry import DeviceEntryType
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import StateType
|
from homeassistant.helpers.typing import StateType
|
||||||
|
|
||||||
@ -126,6 +128,12 @@ class SunSensor(SensorEntity):
|
|||||||
self._attr_unique_id = f"{entry_id}-{entity_description.key}"
|
self._attr_unique_id = f"{entry_id}-{entity_description.key}"
|
||||||
self.sun = sun
|
self.sun = sun
|
||||||
|
|
||||||
|
self._attr_device_info = DeviceInfo(
|
||||||
|
name="Sun",
|
||||||
|
identifiers={(DOMAIN, entry_id)},
|
||||||
|
entry_type=DeviceEntryType.SERVICE,
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> StateType | datetime:
|
def native_value(self) -> StateType | datetime:
|
||||||
"""Return value of sensor."""
|
"""Return value of sensor."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user