Update xknx to 0.17.1 (#46974)

This commit is contained in:
Matthias Alphart 2021-02-24 01:26:17 +01:00 committed by GitHub
parent 87cbbcb014
commit d02b27a5d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 41 deletions

View file

@ -106,34 +106,34 @@ CONFIG_SCHEMA = vol.Schema(
vol.Optional(CONF_KNX_EXPOSE): vol.All(
cv.ensure_list, [ExposeSchema.SCHEMA]
),
vol.Optional(SupportedPlatforms.cover.value): vol.All(
vol.Optional(SupportedPlatforms.COVER.value): vol.All(
cv.ensure_list, [CoverSchema.SCHEMA]
),
vol.Optional(SupportedPlatforms.binary_sensor.value): vol.All(
vol.Optional(SupportedPlatforms.BINARY_SENSOR.value): vol.All(
cv.ensure_list, [BinarySensorSchema.SCHEMA]
),
vol.Optional(SupportedPlatforms.light.value): vol.All(
vol.Optional(SupportedPlatforms.LIGHT.value): vol.All(
cv.ensure_list, [LightSchema.SCHEMA]
),
vol.Optional(SupportedPlatforms.climate.value): vol.All(
vol.Optional(SupportedPlatforms.CLIMATE.value): vol.All(
cv.ensure_list, [ClimateSchema.SCHEMA]
),
vol.Optional(SupportedPlatforms.notify.value): vol.All(
vol.Optional(SupportedPlatforms.NOTIFY.value): vol.All(
cv.ensure_list, [NotifySchema.SCHEMA]
),
vol.Optional(SupportedPlatforms.switch.value): vol.All(
vol.Optional(SupportedPlatforms.SWITCH.value): vol.All(
cv.ensure_list, [SwitchSchema.SCHEMA]
),
vol.Optional(SupportedPlatforms.sensor.value): vol.All(
vol.Optional(SupportedPlatforms.SENSOR.value): vol.All(
cv.ensure_list, [SensorSchema.SCHEMA]
),
vol.Optional(SupportedPlatforms.scene.value): vol.All(
vol.Optional(SupportedPlatforms.SCENE.value): vol.All(
cv.ensure_list, [SceneSchema.SCHEMA]
),
vol.Optional(SupportedPlatforms.weather.value): vol.All(
vol.Optional(SupportedPlatforms.WEATHER.value): vol.All(
cv.ensure_list, [WeatherSchema.SCHEMA]
),
vol.Optional(SupportedPlatforms.fan.value): vol.All(
vol.Optional(SupportedPlatforms.FAN.value): vol.All(
cv.ensure_list, [FanSchema.SCHEMA]
),
}

View file

@ -26,23 +26,23 @@ CONF_RESET_AFTER = "reset_after"
class ColorTempModes(Enum):
"""Color temperature modes for config validation."""
absolute = "DPT-7.600"
relative = "DPT-5.001"
ABSOLUTE = "DPT-7.600"
RELATIVE = "DPT-5.001"
class SupportedPlatforms(Enum):
"""Supported platforms."""
binary_sensor = "binary_sensor"
climate = "climate"
cover = "cover"
fan = "fan"
light = "light"
notify = "notify"
scene = "scene"
sensor = "sensor"
switch = "switch"
weather = "weather"
BINARY_SENSOR = "binary_sensor"
CLIMATE = "climate"
COVER = "cover"
FAN = "fan"
LIGHT = "light"
NOTIFY = "notify"
SCENE = "scene"
SENSOR = "sensor"
SWITCH = "switch"
WEATHER = "weather"
# Map KNX controller modes to HA modes. This list might not be complete.

View file

@ -40,34 +40,34 @@ def create_knx_device(
config: ConfigType,
) -> XknxDevice:
"""Return the requested XKNX device."""
if platform is SupportedPlatforms.light:
if platform is SupportedPlatforms.LIGHT:
return _create_light(knx_module, config)
if platform is SupportedPlatforms.cover:
if platform is SupportedPlatforms.COVER:
return _create_cover(knx_module, config)
if platform is SupportedPlatforms.climate:
if platform is SupportedPlatforms.CLIMATE:
return _create_climate(knx_module, config)
if platform is SupportedPlatforms.switch:
if platform is SupportedPlatforms.SWITCH:
return _create_switch(knx_module, config)
if platform is SupportedPlatforms.sensor:
if platform is SupportedPlatforms.SENSOR:
return _create_sensor(knx_module, config)
if platform is SupportedPlatforms.notify:
if platform is SupportedPlatforms.NOTIFY:
return _create_notify(knx_module, config)
if platform is SupportedPlatforms.scene:
if platform is SupportedPlatforms.SCENE:
return _create_scene(knx_module, config)
if platform is SupportedPlatforms.binary_sensor:
if platform is SupportedPlatforms.BINARY_SENSOR:
return _create_binary_sensor(knx_module, config)
if platform is SupportedPlatforms.weather:
if platform is SupportedPlatforms.WEATHER:
return _create_weather(knx_module, config)
if platform is SupportedPlatforms.fan:
if platform is SupportedPlatforms.FAN:
return _create_fan(knx_module, config)
@ -121,12 +121,12 @@ def _create_light(knx_module: XKNX, config: ConfigType) -> XknxLight:
group_address_tunable_white_state = None
group_address_color_temp = None
group_address_color_temp_state = None
if config[LightSchema.CONF_COLOR_TEMP_MODE] == ColorTempModes.absolute:
if config[LightSchema.CONF_COLOR_TEMP_MODE] == ColorTempModes.ABSOLUTE:
group_address_color_temp = config.get(LightSchema.CONF_COLOR_TEMP_ADDRESS)
group_address_color_temp_state = config.get(
LightSchema.CONF_COLOR_TEMP_STATE_ADDRESS
)
elif config[LightSchema.CONF_COLOR_TEMP_MODE] == ColorTempModes.relative:
elif config[LightSchema.CONF_COLOR_TEMP_MODE] == ColorTempModes.RELATIVE:
group_address_tunable_white = config.get(LightSchema.CONF_COLOR_TEMP_ADDRESS)
group_address_tunable_white_state = config.get(
LightSchema.CONF_COLOR_TEMP_STATE_ADDRESS

View file

@ -34,14 +34,14 @@ class KNXFan(KnxEntity, FanEntity):
"""Initialize of KNX fan."""
super().__init__(device)
if self._device.mode == FanSpeedMode.Step:
if self._device.mode == FanSpeedMode.STEP:
self._step_range = (1, device.max_step)
else:
self._step_range = None
async def async_set_percentage(self, percentage: int) -> None:
"""Set the speed of the fan, as a percentage."""
if self._device.mode == FanSpeedMode.Step:
if self._device.mode == FanSpeedMode.STEP:
step = math.ceil(percentage_to_ranged_value(self._step_range, percentage))
await self._device.set_speed(step)
else:
@ -63,7 +63,7 @@ class KNXFan(KnxEntity, FanEntity):
if self._device.current_speed is None:
return None
if self._device.mode == FanSpeedMode.Step:
if self._device.mode == FanSpeedMode.STEP:
return ranged_value_to_percentage(
self._step_range, self._device.current_speed
)

View file

@ -2,7 +2,7 @@
"domain": "knx",
"name": "KNX",
"documentation": "https://www.home-assistant.io/integrations/knx",
"requirements": ["xknx==0.17.0"],
"requirements": ["xknx==0.17.1"],
"codeowners": ["@Julius2342", "@farmio", "@marvin-w"],
"quality_scale": "silver"
}

View file

@ -174,7 +174,7 @@ class LightSchema:
vol.Optional(CONF_COLOR_TEMP_STATE_ADDRESS): cv.string,
vol.Optional(
CONF_COLOR_TEMP_MODE, default=DEFAULT_COLOR_TEMP_MODE
): cv.enum(ColorTempModes),
): vol.All(vol.Upper, cv.enum(ColorTempModes)),
vol.Exclusive(CONF_RGBW_ADDRESS, "color"): cv.string,
vol.Optional(CONF_RGBW_STATE_ADDRESS): cv.string,
vol.Optional(CONF_MIN_KELVIN, default=DEFAULT_MIN_KELVIN): vol.All(
@ -256,7 +256,7 @@ class ClimateSchema:
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(
CONF_SETPOINT_SHIFT_MODE, default=DEFAULT_SETPOINT_SHIFT_MODE
): cv.enum(SetpointShiftMode),
): vol.All(vol.Upper, cv.enum(SetpointShiftMode)),
vol.Optional(
CONF_SETPOINT_SHIFT_MAX, default=DEFAULT_SETPOINT_SHIFT_MAX
): vol.All(int, vol.Range(min=0, max=32)),

View file

@ -2333,7 +2333,7 @@ xbox-webapi==2.0.8
xboxapi==2.0.1
# homeassistant.components.knx
xknx==0.17.0
xknx==0.17.1
# homeassistant.components.bluesound
# homeassistant.components.rest