Compare commits
4 commits
dev
...
edenhaus-s
Author | SHA1 | Date | |
---|---|---|---|
|
8158da573a | ||
|
983f97fdb3 | ||
|
1ee4f0fb58 | ||
|
190d8aef0a |
3 changed files with 55 additions and 9 deletions
|
@ -34,7 +34,7 @@ from homeassistant.const import (
|
||||||
CONF_VERIFY_SSL,
|
CONF_VERIFY_SSL,
|
||||||
HTTP_BASIC_AUTHENTICATION,
|
HTTP_BASIC_AUTHENTICATION,
|
||||||
HTTP_DIGEST_AUTHENTICATION,
|
HTTP_DIGEST_AUTHENTICATION,
|
||||||
UnitOfTemperature,
|
UNITS_OF_MEASUREMENT,
|
||||||
)
|
)
|
||||||
from homeassistant.core import async_get_hass
|
from homeassistant.core import async_get_hass
|
||||||
from homeassistant.helpers import config_validation as cv, entity_registry as er
|
from homeassistant.helpers import config_validation as cv, entity_registry as er
|
||||||
|
@ -124,11 +124,10 @@ SENSOR_SETUP = {
|
||||||
),
|
),
|
||||||
vol.Optional(CONF_UNIT_OF_MEASUREMENT): SelectSelector(
|
vol.Optional(CONF_UNIT_OF_MEASUREMENT): SelectSelector(
|
||||||
SelectSelectorConfig(
|
SelectSelectorConfig(
|
||||||
options=[cls.value for cls in UnitOfTemperature],
|
options=sorted(UNITS_OF_MEASUREMENT),
|
||||||
custom_value=True,
|
custom_value=True,
|
||||||
mode=SelectSelectorMode.DROPDOWN,
|
mode=SelectSelectorMode.DROPDOWN,
|
||||||
translation_key="unit_of_measurement",
|
translation_key="unit_of_measurement",
|
||||||
sort=True,
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
"value_template": "Defines a template to get the state of the sensor",
|
"value_template": "Defines a template to get the state of the sensor",
|
||||||
"device_class": "The type/class of the sensor to set the icon in the frontend",
|
"device_class": "The type/class of the sensor to set the icon in the frontend",
|
||||||
"state_class": "The state_class of the sensor",
|
"state_class": "The state_class of the sensor",
|
||||||
"unit_of_measurement": "Choose temperature measurement or create your own"
|
"unit_of_measurement": "Choose a unit of measurement or create your own"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,11 +190,6 @@
|
||||||
"total": "[%key:component::sensor::entity_component::_::state_attributes::state_class::state::total%]",
|
"total": "[%key:component::sensor::entity_component::_::state_attributes::state_class::state::total%]",
|
||||||
"total_increasing": "[%key:component::sensor::entity_component::_::state_attributes::state_class::state::total_increasing%]"
|
"total_increasing": "[%key:component::sensor::entity_component::_::state_attributes::state_class::state::total_increasing%]"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"unit_of_measurement": {
|
|
||||||
"options": {
|
|
||||||
"none": "No unit of measurement"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1051,6 +1051,58 @@ DATA_RATE_GIBIBYTES_PER_SECOND: Final = "GiB/s"
|
||||||
"""Deprecated: please use UnitOfDataRate.GIBIBYTES_PER_SECOND"""
|
"""Deprecated: please use UnitOfDataRate.GIBIBYTES_PER_SECOND"""
|
||||||
|
|
||||||
|
|
||||||
|
UNITS_OF_MEASUREMENT: Final[frozenset[str]] = frozenset(
|
||||||
|
{
|
||||||
|
unit
|
||||||
|
for unit_type in (
|
||||||
|
UnitOfApparentPower,
|
||||||
|
UnitOfPower,
|
||||||
|
UnitOfEnergy,
|
||||||
|
UnitOfElectricCurrent,
|
||||||
|
UnitOfElectricPotential,
|
||||||
|
UnitOfTemperature,
|
||||||
|
UnitOfTime,
|
||||||
|
UnitOfLength,
|
||||||
|
UnitOfFrequency,
|
||||||
|
UnitOfPressure,
|
||||||
|
UnitOfSoundPressure,
|
||||||
|
UnitOfVolume,
|
||||||
|
UnitOfVolumeFlowRate,
|
||||||
|
UnitOfMass,
|
||||||
|
UnitOfIrradiance,
|
||||||
|
UnitOfVolumetricFlux,
|
||||||
|
UnitOfPrecipitationDepth,
|
||||||
|
UnitOfSpeed,
|
||||||
|
UnitOfInformation,
|
||||||
|
UnitOfDataRate,
|
||||||
|
)
|
||||||
|
for unit in unit_type
|
||||||
|
}
|
||||||
|
).union(
|
||||||
|
{
|
||||||
|
POWER_VOLT_AMPERE_REACTIVE,
|
||||||
|
DEGREE,
|
||||||
|
CURRENCY_EURO,
|
||||||
|
CURRENCY_DOLLAR,
|
||||||
|
CURRENCY_CENT,
|
||||||
|
AREA_SQUARE_METERS,
|
||||||
|
CONDUCTIVITY,
|
||||||
|
LIGHT_LUX,
|
||||||
|
UV_INDEX,
|
||||||
|
PERCENTAGE,
|
||||||
|
REVOLUTIONS_PER_MINUTE,
|
||||||
|
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
|
CONCENTRATION_MILLIGRAMS_PER_CUBIC_METER,
|
||||||
|
CONCENTRATION_MICROGRAMS_PER_CUBIC_FOOT,
|
||||||
|
CONCENTRATION_PARTS_PER_CUBIC_METER,
|
||||||
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
|
CONCENTRATION_PARTS_PER_BILLION,
|
||||||
|
SIGNAL_STRENGTH_DECIBELS,
|
||||||
|
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# States
|
# States
|
||||||
COMPRESSED_STATE_STATE = "s"
|
COMPRESSED_STATE_STATE = "s"
|
||||||
COMPRESSED_STATE_ATTRIBUTES = "a"
|
COMPRESSED_STATE_ATTRIBUTES = "a"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue