Add OSO Energy temperature sensors (#119301)

This commit is contained in:
osohotwateriot 2024-06-10 21:48:41 +03:00 committed by GitHub
parent 8d3e3faf02
commit 53d5a65f2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 46 additions and 1 deletions

View File

@ -13,7 +13,12 @@ from homeassistant.components.sensor import (
SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import UnitOfEnergy, UnitOfPower, UnitOfVolume
from homeassistant.const import (
UnitOfEnergy,
UnitOfPower,
UnitOfTemperature,
UnitOfVolume,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType
@ -101,6 +106,34 @@ SENSOR_TYPES: dict[str, OSOEnergySensorEntityDescription] = {
native_unit_of_measurement=UnitOfVolume.LITERS,
value_fn=lambda entity_data: entity_data.state,
),
"temperature_top": OSOEnergySensorEntityDescription(
key="temperature_top",
translation_key="temperature_top",
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_fn=lambda entity_data: entity_data.state,
),
"temperature_mid": OSOEnergySensorEntityDescription(
key="temperature_mid",
translation_key="temperature_mid",
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_fn=lambda entity_data: entity_data.state,
),
"temperature_low": OSOEnergySensorEntityDescription(
key="temperature_low",
translation_key="temperature_low",
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_fn=lambda entity_data: entity_data.state,
),
"temperature_one": OSOEnergySensorEntityDescription(
key="temperature_one",
translation_key="temperature_one",
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_fn=lambda entity_data: entity_data.state,
),
}

View File

@ -77,6 +77,18 @@
},
"profile": {
"name": "Profile local"
},
"temperature_top": {
"name": "Temperature top"
},
"temperature_mid": {
"name": "Temperature middle"
},
"temperature_low": {
"name": "Temperature bottom"
},
"temperature_one": {
"name": "Temperature one"
}
}
}