mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
Added temperature (apparent) high/low, deprecated max/min (#12233)
This commit is contained in:
parent
df69680d24
commit
852ce9f990
@ -33,6 +33,11 @@ DEFAULT_LANGUAGE = 'en'
|
|||||||
|
|
||||||
DEFAULT_NAME = 'Dark Sky'
|
DEFAULT_NAME = 'Dark Sky'
|
||||||
|
|
||||||
|
DEPRECATED_SENSOR_TYPES = {'apparent_temperature_max',
|
||||||
|
'apparent_temperature_min',
|
||||||
|
'temperature_max',
|
||||||
|
'temperature_min'}
|
||||||
|
|
||||||
# Sensor types are defined like so:
|
# Sensor types are defined like so:
|
||||||
# Name, si unit, us unit, ca unit, uk unit, uk2 unit
|
# Name, si unit, us unit, ca unit, uk unit, uk2 unit
|
||||||
SENSOR_TYPES = {
|
SENSOR_TYPES = {
|
||||||
@ -90,16 +95,28 @@ SENSOR_TYPES = {
|
|||||||
'°C', '°F', '°C', '°C', '°C',
|
'°C', '°F', '°C', '°C', '°C',
|
||||||
'mdi:thermometer',
|
'mdi:thermometer',
|
||||||
['currently', 'hourly', 'daily']],
|
['currently', 'hourly', 'daily']],
|
||||||
|
'apparent_temperature_high': ["Daytime High Apparent Temperature",
|
||||||
|
'°C', '°F', '°C', '°C', '°C',
|
||||||
|
'mdi:thermometer', ['daily']],
|
||||||
'apparent_temperature_min': ['Daily Low Apparent Temperature',
|
'apparent_temperature_min': ['Daily Low Apparent Temperature',
|
||||||
'°C', '°F', '°C', '°C', '°C',
|
'°C', '°F', '°C', '°C', '°C',
|
||||||
'mdi:thermometer',
|
'mdi:thermometer',
|
||||||
['currently', 'hourly', 'daily']],
|
['currently', 'hourly', 'daily']],
|
||||||
|
'apparent_temperature_low': ['Overnight Low Apparent Temperature',
|
||||||
|
'°C', '°F', '°C', '°C', '°C',
|
||||||
|
'mdi:thermometer', ['daily']],
|
||||||
'temperature_max': ['Daily High Temperature',
|
'temperature_max': ['Daily High Temperature',
|
||||||
'°C', '°F', '°C', '°C', '°C', 'mdi:thermometer',
|
'°C', '°F', '°C', '°C', '°C', 'mdi:thermometer',
|
||||||
['currently', 'hourly', 'daily']],
|
['daily']],
|
||||||
|
'temperature_high': ['Daytime High Temperature',
|
||||||
|
'°C', '°F', '°C', '°C', '°C', 'mdi:thermometer',
|
||||||
|
['daily']],
|
||||||
'temperature_min': ['Daily Low Temperature',
|
'temperature_min': ['Daily Low Temperature',
|
||||||
'°C', '°F', '°C', '°C', '°C', 'mdi:thermometer',
|
'°C', '°F', '°C', '°C', '°C', 'mdi:thermometer',
|
||||||
['currently', 'hourly', 'daily']],
|
['daily']],
|
||||||
|
'temperature_low': ['Overnight Low Temperature',
|
||||||
|
'°C', '°F', '°C', '°C', '°C', 'mdi:thermometer',
|
||||||
|
['daily']],
|
||||||
'precip_intensity_max': ['Daily Max Precip Intensity',
|
'precip_intensity_max': ['Daily Max Precip Intensity',
|
||||||
'mm/h', 'in', 'mm/h', 'mm/h', 'mm/h',
|
'mm/h', 'in', 'mm/h', 'mm/h', 'mm/h',
|
||||||
'mdi:thermometer',
|
'mdi:thermometer',
|
||||||
@ -185,6 +202,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
forecast = config.get(CONF_FORECAST)
|
forecast = config.get(CONF_FORECAST)
|
||||||
sensors = []
|
sensors = []
|
||||||
for variable in config[CONF_MONITORED_CONDITIONS]:
|
for variable in config[CONF_MONITORED_CONDITIONS]:
|
||||||
|
if variable in DEPRECATED_SENSOR_TYPES:
|
||||||
|
_LOGGER.warning("Monitored condition %s is deprecated.",
|
||||||
|
variable)
|
||||||
sensors.append(DarkSkySensor(forecast_data, variable, name))
|
sensors.append(DarkSkySensor(forecast_data, variable, name))
|
||||||
if forecast is not None and 'daily' in SENSOR_TYPES[variable][7]:
|
if forecast is not None and 'daily' in SENSOR_TYPES[variable][7]:
|
||||||
for forecast_day in forecast:
|
for forecast_day in forecast:
|
||||||
@ -288,9 +308,13 @@ class DarkSkySensor(Entity):
|
|||||||
elif self.forecast_day > 0 or (
|
elif self.forecast_day > 0 or (
|
||||||
self.type in ['daily_summary',
|
self.type in ['daily_summary',
|
||||||
'temperature_min',
|
'temperature_min',
|
||||||
|
'temperature_low',
|
||||||
'temperature_max',
|
'temperature_max',
|
||||||
|
'temperature_high',
|
||||||
'apparent_temperature_min',
|
'apparent_temperature_min',
|
||||||
|
'apparent_temperature_low',
|
||||||
'apparent_temperature_max',
|
'apparent_temperature_max',
|
||||||
|
'apparent_temperature_high',
|
||||||
'precip_intensity_max',
|
'precip_intensity_max',
|
||||||
'precip_accumulation']):
|
'precip_accumulation']):
|
||||||
self.forecast_data.update_daily()
|
self.forecast_data.update_daily()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user