mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Restricted temperature units for Celsius and Fahrenheit to the standardized units (#22108)
This commit is contained in:
parent
7807b40925
commit
0466e43478
@ -1,6 +1,9 @@
|
||||
# coding: utf-8
|
||||
"""Constants for the LCN component."""
|
||||
import re
|
||||
|
||||
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||
|
||||
DOMAIN = 'lcn'
|
||||
DATA_LCN = 'lcn'
|
||||
DEFAULT_NAME = 'pchk'
|
||||
@ -49,9 +52,9 @@ THRESHOLDS = ['THRS1', 'THRS2', 'THRS3', 'THRS4', 'THRS5',
|
||||
S0_INPUTS = ['S0INPUT1', 'S0INPUT2', 'S0INPUT3', 'S0INPUT4']
|
||||
|
||||
VAR_UNITS = ['', 'LCN', 'NATIVE',
|
||||
'CELSIUS', '\u00b0CELSIUS', '\u00b0C',
|
||||
'KELVIN', '\u00b0KELVIN', '\u00b0K',
|
||||
'FAHRENHEIT', '\u00b0FAHRENHEIT', '\u00b0F'
|
||||
TEMP_CELSIUS,
|
||||
'°K',
|
||||
TEMP_FAHRENHEIT,
|
||||
'LUX_T', 'LX_T',
|
||||
'LUX_I', 'LUX', 'LX',
|
||||
'M/S', 'METERPERSECOND',
|
||||
@ -59,4 +62,4 @@ VAR_UNITS = ['', 'LCN', 'NATIVE',
|
||||
'PPM',
|
||||
'VOLT', 'V',
|
||||
'AMPERE', 'AMP', 'A',
|
||||
'DEGREE', '\u00b0']
|
||||
'DEGREE', '°']
|
||||
|
@ -43,8 +43,8 @@ class LcnVariableSensor(LcnDevice):
|
||||
super().__init__(config, address_connection)
|
||||
|
||||
self.variable = self.pypck.lcn_defs.Var[config[CONF_SOURCE]]
|
||||
self.unit = self.pypck.lcn_defs.VarUnit[
|
||||
config[CONF_UNIT_OF_MEASUREMENT]]
|
||||
self.unit = self.pypck.lcn_defs.VarUnit.parse(
|
||||
config[CONF_UNIT_OF_MEASUREMENT])
|
||||
|
||||
self._value = None
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user