mirror of
https://github.com/natekspencer/hacs-oasis_mini.git
synced 2025-12-06 18:44:14 -05:00
Add an additional last updated diagnostic sensor for devices
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
SensorEntityDescription,
|
||||
SensorStateClass,
|
||||
@@ -68,6 +71,13 @@ DESCRIPTORS = [
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
suggested_display_precision=1,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="last_updated",
|
||||
translation_key="last_updated",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
entity_registry_enabled_default=False,
|
||||
),
|
||||
]
|
||||
DESCRIPTORS.extend(
|
||||
SensorEntityDescription(
|
||||
@@ -84,7 +94,7 @@ class OasisDeviceSensorEntity(OasisDeviceEntity, SensorEntity):
|
||||
"""Oasis device sensor entity."""
|
||||
|
||||
@property
|
||||
def native_value(self) -> str | None:
|
||||
def native_value(self) -> str | int | float | datetime | None:
|
||||
"""
|
||||
Provide the current sensor value from the underlying device.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user