This commit is contained in:
Paulus Schoutsen 2023-03-09 14:40:06 -05:00 committed by GitHub
commit ddde17606d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 50 additions and 22 deletions

View File

@ -45,9 +45,10 @@ BINARY_SENSOR_DESCRIPTIONS = (
), ),
DormakabaDkeyBinarySensorDescription( DormakabaDkeyBinarySensorDescription(
key="security_locked", key="security_locked",
name="Dead bolt", name="Deadbolt",
device_class=BinarySensorDeviceClass.LOCK, device_class=BinarySensorDeviceClass.LOCK,
is_on=lambda state: state.unlock_status != UnlockStatus.SECURITY_LOCKED, is_on=lambda state: state.unlock_status
not in (UnlockStatus.SECURITY_LOCKED, UnlockStatus.UNLOCKED_SECURITY_LOCKED),
), ),
) )

View File

@ -20,5 +20,5 @@
"documentation": "https://www.home-assistant.io/integrations/frontend", "documentation": "https://www.home-assistant.io/integrations/frontend",
"integration_type": "system", "integration_type": "system",
"quality_scale": "internal", "quality_scale": "internal",
"requirements": ["home-assistant-frontend==20230306.0"] "requirements": ["home-assistant-frontend==20230309.0"]
} }

View File

@ -53,7 +53,7 @@ PATHS_NOT_ONBOARDED = re.compile(
r")$" r")$"
) )
# Authenticated users manage backups + download logs # Authenticated users manage backups + download logs, changelog and documentation
PATHS_ADMIN = re.compile( PATHS_ADMIN = re.compile(
r"^(?:" r"^(?:"
r"|backups/[a-f0-9]{8}(/info|/download|/restore/full|/restore/partial)?" r"|backups/[a-f0-9]{8}(/info|/download|/restore/full|/restore/partial)?"
@ -66,7 +66,7 @@ PATHS_ADMIN = re.compile(
r"|multicast/logs" r"|multicast/logs"
r"|observer/logs" r"|observer/logs"
r"|supervisor/logs" r"|supervisor/logs"
r"|addons/[^/]+/logs" r"|addons/[^/]+/(changelog|documentation|logs)"
r")$" r")$"
) )

View File

@ -7,5 +7,5 @@
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"loggers": ["pymazda"], "loggers": ["pymazda"],
"quality_scale": "platinum", "quality_scale": "platinum",
"requirements": ["pymazda==0.3.7"] "requirements": ["pymazda==0.3.8"]
} }

View File

@ -495,8 +495,12 @@ class MqttLight(MqttEntity, LightEntity, RestoreEntity):
self._attr_color_mode = color_mode self._attr_color_mode = color_mode
if self._topic[CONF_BRIGHTNESS_STATE_TOPIC] is None: if self._topic[CONF_BRIGHTNESS_STATE_TOPIC] is None:
rgb = convert_color(*color) rgb = convert_color(*color)
percent_bright = float(color_util.color_RGB_to_hsv(*rgb)[2]) / 100.0 brightness = max(rgb)
self._attr_brightness = min(round(percent_bright * 255), 255) self._attr_brightness = brightness
# Normalize the color to 100% brightness
color = tuple(
min(round(channel / brightness * 255), 255) for channel in color
)
return color return color
@callback @callback

View File

@ -281,7 +281,7 @@ class MqttSensor(MqttEntity, RestoreSensor):
else: else:
self._attr_native_value = new_value self._attr_native_value = new_value
return return
if self.device_class is None: if self.device_class in {None, SensorDeviceClass.ENUM}:
self._attr_native_value = new_value self._attr_native_value = new_value
return return
if (payload_datetime := dt_util.parse_datetime(new_value)) is None: if (payload_datetime := dt_util.parse_datetime(new_value)) is None:

View File

@ -24,5 +24,5 @@
"documentation": "https://www.home-assistant.io/integrations/roomba", "documentation": "https://www.home-assistant.io/integrations/roomba",
"iot_class": "local_push", "iot_class": "local_push",
"loggers": ["paho_mqtt", "roombapy"], "loggers": ["paho_mqtt", "roombapy"],
"requirements": ["roombapy==1.6.5"] "requirements": ["roombapy==1.6.6"]
} }

View File

@ -8,7 +8,7 @@ from .backports.enum import StrEnum
APPLICATION_NAME: Final = "HomeAssistant" APPLICATION_NAME: Final = "HomeAssistant"
MAJOR_VERSION: Final = 2023 MAJOR_VERSION: Final = 2023
MINOR_VERSION: Final = 3 MINOR_VERSION: Final = 3
PATCH_VERSION: Final = "2" PATCH_VERSION: Final = "3"
__short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}" __short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__: Final = f"{__short_version__}.{PATCH_VERSION}" __version__: Final = f"{__short_version__}.{PATCH_VERSION}"
REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 10, 0) REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 10, 0)

View File

@ -23,7 +23,7 @@ fnvhash==0.1.0
hass-nabucasa==0.61.0 hass-nabucasa==0.61.0
hassil==1.0.6 hassil==1.0.6
home-assistant-bluetooth==1.9.3 home-assistant-bluetooth==1.9.3
home-assistant-frontend==20230306.0 home-assistant-frontend==20230309.0
home-assistant-intents==2023.2.28 home-assistant-intents==2023.2.28
httpx==0.23.3 httpx==0.23.3
ifaddr==0.1.7 ifaddr==0.1.7

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "homeassistant" name = "homeassistant"
version = "2023.3.2" version = "2023.3.3"
license = {text = "Apache-2.0"} license = {text = "Apache-2.0"}
description = "Open-source home automation platform running on Python 3." description = "Open-source home automation platform running on Python 3."
readme = "README.rst" readme = "README.rst"

View File

@ -907,7 +907,7 @@ hole==0.8.0
holidays==0.18.0 holidays==0.18.0
# homeassistant.components.frontend # homeassistant.components.frontend
home-assistant-frontend==20230306.0 home-assistant-frontend==20230309.0
# homeassistant.components.conversation # homeassistant.components.conversation
home-assistant-intents==2023.2.28 home-assistant-intents==2023.2.28
@ -1771,7 +1771,7 @@ pymailgunner==1.4
pymata-express==1.19 pymata-express==1.19
# homeassistant.components.mazda # homeassistant.components.mazda
pymazda==0.3.7 pymazda==0.3.8
# homeassistant.components.mediaroom # homeassistant.components.mediaroom
pymediaroom==0.6.5.4 pymediaroom==0.6.5.4
@ -2264,7 +2264,7 @@ rocketchat-API==0.6.1
rokuecp==0.17.1 rokuecp==0.17.1
# homeassistant.components.roomba # homeassistant.components.roomba
roombapy==1.6.5 roombapy==1.6.6
# homeassistant.components.roon # homeassistant.components.roon
roonapi==0.1.3 roonapi==0.1.3

View File

@ -690,7 +690,7 @@ hole==0.8.0
holidays==0.18.0 holidays==0.18.0
# homeassistant.components.frontend # homeassistant.components.frontend
home-assistant-frontend==20230306.0 home-assistant-frontend==20230309.0
# homeassistant.components.conversation # homeassistant.components.conversation
home-assistant-intents==2023.2.28 home-assistant-intents==2023.2.28
@ -1275,7 +1275,7 @@ pymailgunner==1.4
pymata-express==1.19 pymata-express==1.19
# homeassistant.components.mazda # homeassistant.components.mazda
pymazda==0.3.7 pymazda==0.3.8
# homeassistant.components.melcloud # homeassistant.components.melcloud
pymelcloud==2.5.8 pymelcloud==2.5.8
@ -1600,7 +1600,7 @@ ring_doorbell==0.7.2
rokuecp==0.17.1 rokuecp==0.17.1
# homeassistant.components.roomba # homeassistant.components.roomba
roombapy==1.6.5 roombapy==1.6.6
# homeassistant.components.roon # homeassistant.components.roon
roonapi==0.1.3 roonapi==0.1.3

View File

@ -288,6 +288,8 @@ async def test_forward_request_not_onboarded_unallowed_paths(
("backups/1234abcd/info", True), ("backups/1234abcd/info", True),
("supervisor/logs", True), ("supervisor/logs", True),
("addons/bl_b392/logs", True), ("addons/bl_b392/logs", True),
("addons/bl_b392/changelog", True),
("addons/bl_b392/documentation", True),
], ],
) )
async def test_forward_request_admin_get( async def test_forward_request_admin_get(

View File

@ -636,8 +636,8 @@ async def test_brightness_from_rgb_controlling_scale(
} }
}, },
) )
mqtt_mock = await mqtt_mock_entry_with_yaml_config()
await hass.async_block_till_done() await hass.async_block_till_done()
await mqtt_mock_entry_with_yaml_config()
state = hass.states.get("light.test") state = hass.states.get("light.test")
assert state.state == STATE_UNKNOWN assert state.state == STATE_UNKNOWN
@ -650,10 +650,29 @@ async def test_brightness_from_rgb_controlling_scale(
state = hass.states.get("light.test") state = hass.states.get("light.test")
assert state.attributes.get("brightness") == 255 assert state.attributes.get("brightness") == 255
async_fire_mqtt_message(hass, "test_scale_rgb/rgb/status", "127,0,0") async_fire_mqtt_message(hass, "test_scale_rgb/rgb/status", "128,64,32")
state = hass.states.get("light.test") state = hass.states.get("light.test")
assert state.attributes.get("brightness") == 127 assert state.attributes.get("brightness") == 128
assert state.attributes.get("rgb_color") == (255, 128, 64)
mqtt_mock.async_publish.reset_mock()
await common.async_turn_on(hass, "light.test", brightness=191)
await hass.async_block_till_done()
mqtt_mock.async_publish.assert_has_calls(
[
call("test_scale_rgb/set", "on", 0, False),
call("test_scale_rgb/rgb/set", "191,95,47", 0, False),
],
any_order=True,
)
async_fire_mqtt_message(hass, "test_scale_rgb/rgb/status", "191,95,47")
await hass.async_block_till_done()
state = hass.states.get("light.test")
assert state.attributes.get("brightness") == 191
assert state.attributes.get("rgb_color") == (255, 127, 63)
async def test_controlling_state_via_topic_with_templates( async def test_controlling_state_via_topic_with_templates(

View File

@ -135,6 +135,8 @@ async def test_setting_sensor_value_via_mqtt_message(
False, False,
), ),
(sensor.SensorDeviceClass.TIMESTAMP, "invalid", STATE_UNKNOWN, True), (sensor.SensorDeviceClass.TIMESTAMP, "invalid", STATE_UNKNOWN, True),
(sensor.SensorDeviceClass.ENUM, "some_value", "some_value", False),
(None, "some_value", "some_value", False),
], ],
) )
async def test_setting_sensor_native_value_handling_via_mqtt_message( async def test_setting_sensor_native_value_handling_via_mqtt_message(