mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 10:17:51 +00:00
Add humidity to KNX climate (#128844)
This commit is contained in:
parent
94534f714c
commit
f01231277b
@ -136,6 +136,9 @@ def _create_climate(xknx: XKNX, config: ConfigType) -> XknxClimate:
|
|||||||
ClimateSchema.CONF_FAN_SPEED_STATE_ADDRESS
|
ClimateSchema.CONF_FAN_SPEED_STATE_ADDRESS
|
||||||
),
|
),
|
||||||
fan_speed_mode=config[ClimateSchema.CONF_FAN_SPEED_MODE],
|
fan_speed_mode=config[ClimateSchema.CONF_FAN_SPEED_MODE],
|
||||||
|
group_address_humidity_state=config.get(
|
||||||
|
ClimateSchema.CONF_HUMIDITY_STATE_ADDRESS
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -397,6 +400,11 @@ class KNXClimate(KnxYamlEntity, ClimateEntity):
|
|||||||
|
|
||||||
await self._device.set_fan_speed(self._fan_modes_percentages[fan_mode_index])
|
await self._device.set_fan_speed(self._fan_modes_percentages[fan_mode_index])
|
||||||
|
|
||||||
|
@property
|
||||||
|
def current_humidity(self) -> float | None:
|
||||||
|
"""Return the current humidity."""
|
||||||
|
return self._device.humidity.value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def extra_state_attributes(self) -> dict[str, Any] | None:
|
def extra_state_attributes(self) -> dict[str, Any] | None:
|
||||||
"""Return device specific state attributes."""
|
"""Return device specific state attributes."""
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"loggers": ["xknx", "xknxproject"],
|
"loggers": ["xknx", "xknxproject"],
|
||||||
"quality_scale": "platinum",
|
"quality_scale": "platinum",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"xknx==3.2.0",
|
"xknx==3.3.0",
|
||||||
"xknxproject==3.8.1",
|
"xknxproject==3.8.1",
|
||||||
"knx-frontend==2024.9.10.221729"
|
"knx-frontend==2024.9.10.221729"
|
||||||
],
|
],
|
||||||
|
@ -347,6 +347,7 @@ class ClimateSchema(KNXPlatformSchema):
|
|||||||
CONF_FAN_MAX_STEP = "fan_max_step"
|
CONF_FAN_MAX_STEP = "fan_max_step"
|
||||||
CONF_FAN_SPEED_MODE = "fan_speed_mode"
|
CONF_FAN_SPEED_MODE = "fan_speed_mode"
|
||||||
CONF_FAN_ZERO_MODE = "fan_zero_mode"
|
CONF_FAN_ZERO_MODE = "fan_zero_mode"
|
||||||
|
CONF_HUMIDITY_STATE_ADDRESS = "humidity_state_address"
|
||||||
|
|
||||||
DEFAULT_NAME = "KNX Climate"
|
DEFAULT_NAME = "KNX Climate"
|
||||||
DEFAULT_SETPOINT_SHIFT_MODE = "DPT6010"
|
DEFAULT_SETPOINT_SHIFT_MODE = "DPT6010"
|
||||||
@ -439,6 +440,7 @@ class ClimateSchema(KNXPlatformSchema):
|
|||||||
vol.Optional(CONF_FAN_ZERO_MODE, default=FAN_OFF): vol.Coerce(
|
vol.Optional(CONF_FAN_ZERO_MODE, default=FAN_OFF): vol.Coerce(
|
||||||
FanZeroMode
|
FanZeroMode
|
||||||
),
|
),
|
||||||
|
vol.Optional(CONF_HUMIDITY_STATE_ADDRESS): ga_list_validator,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -2995,7 +2995,7 @@ xbox-webapi==2.0.11
|
|||||||
xiaomi-ble==0.32.0
|
xiaomi-ble==0.32.0
|
||||||
|
|
||||||
# homeassistant.components.knx
|
# homeassistant.components.knx
|
||||||
xknx==3.2.0
|
xknx==3.3.0
|
||||||
|
|
||||||
# homeassistant.components.knx
|
# homeassistant.components.knx
|
||||||
xknxproject==3.8.1
|
xknxproject==3.8.1
|
||||||
|
@ -2381,7 +2381,7 @@ xbox-webapi==2.0.11
|
|||||||
xiaomi-ble==0.32.0
|
xiaomi-ble==0.32.0
|
||||||
|
|
||||||
# homeassistant.components.knx
|
# homeassistant.components.knx
|
||||||
xknx==3.2.0
|
xknx==3.3.0
|
||||||
|
|
||||||
# homeassistant.components.knx
|
# homeassistant.components.knx
|
||||||
xknxproject==3.8.1
|
xknxproject==3.8.1
|
||||||
|
@ -819,3 +819,34 @@ async def test_fan_speed_zero_mode_auto(hass: HomeAssistant, knx: KNXTestKit) ->
|
|||||||
)
|
)
|
||||||
await knx.assert_write("1/2/6", (0x0,))
|
await knx.assert_write("1/2/6", (0x0,))
|
||||||
knx.assert_state("climate.test", HVACMode.HEAT, fan_mode="auto")
|
knx.assert_state("climate.test", HVACMode.HEAT, fan_mode="auto")
|
||||||
|
|
||||||
|
|
||||||
|
async def test_climate_humidity(hass: HomeAssistant, knx: KNXTestKit) -> None:
|
||||||
|
"""Test KNX climate humidity."""
|
||||||
|
await knx.setup_integration(
|
||||||
|
{
|
||||||
|
ClimateSchema.PLATFORM: {
|
||||||
|
CONF_NAME: "test",
|
||||||
|
ClimateSchema.CONF_TEMPERATURE_ADDRESS: "1/2/3",
|
||||||
|
ClimateSchema.CONF_TARGET_TEMPERATURE_STATE_ADDRESS: "1/2/5",
|
||||||
|
ClimateSchema.CONF_HUMIDITY_STATE_ADDRESS: "1/2/16",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# read states state updater
|
||||||
|
await knx.assert_read("1/2/3")
|
||||||
|
await knx.assert_read("1/2/5")
|
||||||
|
|
||||||
|
# StateUpdater initialize state
|
||||||
|
await knx.receive_response("1/2/5", RAW_FLOAT_22_0)
|
||||||
|
await knx.receive_response("1/2/3", RAW_FLOAT_21_0)
|
||||||
|
|
||||||
|
# Query status
|
||||||
|
await knx.assert_read("1/2/16")
|
||||||
|
await knx.receive_response("1/2/16", (0x14, 0x74))
|
||||||
|
knx.assert_state(
|
||||||
|
"climate.test",
|
||||||
|
HVACMode.HEAT,
|
||||||
|
current_humidity=45.6,
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user