Revert "Use percentage constant in components (#80173)"
This reverts commit 3a5b66fd60
.
This commit is contained in:
parent
3a5b66fd60
commit
faf448036c
3 changed files with 4 additions and 6 deletions
|
@ -20,7 +20,7 @@ from homeassistant.components.sensor import (
|
|||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CURRENCY_DOLLAR, ENERGY_KILO_WATT_HOUR, PERCENTAGE
|
||||
from homeassistant.const import CURRENCY_DOLLAR, ENERGY_KILO_WATT_HOUR
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
@ -247,7 +247,7 @@ async def async_setup_entry(
|
|||
renewables_description = SensorEntityDescription(
|
||||
key="renewables",
|
||||
name=f"{entry.title} - Renewables",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
native_unit_of_measurement="%",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
icon="mdi:solar-power",
|
||||
)
|
||||
|
|
|
@ -16,7 +16,6 @@ from homeassistant.components.sensor import (
|
|||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import PERCENTAGE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import StateType
|
||||
|
@ -115,7 +114,7 @@ async def async_setup_entry(
|
|||
name="Outdoor Humidity",
|
||||
device_class=SensorDeviceClass.HUMIDITY,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
native_unit_of_measurement="%",
|
||||
value=lambda device: device.displayedOutdoorHumidity,
|
||||
),
|
||||
location,
|
||||
|
|
|
@ -25,7 +25,6 @@ from homeassistant.const import (
|
|||
CONF_ENTITY_ID,
|
||||
CONF_NAME,
|
||||
CONF_UNIQUE_ID,
|
||||
PERCENTAGE,
|
||||
STATE_UNAVAILABLE,
|
||||
STATE_UNKNOWN,
|
||||
)
|
||||
|
@ -378,7 +377,7 @@ class StatisticsSensor(SensorEntity):
|
|||
base_unit: str | None = new_state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
||||
unit: str | None
|
||||
if self.is_binary and self._state_characteristic in STAT_BINARY_PERCENTAGE:
|
||||
unit = PERCENTAGE
|
||||
unit = "%"
|
||||
elif not base_unit:
|
||||
unit = None
|
||||
elif self._state_characteristic in STAT_NUMERIC_RETAIN_UNIT:
|
||||
|
|
Loading…
Add table
Reference in a new issue