From 39669bc788c75ca1d50b31c4133dac2844372c82 Mon Sep 17 00:00:00 2001 From: David Knowles Date: Wed, 6 Sep 2023 10:51:27 -0400 Subject: [PATCH 01/35] Fix the Hydrawise status sensor (#99271) --- homeassistant/components/hydrawise/binary_sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/hydrawise/binary_sensor.py b/homeassistant/components/hydrawise/binary_sensor.py index 63fe28cd400..9298e605791 100644 --- a/homeassistant/components/hydrawise/binary_sensor.py +++ b/homeassistant/components/hydrawise/binary_sensor.py @@ -90,7 +90,7 @@ class HydrawiseBinarySensor(HydrawiseEntity, BinarySensorEntity): """Get the latest data and updates the state.""" LOGGER.debug("Updating Hydrawise binary sensor: %s", self.name) if self.entity_description.key == "status": - self._attr_is_on = self.coordinator.api.status == "All good!" + self._attr_is_on = self.coordinator.last_update_success elif self.entity_description.key == "is_watering": relay_data = self.coordinator.api.relays_by_zone_number[self.data["relay"]] self._attr_is_on = relay_data["timestr"] == "Now" From 8b69f9fda83e16e8e10f08ead240b858380b0944 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:57:13 +0200 Subject: [PATCH 02/35] Fix tradfri asyncio.wait (#99730) --- homeassistant/components/tradfri/config_flow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/tradfri/config_flow.py b/homeassistant/components/tradfri/config_flow.py index 2a3052c1f7b..a383cc2bbee 100644 --- a/homeassistant/components/tradfri/config_flow.py +++ b/homeassistant/components/tradfri/config_flow.py @@ -122,7 +122,7 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN): if same_hub_entries: await asyncio.wait( [ - self.hass.config_entries.async_remove(entry_id) + asyncio.create_task(self.hass.config_entries.async_remove(entry_id)) for entry_id in same_hub_entries ] ) From 64408cab10dfede169db947fa5294d1bd8f4637a Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Wed, 6 Sep 2023 18:54:16 +0200 Subject: [PATCH 03/35] Handle alexa invalid climate temp adjustment (#99740) * Handle temp adjust when target state not set * Update homeassistant/components/alexa/errors.py Co-authored-by: Robert Resch * black --------- Co-authored-by: Robert Resch --- homeassistant/components/alexa/errors.py | 7 +++ homeassistant/components/alexa/handlers.py | 9 ++- tests/components/alexa/test_smart_home.py | 69 ++++++++++++++++++++++ 3 files changed, 84 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/alexa/errors.py b/homeassistant/components/alexa/errors.py index 2c5ced62403..f8e3720e160 100644 --- a/homeassistant/components/alexa/errors.py +++ b/homeassistant/components/alexa/errors.py @@ -90,6 +90,13 @@ class AlexaUnsupportedThermostatModeError(AlexaError): error_type = "UNSUPPORTED_THERMOSTAT_MODE" +class AlexaUnsupportedThermostatTargetStateError(AlexaError): + """Class to represent unsupported climate target state error.""" + + namespace = "Alexa.ThermostatController" + error_type = "INVALID_TARGET_STATE" + + class AlexaTempRangeError(AlexaError): """Class to represent TempRange errors.""" diff --git a/homeassistant/components/alexa/handlers.py b/homeassistant/components/alexa/handlers.py index 3e995e9ffe2..f99b0231e4d 100644 --- a/homeassistant/components/alexa/handlers.py +++ b/homeassistant/components/alexa/handlers.py @@ -73,6 +73,7 @@ from .errors import ( AlexaSecurityPanelAuthorizationRequired, AlexaTempRangeError, AlexaUnsupportedThermostatModeError, + AlexaUnsupportedThermostatTargetStateError, AlexaVideoActionNotPermittedForContentError, ) from .state_report import AlexaDirective, AlexaResponse, async_enable_proactive_mode @@ -911,7 +912,13 @@ async def async_api_adjust_target_temp( } ) else: - target_temp = float(entity.attributes[ATTR_TEMPERATURE]) + temp_delta + current_target_temp: str | None = entity.attributes.get(ATTR_TEMPERATURE) + if current_target_temp is None: + raise AlexaUnsupportedThermostatTargetStateError( + "The current target temperature is not set, " + "cannot adjust target temperature" + ) + target_temp = float(current_target_temp) + temp_delta if target_temp < min_temp or target_temp > max_temp: raise AlexaTempRangeError(hass, target_temp, min_temp, max_temp) diff --git a/tests/components/alexa/test_smart_home.py b/tests/components/alexa/test_smart_home.py index c42ea0a0f6a..bbdf3efeb5f 100644 --- a/tests/components/alexa/test_smart_home.py +++ b/tests/components/alexa/test_smart_home.py @@ -2471,6 +2471,75 @@ async def test_thermostat(hass: HomeAssistant) -> None: assert call.data["preset_mode"] == "eco" +async def test_no_current_target_temp_adjusting_temp(hass: HomeAssistant) -> None: + """Test thermostat adjusting temp with no initial target temperature.""" + hass.config.units = US_CUSTOMARY_SYSTEM + device = ( + "climate.test_thermostat", + "cool", + { + "temperature": None, + "target_temp_high": None, + "target_temp_low": None, + "current_temperature": 75.0, + "friendly_name": "Test Thermostat", + "supported_features": 1 | 2 | 4 | 128, + "hvac_modes": ["off", "heat", "cool", "auto", "dry", "fan_only"], + "preset_mode": None, + "preset_modes": ["eco"], + "min_temp": 50, + "max_temp": 90, + }, + ) + appliance = await discovery_test(device, hass) + + assert appliance["endpointId"] == "climate#test_thermostat" + assert appliance["displayCategories"][0] == "THERMOSTAT" + assert appliance["friendlyName"] == "Test Thermostat" + + capabilities = assert_endpoint_capabilities( + appliance, + "Alexa.PowerController", + "Alexa.ThermostatController", + "Alexa.TemperatureSensor", + "Alexa.EndpointHealth", + "Alexa", + ) + + properties = await reported_properties(hass, "climate#test_thermostat") + properties.assert_equal("Alexa.ThermostatController", "thermostatMode", "COOL") + properties.assert_not_has_property( + "Alexa.ThermostatController", + "targetSetpoint", + ) + properties.assert_equal( + "Alexa.TemperatureSensor", "temperature", {"value": 75.0, "scale": "FAHRENHEIT"} + ) + + thermostat_capability = get_capability(capabilities, "Alexa.ThermostatController") + assert thermostat_capability is not None + configuration = thermostat_capability["configuration"] + assert configuration["supportsScheduling"] is False + + supported_modes = ["OFF", "HEAT", "COOL", "AUTO", "ECO", "CUSTOM"] + for mode in supported_modes: + assert mode in configuration["supportedModes"] + + # Adjust temperature where target temp is not set + msg = await assert_request_fails( + "Alexa.ThermostatController", + "AdjustTargetTemperature", + "climate#test_thermostat", + "climate.set_temperature", + hass, + payload={"targetSetpointDelta": {"value": -5.0, "scale": "KELVIN"}}, + ) + assert msg["event"]["payload"]["type"] == "INVALID_TARGET_STATE" + assert msg["event"]["payload"]["message"] == ( + "The current target temperature is not set, cannot adjust target temperature" + ) + + async def test_thermostat_dual(hass: HomeAssistant) -> None: """Test thermostat discovery with auto mode, with upper and lower target temperatures.""" hass.config.units = US_CUSTOMARY_SYSTEM From c741214ab5cbf7278180570b98c6b097d3cfd50d Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Wed, 6 Sep 2023 17:16:40 +0200 Subject: [PATCH 04/35] Revert "Bump pyoverkiz to 1.10.1 (#97916)" (#99742) --- homeassistant/components/overkiz/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/overkiz/manifest.json b/homeassistant/components/overkiz/manifest.json index 8cf029adb54..d88996c7e02 100644 --- a/homeassistant/components/overkiz/manifest.json +++ b/homeassistant/components/overkiz/manifest.json @@ -13,7 +13,7 @@ "integration_type": "hub", "iot_class": "cloud_polling", "loggers": ["boto3", "botocore", "pyhumps", "pyoverkiz", "s3transfer"], - "requirements": ["pyoverkiz==1.10.1"], + "requirements": ["pyoverkiz==1.9.0"], "zeroconf": [ { "type": "_kizbox._tcp.local.", diff --git a/requirements_all.txt b/requirements_all.txt index d656b0dbb48..01c29698411 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1916,7 +1916,7 @@ pyotgw==2.1.3 pyotp==2.8.0 # homeassistant.components.overkiz -pyoverkiz==1.10.1 +pyoverkiz==1.9.0 # homeassistant.components.openweathermap pyowm==3.2.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 308759108ca..a86febaabfb 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1423,7 +1423,7 @@ pyotgw==2.1.3 pyotp==2.8.0 # homeassistant.components.overkiz -pyoverkiz==1.10.1 +pyoverkiz==1.9.0 # homeassistant.components.openweathermap pyowm==3.2.0 From 718f1a6673aac434e7949ece9f4fa5898792d559 Mon Sep 17 00:00:00 2001 From: Quentame Date: Thu, 7 Sep 2023 10:28:08 +0200 Subject: [PATCH 05/35] Fix Freebox disk free space sensor (#99757) * Fix Freebox disk free space sensor * Add initial value assert to check results --- .coveragerc | 1 - homeassistant/components/freebox/router.py | 7 +++- homeassistant/components/freebox/sensor.py | 13 ++++--- tests/components/freebox/common.py | 27 +++++++++++++ tests/components/freebox/test_sensor.py | 45 ++++++++++++++++++++++ 5 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 tests/components/freebox/common.py create mode 100644 tests/components/freebox/test_sensor.py diff --git a/.coveragerc b/.coveragerc index 97ed97ef293..66c47e35f37 100644 --- a/.coveragerc +++ b/.coveragerc @@ -416,7 +416,6 @@ omit = homeassistant/components/freebox/device_tracker.py homeassistant/components/freebox/home_base.py homeassistant/components/freebox/router.py - homeassistant/components/freebox/sensor.py homeassistant/components/freebox/switch.py homeassistant/components/fritz/common.py homeassistant/components/fritz/device_tracker.py diff --git a/homeassistant/components/freebox/router.py b/homeassistant/components/freebox/router.py index 7c83e980540..cd5862a2f80 100644 --- a/homeassistant/components/freebox/router.py +++ b/homeassistant/components/freebox/router.py @@ -156,7 +156,12 @@ class FreeboxRouter: fbx_disks: list[dict[str, Any]] = await self._api.storage.get_disks() or [] for fbx_disk in fbx_disks: - self.disks[fbx_disk["id"]] = fbx_disk + disk: dict[str, Any] = {**fbx_disk} + disk_part: dict[int, dict[str, Any]] = {} + for fbx_disk_part in fbx_disk["partitions"]: + disk_part[fbx_disk_part["id"]] = fbx_disk_part + disk["partitions"] = disk_part + self.disks[fbx_disk["id"]] = disk async def _update_raids_sensors(self) -> None: """Update Freebox raids.""" diff --git a/homeassistant/components/freebox/sensor.py b/homeassistant/components/freebox/sensor.py index 901bfc63199..4e7c3910c54 100644 --- a/homeassistant/components/freebox/sensor.py +++ b/homeassistant/components/freebox/sensor.py @@ -95,7 +95,7 @@ async def async_setup_entry( entities.extend( FreeboxDiskSensor(router, disk, partition, description) for disk in router.disks.values() - for partition in disk["partitions"] + for partition in disk["partitions"].values() for description in DISK_PARTITION_SENSORS ) @@ -197,7 +197,8 @@ class FreeboxDiskSensor(FreeboxSensor): ) -> None: """Initialize a Freebox disk sensor.""" super().__init__(router, description) - self._partition = partition + self._disk_id = disk["id"] + self._partition_id = partition["id"] self._attr_name = f"{partition['label']} {description.name}" self._attr_unique_id = ( f"{router.mac} {description.key} {disk['id']} {partition['id']}" @@ -218,10 +219,10 @@ class FreeboxDiskSensor(FreeboxSensor): def async_update_state(self) -> None: """Update the Freebox disk sensor.""" value = None - if self._partition.get("total_bytes"): - value = round( - self._partition["free_bytes"] * 100 / self._partition["total_bytes"], 2 - ) + disk: dict[str, Any] = self._router.disks[self._disk_id] + partition: dict[str, Any] = disk["partitions"][self._partition_id] + if partition.get("total_bytes"): + value = round(partition["free_bytes"] * 100 / partition["total_bytes"], 2) self._attr_native_value = value diff --git a/tests/components/freebox/common.py b/tests/components/freebox/common.py new file mode 100644 index 00000000000..9f7dfd8f92a --- /dev/null +++ b/tests/components/freebox/common.py @@ -0,0 +1,27 @@ +"""Common methods used across tests for Freebox.""" +from unittest.mock import patch + +from homeassistant.components.freebox.const import DOMAIN +from homeassistant.const import CONF_HOST, CONF_PORT +from homeassistant.core import HomeAssistant +from homeassistant.setup import async_setup_component + +from .const import MOCK_HOST, MOCK_PORT + +from tests.common import MockConfigEntry + + +async def setup_platform(hass: HomeAssistant, platform: str) -> MockConfigEntry: + """Set up the Freebox platform.""" + mock_entry = MockConfigEntry( + domain=DOMAIN, + data={CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT}, + unique_id=MOCK_HOST, + ) + mock_entry.add_to_hass(hass) + + with patch("homeassistant.components.freebox.PLATFORMS", [platform]): + assert await async_setup_component(hass, DOMAIN, {}) + await hass.async_block_till_done() + + return mock_entry diff --git a/tests/components/freebox/test_sensor.py b/tests/components/freebox/test_sensor.py new file mode 100644 index 00000000000..2ebcf8baa04 --- /dev/null +++ b/tests/components/freebox/test_sensor.py @@ -0,0 +1,45 @@ +"""Tests for the Freebox sensors.""" +from copy import deepcopy +from unittest.mock import Mock + +from freezegun.api import FrozenDateTimeFactory + +from homeassistant.components.freebox import SCAN_INTERVAL +from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN +from homeassistant.core import HomeAssistant + +from .common import setup_platform +from .const import DATA_STORAGE_GET_DISKS + +from tests.common import async_fire_time_changed + + +async def test_disk( + hass: HomeAssistant, freezer: FrozenDateTimeFactory, router: Mock +) -> None: + """Test disk sensor.""" + await setup_platform(hass, SENSOR_DOMAIN) + + # Initial state + assert ( + router().storage.get_disks.return_value[2]["partitions"][0]["total_bytes"] + == 1960000000000 + ) + + assert ( + router().storage.get_disks.return_value[2]["partitions"][0]["free_bytes"] + == 1730000000000 + ) + + assert hass.states.get("sensor.freebox_free_space").state == "88.27" + + # Simulate a changed storage size + data_storage_get_disks_changed = deepcopy(DATA_STORAGE_GET_DISKS) + data_storage_get_disks_changed[2]["partitions"][0]["free_bytes"] = 880000000000 + router().storage.get_disks.return_value = data_storage_get_disks_changed + # Simulate an update + freezer.tick(SCAN_INTERVAL) + async_fire_time_changed(hass) + # To execute the save + await hass.async_block_till_done() + assert hass.states.get("sensor.freebox_free_space").state == "44.9" From fb56e48e07bdc790d2dd3dabed3ea69e3c7827dc Mon Sep 17 00:00:00 2001 From: Quentame Date: Thu, 7 Sep 2023 17:28:50 +0200 Subject: [PATCH 06/35] Fix Freebox Home battery sensor (#99756) --- homeassistant/components/freebox/const.py | 3 +++ tests/components/freebox/const.py | 6 ++--- tests/components/freebox/test_sensor.py | 28 ++++++++++++++++++++++- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/freebox/const.py b/homeassistant/components/freebox/const.py index 59dce75649b..5bed7b3456a 100644 --- a/homeassistant/components/freebox/const.py +++ b/homeassistant/components/freebox/const.py @@ -85,4 +85,7 @@ CATEGORY_TO_MODEL = { HOME_COMPATIBLE_CATEGORIES = [ FreeboxHomeCategory.CAMERA, + FreeboxHomeCategory.DWS, + FreeboxHomeCategory.KFB, + FreeboxHomeCategory.PIR, ] diff --git a/tests/components/freebox/const.py b/tests/components/freebox/const.py index a6253dbf315..0b58348a5df 100644 --- a/tests/components/freebox/const.py +++ b/tests/components/freebox/const.py @@ -1986,7 +1986,7 @@ DATA_HOME_GET_NODES = [ "category": "kfb", "group": {"label": ""}, "id": 9, - "label": "Télécommande I", + "label": "Télécommande", "name": "node_9", "props": { "Address": 5, @@ -2067,7 +2067,7 @@ DATA_HOME_GET_NODES = [ "category": "dws", "group": {"label": "Entrée"}, "id": 11, - "label": "dws i", + "label": "Ouverture porte", "name": "node_11", "props": { "Address": 6, @@ -2259,7 +2259,7 @@ DATA_HOME_GET_NODES = [ "category": "pir", "group": {"label": "Salon"}, "id": 26, - "label": "Salon Détecteur s", + "label": "Détecteur", "name": "node_26", "props": { "Address": 9, diff --git a/tests/components/freebox/test_sensor.py b/tests/components/freebox/test_sensor.py index 2ebcf8baa04..41daa79fe4e 100644 --- a/tests/components/freebox/test_sensor.py +++ b/tests/components/freebox/test_sensor.py @@ -9,7 +9,7 @@ from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.core import HomeAssistant from .common import setup_platform -from .const import DATA_STORAGE_GET_DISKS +from .const import DATA_HOME_GET_NODES, DATA_STORAGE_GET_DISKS from tests.common import async_fire_time_changed @@ -43,3 +43,29 @@ async def test_disk( # To execute the save await hass.async_block_till_done() assert hass.states.get("sensor.freebox_free_space").state == "44.9" + + +async def test_battery( + hass: HomeAssistant, freezer: FrozenDateTimeFactory, router: Mock +) -> None: + """Test battery sensor.""" + await setup_platform(hass, SENSOR_DOMAIN) + + assert hass.states.get("sensor.telecommande_niveau_de_batterie").state == "100" + assert hass.states.get("sensor.ouverture_porte_niveau_de_batterie").state == "100" + assert hass.states.get("sensor.detecteur_niveau_de_batterie").state == "100" + + # Simulate a changed battery + data_home_get_nodes_changed = deepcopy(DATA_HOME_GET_NODES) + data_home_get_nodes_changed[2]["show_endpoints"][3]["value"] = 25 + data_home_get_nodes_changed[3]["show_endpoints"][3]["value"] = 50 + data_home_get_nodes_changed[4]["show_endpoints"][3]["value"] = 75 + router().home.get_home_nodes.return_value = data_home_get_nodes_changed + # Simulate an update + freezer.tick(SCAN_INTERVAL) + async_fire_time_changed(hass) + # To execute the save + await hass.async_block_till_done() + assert hass.states.get("sensor.telecommande_niveau_de_batterie").state == "25" + assert hass.states.get("sensor.ouverture_porte_niveau_de_batterie").state == "50" + assert hass.states.get("sensor.detecteur_niveau_de_batterie").state == "75" From a25f6bbd0995d9bbf85484426ccf00738c096052 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 6 Sep 2023 20:01:22 -0500 Subject: [PATCH 07/35] Bump sense_energy to 0.12.1 (#99763) --- homeassistant/components/emulated_kasa/manifest.json | 2 +- homeassistant/components/sense/manifest.json | 2 +- requirements_all.txt | 4 ++-- requirements_test_all.txt | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/emulated_kasa/manifest.json b/homeassistant/components/emulated_kasa/manifest.json index 324279db7d9..d39d530eccc 100644 --- a/homeassistant/components/emulated_kasa/manifest.json +++ b/homeassistant/components/emulated_kasa/manifest.json @@ -6,5 +6,5 @@ "iot_class": "local_push", "loggers": ["sense_energy"], "quality_scale": "internal", - "requirements": ["sense_energy==0.12.0"] + "requirements": ["sense_energy==0.12.1"] } diff --git a/homeassistant/components/sense/manifest.json b/homeassistant/components/sense/manifest.json index 8c20db2e422..8a89d6d8531 100644 --- a/homeassistant/components/sense/manifest.json +++ b/homeassistant/components/sense/manifest.json @@ -20,5 +20,5 @@ "documentation": "https://www.home-assistant.io/integrations/sense", "iot_class": "cloud_polling", "loggers": ["sense_energy"], - "requirements": ["sense-energy==0.12.0"] + "requirements": ["sense-energy==0.12.1"] } diff --git a/requirements_all.txt b/requirements_all.txt index 01c29698411..5c116d88868 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2369,10 +2369,10 @@ securetar==2023.3.0 sendgrid==6.8.2 # homeassistant.components.sense -sense-energy==0.12.0 +sense-energy==0.12.1 # homeassistant.components.emulated_kasa -sense_energy==0.12.0 +sense_energy==0.12.1 # homeassistant.components.sensirion_ble sensirion-ble==0.1.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index a86febaabfb..8a33575909b 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1729,10 +1729,10 @@ screenlogicpy==0.8.2 securetar==2023.3.0 # homeassistant.components.sense -sense-energy==0.12.0 +sense-energy==0.12.1 # homeassistant.components.emulated_kasa -sense_energy==0.12.0 +sense_energy==0.12.1 # homeassistant.components.sensirion_ble sensirion-ble==0.1.0 From 7c7fed032223d328afb3ef915e1e540d762f107a Mon Sep 17 00:00:00 2001 From: Pawel Date: Thu, 7 Sep 2023 12:45:31 +0200 Subject: [PATCH 08/35] Add support for more busy codes for Epson (#99771) add support for more busy codes --- homeassistant/components/epson/manifest.json | 2 +- homeassistant/components/epson/media_player.py | 4 ++-- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/epson/manifest.json b/homeassistant/components/epson/manifest.json index 77a1a89b686..7b8f8d8a4a2 100644 --- a/homeassistant/components/epson/manifest.json +++ b/homeassistant/components/epson/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://www.home-assistant.io/integrations/epson", "iot_class": "local_polling", "loggers": ["epson_projector"], - "requirements": ["epson-projector==0.5.0"] + "requirements": ["epson-projector==0.5.1"] } diff --git a/homeassistant/components/epson/media_player.py b/homeassistant/components/epson/media_player.py index 5c49f566bb5..1f80be9fe06 100644 --- a/homeassistant/components/epson/media_player.py +++ b/homeassistant/components/epson/media_player.py @@ -6,7 +6,7 @@ import logging from epson_projector import Projector, ProjectorUnavailableError from epson_projector.const import ( BACK, - BUSY, + BUSY_CODES, CMODE, CMODE_LIST, CMODE_LIST_SET, @@ -147,7 +147,7 @@ class EpsonProjectorMediaPlayer(MediaPlayerEntity): self._attr_volume_level = float(volume) except ValueError: self._attr_volume_level = None - elif power_state == BUSY: + elif power_state in BUSY_CODES: self._attr_state = MediaPlayerState.ON else: self._attr_state = MediaPlayerState.OFF diff --git a/requirements_all.txt b/requirements_all.txt index 5c116d88868..314dd122129 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -751,7 +751,7 @@ env-canada==0.5.36 ephem==4.1.2 # homeassistant.components.epson -epson-projector==0.5.0 +epson-projector==0.5.1 # homeassistant.components.epsonworkforce epsonprinter==0.0.9 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 8a33575909b..205abc1cc7f 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -604,7 +604,7 @@ env-canada==0.5.36 ephem==4.1.2 # homeassistant.components.epson -epson-projector==0.5.0 +epson-projector==0.5.1 # homeassistant.components.esphome esphome-dashboard-api==1.2.3 From c740b79e1e71e67d35518895ba07180dea3d8feb Mon Sep 17 00:00:00 2001 From: Aaron Bach Date: Wed, 6 Sep 2023 17:26:14 -0600 Subject: [PATCH 09/35] Bump `aiorecollect` to 2023.09.0 (#99780) --- homeassistant/components/recollect_waste/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/recollect_waste/manifest.json b/homeassistant/components/recollect_waste/manifest.json index dc31adddb78..e1ad3f98950 100644 --- a/homeassistant/components/recollect_waste/manifest.json +++ b/homeassistant/components/recollect_waste/manifest.json @@ -7,5 +7,5 @@ "integration_type": "service", "iot_class": "cloud_polling", "loggers": ["aiorecollect"], - "requirements": ["aiorecollect==1.0.8"] + "requirements": ["aiorecollect==2023.09.0"] } diff --git a/requirements_all.txt b/requirements_all.txt index 314dd122129..afa46ccf2f6 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -327,7 +327,7 @@ aiopyarr==23.4.0 aioqsw==0.3.4 # homeassistant.components.recollect_waste -aiorecollect==1.0.8 +aiorecollect==2023.09.0 # homeassistant.components.ridwell aioridwell==2023.07.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 205abc1cc7f..b5c02fa72bb 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -302,7 +302,7 @@ aiopyarr==23.4.0 aioqsw==0.3.4 # homeassistant.components.recollect_waste -aiorecollect==1.0.8 +aiorecollect==2023.09.0 # homeassistant.components.ridwell aioridwell==2023.07.0 From c217ea7b388a4a2e0320a2e5f1509620842f9a37 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 7 Sep 2023 05:17:04 -0500 Subject: [PATCH 10/35] Bump pyenphase to 1.9.3 (#99787) * Bump pyenphase to 1.9.2 changelog: https://github.com/pyenphase/pyenphase/compare/v1.9.1...v1.9.2 Handle the case where the user has manually specified a password for local auth with firmware < 7.x but its incorrect. The integration previously accepted any wrong password and would reduce functionality down to what works without a password. We now preserve that behavior to avoid breaking existing installs. * bump --- homeassistant/components/enphase_envoy/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/enphase_envoy/manifest.json b/homeassistant/components/enphase_envoy/manifest.json index a45f4f01e49..d3a36b16b60 100644 --- a/homeassistant/components/enphase_envoy/manifest.json +++ b/homeassistant/components/enphase_envoy/manifest.json @@ -6,7 +6,7 @@ "documentation": "https://www.home-assistant.io/integrations/enphase_envoy", "iot_class": "local_polling", "loggers": ["pyenphase"], - "requirements": ["pyenphase==1.9.1"], + "requirements": ["pyenphase==1.9.3"], "zeroconf": [ { "type": "_enphase-envoy._tcp.local." diff --git a/requirements_all.txt b/requirements_all.txt index afa46ccf2f6..5052906c9a9 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1671,7 +1671,7 @@ pyedimax==0.2.1 pyefergy==22.1.1 # homeassistant.components.enphase_envoy -pyenphase==1.9.1 +pyenphase==1.9.3 # homeassistant.components.envisalink pyenvisalink==4.6 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index b5c02fa72bb..b83cbe6146e 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1235,7 +1235,7 @@ pyeconet==0.1.20 pyefergy==22.1.1 # homeassistant.components.enphase_envoy -pyenphase==1.9.1 +pyenphase==1.9.3 # homeassistant.components.everlights pyeverlights==0.1.0 From 45e723135c1216709cc23d0b52796055919a9c50 Mon Sep 17 00:00:00 2001 From: swamplynx Date: Thu, 7 Sep 2023 06:17:38 -0400 Subject: [PATCH 11/35] Bump pylutron-caseta to v0.18.2 (#99789) * Bump pylutron-caseta to v0.18.2 Minor bump to pylutron-caseta requirement to support wall mounted occupancy sensor device type in latest RA3 firmware. * Update requirements_all.txt for pylutron-caseta 0.18.2 * Update requirements_test_all.txt for pylutron-caseta 0.18.2 --- homeassistant/components/lutron_caseta/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/lutron_caseta/manifest.json b/homeassistant/components/lutron_caseta/manifest.json index feab9744df0..bf6ed32c668 100644 --- a/homeassistant/components/lutron_caseta/manifest.json +++ b/homeassistant/components/lutron_caseta/manifest.json @@ -9,7 +9,7 @@ }, "iot_class": "local_push", "loggers": ["pylutron_caseta"], - "requirements": ["pylutron-caseta==0.18.1"], + "requirements": ["pylutron-caseta==0.18.2"], "zeroconf": [ { "type": "_lutron._tcp.local.", diff --git a/requirements_all.txt b/requirements_all.txt index 5052906c9a9..7086fb20ec2 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1821,7 +1821,7 @@ pylitejet==0.5.0 pylitterbot==2023.4.5 # homeassistant.components.lutron_caseta -pylutron-caseta==0.18.1 +pylutron-caseta==0.18.2 # homeassistant.components.lutron pylutron==0.2.8 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index b83cbe6146e..6f98821badb 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1349,7 +1349,7 @@ pylitejet==0.5.0 pylitterbot==2023.4.5 # homeassistant.components.lutron_caseta -pylutron-caseta==0.18.1 +pylutron-caseta==0.18.2 # homeassistant.components.mailgun pymailgunner==1.4 From 590ac173edfeb1ec32b77577613891869ea4636a Mon Sep 17 00:00:00 2001 From: lymanepp <4195527+lymanepp@users.noreply.github.com> Date: Thu, 7 Sep 2023 22:12:18 -0400 Subject: [PATCH 12/35] Fix missing dew point and humidity in tomorrowio forecasts (#99793) * Fix missing dew point and humidity in tomorrowio forecasts * Add assertion for correct parameters to realtime_and_all_forecasts method --- .../components/tomorrowio/__init__.py | 2 + tests/components/tomorrowio/test_weather.py | 59 ++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/tomorrowio/__init__.py b/homeassistant/components/tomorrowio/__init__.py index 41fa8158624..77675e3f2ec 100644 --- a/homeassistant/components/tomorrowio/__init__.py +++ b/homeassistant/components/tomorrowio/__init__.py @@ -302,6 +302,8 @@ class TomorrowioDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]): [ TMRW_ATTR_TEMPERATURE_LOW, TMRW_ATTR_TEMPERATURE_HIGH, + TMRW_ATTR_DEW_POINT, + TMRW_ATTR_HUMIDITY, TMRW_ATTR_WIND_SPEED, TMRW_ATTR_WIND_DIRECTION, TMRW_ATTR_CONDITION, diff --git a/tests/components/tomorrowio/test_weather.py b/tests/components/tomorrowio/test_weather.py index a6a5e935614..229e62065a6 100644 --- a/tests/components/tomorrowio/test_weather.py +++ b/tests/components/tomorrowio/test_weather.py @@ -153,9 +153,66 @@ async def test_legacy_config_entry(hass: HomeAssistant) -> None: assert len(er.async_entries_for_config_entry(registry, entry.entry_id)) == 30 -async def test_v4_weather(hass: HomeAssistant) -> None: +async def test_v4_weather(hass: HomeAssistant, tomorrowio_config_entry_update) -> None: """Test v4 weather data.""" weather_state = await _setup(hass, API_V4_ENTRY_DATA) + + tomorrowio_config_entry_update.assert_called_with( + [ + "temperature", + "humidity", + "pressureSeaLevel", + "windSpeed", + "windDirection", + "weatherCode", + "visibility", + "pollutantO3", + "windGust", + "cloudCover", + "precipitationType", + "pollutantCO", + "mepIndex", + "mepHealthConcern", + "mepPrimaryPollutant", + "cloudBase", + "cloudCeiling", + "cloudCover", + "dewPoint", + "epaIndex", + "epaHealthConcern", + "epaPrimaryPollutant", + "temperatureApparent", + "fireIndex", + "pollutantNO2", + "pollutantO3", + "particulateMatter10", + "particulateMatter25", + "grassIndex", + "treeIndex", + "weedIndex", + "precipitationType", + "pressureSurfaceLevel", + "solarGHI", + "pollutantSO2", + "uvIndex", + "uvHealthConcern", + "windGust", + ], + [ + "temperatureMin", + "temperatureMax", + "dewPoint", + "humidity", + "windSpeed", + "windDirection", + "weatherCode", + "precipitationIntensityAvg", + "precipitationProbability", + ], + nowcast_timestep=60, + location="80.0,80.0", + ) + assert weather_state.state == ATTR_CONDITION_SUNNY assert weather_state.attributes[ATTR_ATTRIBUTION] == ATTRIBUTION assert len(weather_state.attributes[ATTR_FORECAST]) == 14 From 31fb9d12ea25eb9436a2962f1138c8e0b5a8aa2c Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 7 Sep 2023 12:00:19 +0200 Subject: [PATCH 13/35] Always set severity level flag on render_template error events (#99804) --- homeassistant/components/websocket_api/commands.py | 4 +++- tests/components/websocket_api/test_commands.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/websocket_api/commands.py b/homeassistant/components/websocket_api/commands.py index 7772bef66f9..a05f2aa8e3f 100644 --- a/homeassistant/components/websocket_api/commands.py +++ b/homeassistant/components/websocket_api/commands.py @@ -565,7 +565,9 @@ async def handle_render_template( if not report_errors: return connection.send_message( - messages.event_message(msg["id"], {"error": str(result)}) + messages.event_message( + msg["id"], {"error": str(result), "level": "ERROR"} + ) ) return diff --git a/tests/components/websocket_api/test_commands.py b/tests/components/websocket_api/test_commands.py index 96e79a81716..70f08477a72 100644 --- a/tests/components/websocket_api/test_commands.py +++ b/tests/components/websocket_api/test_commands.py @@ -1512,7 +1512,10 @@ async def test_render_template_with_delayed_error( assert msg["id"] == 5 assert msg["type"] == "event" event = msg["event"] - assert event == {"error": "UndefinedError: 'explode' is undefined"} + assert event == { + "error": "UndefinedError: 'explode' is undefined", + "level": "ERROR", + } assert "Template variable error" not in caplog.text assert "Template variable warning" not in caplog.text From 850c0959883694eea7a3bc5c70ba353c4139ecc6 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 7 Sep 2023 13:33:38 +0200 Subject: [PATCH 14/35] Improve error handling in /api/states POST (#99810) --- homeassistant/components/api/__init__.py | 23 ++++++++++++++++++----- tests/components/api/test_init.py | 22 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/api/__init__.py b/homeassistant/components/api/__init__.py index 7b13833ccab..d968784b5b9 100644 --- a/homeassistant/components/api/__init__.py +++ b/homeassistant/components/api/__init__.py @@ -28,7 +28,13 @@ from homeassistant.const import ( ) import homeassistant.core as ha from homeassistant.core import HomeAssistant -from homeassistant.exceptions import ServiceNotFound, TemplateError, Unauthorized +from homeassistant.exceptions import ( + InvalidEntityFormatError, + InvalidStateError, + ServiceNotFound, + TemplateError, + Unauthorized, +) from homeassistant.helpers import config_validation as cv, template from homeassistant.helpers.json import json_dumps from homeassistant.helpers.service import async_get_all_descriptions @@ -222,7 +228,7 @@ class APIEntityStateView(HomeAssistantView): """Update state of entity.""" if not request["hass_user"].is_admin: raise Unauthorized(entity_id=entity_id) - hass = request.app["hass"] + hass: HomeAssistant = request.app["hass"] try: data = await request.json() except ValueError: @@ -237,9 +243,16 @@ class APIEntityStateView(HomeAssistantView): is_new_state = hass.states.get(entity_id) is None # Write state - hass.states.async_set( - entity_id, new_state, attributes, force_update, self.context(request) - ) + try: + hass.states.async_set( + entity_id, new_state, attributes, force_update, self.context(request) + ) + except InvalidEntityFormatError: + return self.json_message( + "Invalid entity ID specified.", HTTPStatus.BAD_REQUEST + ) + except InvalidStateError: + return self.json_message("Invalid state specified.", HTTPStatus.BAD_REQUEST) # Read the state back for our response status_code = HTTPStatus.CREATED if is_new_state else HTTPStatus.OK diff --git a/tests/components/api/test_init.py b/tests/components/api/test_init.py index 116529b02a4..b3bb6de49cf 100644 --- a/tests/components/api/test_init.py +++ b/tests/components/api/test_init.py @@ -96,6 +96,28 @@ async def test_api_state_change_of_non_existing_entity( assert hass.states.get("test_entity.that_does_not_exist").state == new_state +async def test_api_state_change_with_bad_entity_id( + hass: HomeAssistant, mock_api_client: TestClient +) -> None: + """Test if API sends appropriate error if we omit state.""" + resp = await mock_api_client.post( + "/api/states/bad.entity.id", json={"state": "new_state"} + ) + + assert resp.status == HTTPStatus.BAD_REQUEST + + +async def test_api_state_change_with_bad_state( + hass: HomeAssistant, mock_api_client: TestClient +) -> None: + """Test if API sends appropriate error if we omit state.""" + resp = await mock_api_client.post( + "/api/states/test.test", json={"state": "x" * 256} + ) + + assert resp.status == HTTPStatus.BAD_REQUEST + + async def test_api_state_change_with_bad_data( hass: HomeAssistant, mock_api_client: TestClient ) -> None: From 0b4fedccff561712c1eb36631901101487814bcb Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Thu, 7 Sep 2023 12:45:47 +0200 Subject: [PATCH 15/35] Use correct config entry id in Livisi (#99812) --- homeassistant/components/livisi/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/livisi/__init__.py b/homeassistant/components/livisi/__init__.py index b0387c6dcc9..e638c84a917 100644 --- a/homeassistant/components/livisi/__init__.py +++ b/homeassistant/components/livisi/__init__.py @@ -33,7 +33,7 @@ async def async_setup_entry(hass: core.HomeAssistant, entry: ConfigEntry) -> boo hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator device_registry = dr.async_get(hass) device_registry.async_get_or_create( - config_entry_id=coordinator.serial_number, + config_entry_id=entry.entry_id, identifiers={(DOMAIN, entry.entry_id)}, manufacturer="Livisi", name=f"SHC {coordinator.controller_type} {coordinator.serial_number}", From 7dc7060825c9d350e002cd942e2a60ee1a6a1cd3 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 8 Sep 2023 06:32:21 -0500 Subject: [PATCH 16/35] Fix missing name and identifiers for ELKM1 connected devices (#99828) --- homeassistant/components/elkm1/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/homeassistant/components/elkm1/__init__.py b/homeassistant/components/elkm1/__init__.py index 352c8419106..14046b7079b 100644 --- a/homeassistant/components/elkm1/__init__.py +++ b/homeassistant/components/elkm1/__init__.py @@ -518,6 +518,8 @@ class ElkEntity(Entity): def device_info(self) -> DeviceInfo: """Device info connecting via the ElkM1 system.""" return DeviceInfo( + name=self._element.name, + identifiers={(DOMAIN, self._unique_id)}, via_device=(DOMAIN, f"{self._prefix}_system"), ) From d50f9f4e514c781039f9109306447fd232fbce72 Mon Sep 17 00:00:00 2001 From: Simone Chemelli Date: Fri, 8 Sep 2023 00:32:15 +0200 Subject: [PATCH 17/35] Bump aiovodafone to 0.1.0 (#99851) * bump aiovodafone to 0.1.0 * fix tests --- homeassistant/components/vodafone_station/coordinator.py | 4 ++-- homeassistant/components/vodafone_station/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/vodafone_station/test_config_flow.py | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/vodafone_station/coordinator.py b/homeassistant/components/vodafone_station/coordinator.py index b79acac9ce9..58079180bf8 100644 --- a/homeassistant/components/vodafone_station/coordinator.py +++ b/homeassistant/components/vodafone_station/coordinator.py @@ -112,9 +112,9 @@ class VodafoneStationRouter(DataUpdateCoordinator[UpdateCoordinatorDataType]): dev_info, utc_point_in_time ), ) - for dev_info in (await self.api.get_all_devices()).values() + for dev_info in (await self.api.get_devices_data()).values() } - data_sensors = await self.api.get_user_data() + data_sensors = await self.api.get_sensor_data() await self.api.logout() return UpdateCoordinatorDataType(data_devices, data_sensors) diff --git a/homeassistant/components/vodafone_station/manifest.json b/homeassistant/components/vodafone_station/manifest.json index 7069629ca2e..5470cdd684c 100644 --- a/homeassistant/components/vodafone_station/manifest.json +++ b/homeassistant/components/vodafone_station/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://www.home-assistant.io/integrations/vodafone_station", "iot_class": "local_polling", "loggers": ["aiovodafone"], - "requirements": ["aiovodafone==0.0.6"] + "requirements": ["aiovodafone==0.1.0"] } diff --git a/requirements_all.txt b/requirements_all.txt index 7086fb20ec2..026caea7f8e 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -369,7 +369,7 @@ aiounifi==61 aiovlc==0.1.0 # homeassistant.components.vodafone_station -aiovodafone==0.0.6 +aiovodafone==0.1.0 # homeassistant.components.waqi aiowaqi==0.2.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 6f98821badb..6953dfd0de5 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -344,7 +344,7 @@ aiounifi==61 aiovlc==0.1.0 # homeassistant.components.vodafone_station -aiovodafone==0.0.6 +aiovodafone==0.1.0 # homeassistant.components.watttime aiowatttime==0.1.1 diff --git a/tests/components/vodafone_station/test_config_flow.py b/tests/components/vodafone_station/test_config_flow.py index 03a1198288d..3d2ef0cf568 100644 --- a/tests/components/vodafone_station/test_config_flow.py +++ b/tests/components/vodafone_station/test_config_flow.py @@ -78,7 +78,7 @@ async def test_exception_connection(hass: HomeAssistant, side_effect, error) -> # Should be recoverable after hits error with patch( - "homeassistant.components.vodafone_station.config_flow.VodafoneStationApi.get_all_devices", + "homeassistant.components.vodafone_station.config_flow.VodafoneStationApi.get_devices_data", return_value={ "wifi_user": "on|laptop|device-1|xx:xx:xx:xx:xx:xx|192.168.100.1||2.4G", "ethernet": "laptop|device-2|yy:yy:yy:yy:yy:yy|192.168.100.2|;", @@ -191,7 +191,7 @@ async def test_reauth_not_successful(hass: HomeAssistant, side_effect, error) -> # Should be recoverable after hits error with patch( - "homeassistant.components.vodafone_station.config_flow.VodafoneStationApi.get_all_devices", + "homeassistant.components.vodafone_station.config_flow.VodafoneStationApi.get_devices_data", return_value={ "wifi_user": "on|laptop|device-1|xx:xx:xx:xx:xx:xx|192.168.100.1||2.4G", "ethernet": "laptop|device-2|yy:yy:yy:yy:yy:yy|192.168.100.2|;", From cadf56c98983452877268aa72f73d70b550ecf34 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 6 Sep 2023 13:21:21 -0500 Subject: [PATCH 18/35] Bump dbus-fast to 1.95.0 (#99749) --- homeassistant/components/bluetooth/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/bluetooth/manifest.json b/homeassistant/components/bluetooth/manifest.json index e1a5ee41324..bcb371971a6 100644 --- a/homeassistant/components/bluetooth/manifest.json +++ b/homeassistant/components/bluetooth/manifest.json @@ -19,6 +19,6 @@ "bluetooth-adapters==0.16.0", "bluetooth-auto-recovery==1.2.1", "bluetooth-data-tools==1.11.0", - "dbus-fast==1.94.1" + "dbus-fast==1.95.0" ] } diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 7c48166172f..1e18d99a890 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -16,7 +16,7 @@ bluetooth-data-tools==1.11.0 certifi>=2021.5.30 ciso8601==2.3.0 cryptography==41.0.3 -dbus-fast==1.94.1 +dbus-fast==1.95.0 fnv-hash-fast==0.4.1 ha-av==10.1.1 hass-nabucasa==0.70.0 diff --git a/requirements_all.txt b/requirements_all.txt index 026caea7f8e..9928c2e3ebe 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -641,7 +641,7 @@ datadog==0.15.0 datapoint==0.9.8 # homeassistant.components.bluetooth -dbus-fast==1.94.1 +dbus-fast==1.95.0 # homeassistant.components.debugpy debugpy==1.6.7 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 6953dfd0de5..8fd79ba6347 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -521,7 +521,7 @@ datadog==0.15.0 datapoint==0.9.8 # homeassistant.components.bluetooth -dbus-fast==1.94.1 +dbus-fast==1.95.0 # homeassistant.components.debugpy debugpy==1.6.7 From 02b6bbdcc696805f794d70452e2fa6f2427addfb Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 7 Sep 2023 13:27:29 -0500 Subject: [PATCH 19/35] Bump dbus-fast to 1.95.2 (#99852) --- homeassistant/components/bluetooth/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/bluetooth/manifest.json b/homeassistant/components/bluetooth/manifest.json index bcb371971a6..4231e03c2ef 100644 --- a/homeassistant/components/bluetooth/manifest.json +++ b/homeassistant/components/bluetooth/manifest.json @@ -19,6 +19,6 @@ "bluetooth-adapters==0.16.0", "bluetooth-auto-recovery==1.2.1", "bluetooth-data-tools==1.11.0", - "dbus-fast==1.95.0" + "dbus-fast==1.95.2" ] } diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 1e18d99a890..25e9c20c0d8 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -16,7 +16,7 @@ bluetooth-data-tools==1.11.0 certifi>=2021.5.30 ciso8601==2.3.0 cryptography==41.0.3 -dbus-fast==1.95.0 +dbus-fast==1.95.2 fnv-hash-fast==0.4.1 ha-av==10.1.1 hass-nabucasa==0.70.0 diff --git a/requirements_all.txt b/requirements_all.txt index 9928c2e3ebe..867d7fa74d0 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -641,7 +641,7 @@ datadog==0.15.0 datapoint==0.9.8 # homeassistant.components.bluetooth -dbus-fast==1.95.0 +dbus-fast==1.95.2 # homeassistant.components.debugpy debugpy==1.6.7 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 8fd79ba6347..514385544b2 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -521,7 +521,7 @@ datadog==0.15.0 datapoint==0.9.8 # homeassistant.components.bluetooth -dbus-fast==1.95.0 +dbus-fast==1.95.2 # homeassistant.components.debugpy debugpy==1.6.7 From dccccda5025b596488be0eb79442551a45e93e2b Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Thu, 7 Sep 2023 13:22:24 -0400 Subject: [PATCH 20/35] Bump ZHA dependencies (#99855) --- homeassistant/components/zha/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/zha/manifest.json b/homeassistant/components/zha/manifest.json index 7352487a318..cce223fac11 100644 --- a/homeassistant/components/zha/manifest.json +++ b/homeassistant/components/zha/manifest.json @@ -21,7 +21,7 @@ "universal_silabs_flasher" ], "requirements": [ - "bellows==0.36.2", + "bellows==0.36.3", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.103", diff --git a/requirements_all.txt b/requirements_all.txt index 867d7fa74d0..b3e74520957 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -509,7 +509,7 @@ beautifulsoup4==4.12.2 # beewi-smartclim==0.0.10 # homeassistant.components.zha -bellows==0.36.2 +bellows==0.36.3 # homeassistant.components.bmw_connected_drive bimmer-connected==0.14.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 514385544b2..5552d6fe132 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -430,7 +430,7 @@ base36==0.1.1 beautifulsoup4==4.12.2 # homeassistant.components.zha -bellows==0.36.2 +bellows==0.36.3 # homeassistant.components.bmw_connected_drive bimmer-connected==0.14.0 From 110a17ad6d74c26e01efb21d277cf3eb4f077072 Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Thu, 7 Sep 2023 21:49:03 +0200 Subject: [PATCH 21/35] Fix NOAA tides warnings (#99856) --- homeassistant/components/noaa_tides/sensor.py | 49 ++++++++++++++----- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/noaa_tides/sensor.py b/homeassistant/components/noaa_tides/sensor.py index 7f3260c7635..a83f18fd6ca 100644 --- a/homeassistant/components/noaa_tides/sensor.py +++ b/homeassistant/components/noaa_tides/sensor.py @@ -3,6 +3,7 @@ from __future__ import annotations from datetime import datetime, timedelta import logging +from typing import TYPE_CHECKING, Any, Literal, TypedDict import noaa_coops as coops import requests @@ -17,6 +18,9 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.util.unit_system import METRIC_SYSTEM +if TYPE_CHECKING: + from pandas import Timestamp + _LOGGER = logging.getLogger(__name__) CONF_STATION_ID = "station_id" @@ -76,40 +80,56 @@ def setup_platform( add_entities([noaa_sensor], True) +class NOAATidesData(TypedDict): + """Representation of a single tide.""" + + time_stamp: list[Timestamp] + hi_lo: list[Literal["L"] | Literal["H"]] + predicted_wl: list[float] + + class NOAATidesAndCurrentsSensor(SensorEntity): """Representation of a NOAA Tides and Currents sensor.""" _attr_attribution = "Data provided by NOAA" - def __init__(self, name, station_id, timezone, unit_system, station): + def __init__(self, name, station_id, timezone, unit_system, station) -> None: """Initialize the sensor.""" self._name = name self._station_id = station_id self._timezone = timezone self._unit_system = unit_system self._station = station - self.data = None + self.data: NOAATidesData | None = None @property - def name(self): + def name(self) -> str: """Return the name of the sensor.""" return self._name @property - def extra_state_attributes(self): + def extra_state_attributes(self) -> dict[str, Any]: """Return the state attributes of this device.""" - attr = {} + attr: dict[str, Any] = {} if self.data is None: return attr if self.data["hi_lo"][1] == "H": - attr["high_tide_time"] = self.data.index[1].strftime("%Y-%m-%dT%H:%M") + attr["high_tide_time"] = self.data["time_stamp"][1].strftime( + "%Y-%m-%dT%H:%M" + ) attr["high_tide_height"] = self.data["predicted_wl"][1] - attr["low_tide_time"] = self.data.index[2].strftime("%Y-%m-%dT%H:%M") + attr["low_tide_time"] = self.data["time_stamp"][2].strftime( + "%Y-%m-%dT%H:%M" + ) attr["low_tide_height"] = self.data["predicted_wl"][2] elif self.data["hi_lo"][1] == "L": - attr["low_tide_time"] = self.data.index[1].strftime("%Y-%m-%dT%H:%M") + attr["low_tide_time"] = self.data["time_stamp"][1].strftime( + "%Y-%m-%dT%H:%M" + ) attr["low_tide_height"] = self.data["predicted_wl"][1] - attr["high_tide_time"] = self.data.index[2].strftime("%Y-%m-%dT%H:%M") + attr["high_tide_time"] = self.data["time_stamp"][2].strftime( + "%Y-%m-%dT%H:%M" + ) attr["high_tide_height"] = self.data["predicted_wl"][2] return attr @@ -118,7 +138,7 @@ class NOAATidesAndCurrentsSensor(SensorEntity): """Return the state of the device.""" if self.data is None: return None - api_time = self.data.index[0] + api_time = self.data["time_stamp"][0] if self.data["hi_lo"][0] == "H": tidetime = api_time.strftime("%-I:%M %p") return f"High tide at {tidetime}" @@ -142,8 +162,13 @@ class NOAATidesAndCurrentsSensor(SensorEntity): units=self._unit_system, time_zone=self._timezone, ) - self.data = df_predictions.head() - _LOGGER.debug("Data = %s", self.data) + api_data = df_predictions.head() + self.data = NOAATidesData( + time_stamp=list(api_data.index), + hi_lo=list(api_data["hi_lo"].values), + predicted_wl=list(api_data["predicted_wl"].values), + ) + _LOGGER.debug("Data = %s", api_data) _LOGGER.debug( "Recent Tide data queried with start time set to %s", begin.strftime("%m-%d-%Y %H:%M"), From 330e527560927e360c0c9c5f032b250e47820c97 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 8 Sep 2023 06:25:25 -0500 Subject: [PATCH 22/35] Upgrade bluetooth deps to fix timeout behavior on py3.11 (#99879) --- homeassistant/components/bluetooth/manifest.json | 6 +++--- homeassistant/package_constraints.txt | 6 +++--- requirements_all.txt | 6 +++--- requirements_test_all.txt | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/bluetooth/manifest.json b/homeassistant/components/bluetooth/manifest.json index 4231e03c2ef..a3c40f739aa 100644 --- a/homeassistant/components/bluetooth/manifest.json +++ b/homeassistant/components/bluetooth/manifest.json @@ -15,9 +15,9 @@ "quality_scale": "internal", "requirements": [ "bleak==0.21.0", - "bleak-retry-connector==3.1.2", - "bluetooth-adapters==0.16.0", - "bluetooth-auto-recovery==1.2.1", + "bleak-retry-connector==3.1.3", + "bluetooth-adapters==0.16.1", + "bluetooth-auto-recovery==1.2.2", "bluetooth-data-tools==1.11.0", "dbus-fast==1.95.2" ] diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 25e9c20c0d8..27818898990 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -8,10 +8,10 @@ atomicwrites-homeassistant==1.4.1 attrs==23.1.0 awesomeversion==22.9.0 bcrypt==4.0.1 -bleak-retry-connector==3.1.2 +bleak-retry-connector==3.1.3 bleak==0.21.0 -bluetooth-adapters==0.16.0 -bluetooth-auto-recovery==1.2.1 +bluetooth-adapters==0.16.1 +bluetooth-auto-recovery==1.2.2 bluetooth-data-tools==1.11.0 certifi>=2021.5.30 ciso8601==2.3.0 diff --git a/requirements_all.txt b/requirements_all.txt index b3e74520957..51232296a15 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -518,7 +518,7 @@ bimmer-connected==0.14.0 bizkaibus==0.1.1 # homeassistant.components.bluetooth -bleak-retry-connector==3.1.2 +bleak-retry-connector==3.1.3 # homeassistant.components.bluetooth bleak==0.21.0 @@ -540,10 +540,10 @@ bluemaestro-ble==0.2.3 # bluepy==1.3.0 # homeassistant.components.bluetooth -bluetooth-adapters==0.16.0 +bluetooth-adapters==0.16.1 # homeassistant.components.bluetooth -bluetooth-auto-recovery==1.2.1 +bluetooth-auto-recovery==1.2.2 # homeassistant.components.bluetooth # homeassistant.components.esphome diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 5552d6fe132..5f54e05315a 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -436,7 +436,7 @@ bellows==0.36.3 bimmer-connected==0.14.0 # homeassistant.components.bluetooth -bleak-retry-connector==3.1.2 +bleak-retry-connector==3.1.3 # homeassistant.components.bluetooth bleak==0.21.0 @@ -451,10 +451,10 @@ blinkpy==0.21.0 bluemaestro-ble==0.2.3 # homeassistant.components.bluetooth -bluetooth-adapters==0.16.0 +bluetooth-adapters==0.16.1 # homeassistant.components.bluetooth -bluetooth-auto-recovery==1.2.1 +bluetooth-auto-recovery==1.2.2 # homeassistant.components.bluetooth # homeassistant.components.esphome From fed061f69cf36ec2a46c1b56429d1bf4f229aac6 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Fri, 8 Sep 2023 18:59:08 +0200 Subject: [PATCH 23/35] Update frontend to 20230908.0 (#99939) --- homeassistant/components/frontend/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/frontend/manifest.json b/homeassistant/components/frontend/manifest.json index 50c557eae89..58de25fc03d 100644 --- a/homeassistant/components/frontend/manifest.json +++ b/homeassistant/components/frontend/manifest.json @@ -20,5 +20,5 @@ "documentation": "https://www.home-assistant.io/integrations/frontend", "integration_type": "system", "quality_scale": "internal", - "requirements": ["home-assistant-frontend==20230906.1"] + "requirements": ["home-assistant-frontend==20230908.0"] } diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 27818898990..e1aeaeb5c20 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -22,7 +22,7 @@ ha-av==10.1.1 hass-nabucasa==0.70.0 hassil==1.2.5 home-assistant-bluetooth==1.10.3 -home-assistant-frontend==20230906.1 +home-assistant-frontend==20230908.0 home-assistant-intents==2023.8.2 httpx==0.24.1 ifaddr==0.2.0 diff --git a/requirements_all.txt b/requirements_all.txt index 51232296a15..598f3bf396b 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -994,7 +994,7 @@ hole==0.8.0 holidays==0.28 # homeassistant.components.frontend -home-assistant-frontend==20230906.1 +home-assistant-frontend==20230908.0 # homeassistant.components.conversation home-assistant-intents==2023.8.2 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 5f54e05315a..f9a62ee593b 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -777,7 +777,7 @@ hole==0.8.0 holidays==0.28 # homeassistant.components.frontend -home-assistant-frontend==20230906.1 +home-assistant-frontend==20230908.0 # homeassistant.components.conversation home-assistant-intents==2023.8.2 From 50c34ab41981f1569735482d6102b0c86a763bb1 Mon Sep 17 00:00:00 2001 From: jan iversen Date: Wed, 30 Aug 2023 20:26:13 +0200 Subject: [PATCH 24/35] Bump pymodbus v3.5.0 (#99343) Bump pymodbus v3.5.0. --- homeassistant/components/modbus/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/modbus/manifest.json b/homeassistant/components/modbus/manifest.json index d0d573227d8..a4187de77eb 100644 --- a/homeassistant/components/modbus/manifest.json +++ b/homeassistant/components/modbus/manifest.json @@ -6,5 +6,5 @@ "iot_class": "local_polling", "loggers": ["pymodbus"], "quality_scale": "gold", - "requirements": ["pymodbus==3.4.1"] + "requirements": ["pymodbus==3.5.0"] } diff --git a/requirements_all.txt b/requirements_all.txt index 598f3bf396b..e50cdb37af3 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1851,7 +1851,7 @@ pymitv==1.4.3 pymochad==0.2.0 # homeassistant.components.modbus -pymodbus==3.4.1 +pymodbus==3.5.0 # homeassistant.components.monoprice pymonoprice==0.4 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index f9a62ee593b..b7b227fc1c0 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1370,7 +1370,7 @@ pymeteoclimatic==0.0.6 pymochad==0.2.0 # homeassistant.components.modbus -pymodbus==3.4.1 +pymodbus==3.5.0 # homeassistant.components.monoprice pymonoprice==0.4 From 0e4bf58736f2e891d401d65e0ef9721be1ac9b72 Mon Sep 17 00:00:00 2001 From: jan iversen Date: Fri, 8 Sep 2023 19:20:06 +0200 Subject: [PATCH 25/35] Bump pymodbus v.3.5.1 (#99940) --- homeassistant/components/modbus/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/modbus/manifest.json b/homeassistant/components/modbus/manifest.json index a4187de77eb..bef85f1d20d 100644 --- a/homeassistant/components/modbus/manifest.json +++ b/homeassistant/components/modbus/manifest.json @@ -6,5 +6,5 @@ "iot_class": "local_polling", "loggers": ["pymodbus"], "quality_scale": "gold", - "requirements": ["pymodbus==3.5.0"] + "requirements": ["pymodbus==3.5.1"] } diff --git a/requirements_all.txt b/requirements_all.txt index e50cdb37af3..6fd67a64038 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1851,7 +1851,7 @@ pymitv==1.4.3 pymochad==0.2.0 # homeassistant.components.modbus -pymodbus==3.5.0 +pymodbus==3.5.1 # homeassistant.components.monoprice pymonoprice==0.4 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index b7b227fc1c0..cc9eeaa2b77 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1370,7 +1370,7 @@ pymeteoclimatic==0.0.6 pymochad==0.2.0 # homeassistant.components.modbus -pymodbus==3.5.0 +pymodbus==3.5.1 # homeassistant.components.monoprice pymonoprice==0.4 From f1bae7d37bbaea8afa4edc902b2535ec267ad021 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Fri, 8 Sep 2023 19:08:32 +0200 Subject: [PATCH 26/35] Bump pyenphase to v1.11.0 (#99941) --- homeassistant/components/enphase_envoy/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/enphase_envoy/manifest.json b/homeassistant/components/enphase_envoy/manifest.json index d3a36b16b60..c6d127a3f6e 100644 --- a/homeassistant/components/enphase_envoy/manifest.json +++ b/homeassistant/components/enphase_envoy/manifest.json @@ -6,7 +6,7 @@ "documentation": "https://www.home-assistant.io/integrations/enphase_envoy", "iot_class": "local_polling", "loggers": ["pyenphase"], - "requirements": ["pyenphase==1.9.3"], + "requirements": ["pyenphase==1.11.0"], "zeroconf": [ { "type": "_enphase-envoy._tcp.local." diff --git a/requirements_all.txt b/requirements_all.txt index 6fd67a64038..b7789648b8f 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1671,7 +1671,7 @@ pyedimax==0.2.1 pyefergy==22.1.1 # homeassistant.components.enphase_envoy -pyenphase==1.9.3 +pyenphase==1.11.0 # homeassistant.components.envisalink pyenvisalink==4.6 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index cc9eeaa2b77..b68ea0b6144 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1235,7 +1235,7 @@ pyeconet==0.1.20 pyefergy==22.1.1 # homeassistant.components.enphase_envoy -pyenphase==1.9.3 +pyenphase==1.11.0 # homeassistant.components.everlights pyeverlights==0.1.0 From 06109d22fd16aac13ae39256b52eafc7133de0ae Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Fri, 8 Sep 2023 19:10:17 +0200 Subject: [PATCH 27/35] Fix key error MQTT binary_sensor when no name is set (#99943) Log entitty ID when instead of name --- homeassistant/components/mqtt/binary_sensor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/mqtt/binary_sensor.py b/homeassistant/components/mqtt/binary_sensor.py index 0d4b2c4a7b4..83bca91f4e1 100644 --- a/homeassistant/components/mqtt/binary_sensor.py +++ b/homeassistant/components/mqtt/binary_sensor.py @@ -215,7 +215,7 @@ class MqttBinarySensor(MqttEntity, BinarySensorEntity, RestoreEntity): "Empty template output for entity: %s with state topic: %s." " Payload: '%s', with value template '%s'" ), - self._config[CONF_NAME], + self.entity_id, self._config[CONF_STATE_TOPIC], msg.payload, self._config.get(CONF_VALUE_TEMPLATE), @@ -240,7 +240,7 @@ class MqttBinarySensor(MqttEntity, BinarySensorEntity, RestoreEntity): "No matching payload found for entity: %s with state topic: %s." " Payload: '%s'%s" ), - self._config[CONF_NAME], + self.entity_id, self._config[CONF_STATE_TOPIC], msg.payload, template_info, From 55533350d2a76e890b95a98de59eac9ec562b093 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 3 Sep 2023 04:16:26 -0500 Subject: [PATCH 28/35] Bump zeroconf to 0.93.1 (#99516) * Bump zeroconf to 0.92.0 changelog: https://github.com/python-zeroconf/python-zeroconf/compare/0.91.1...0.92.0 * drop unused argument * Update tests/components/thread/test_diagnostics.py * lint * again * bump again since actions failed to release the wheels --- .../components/zeroconf/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/thread/test_diagnostics.py | 44 +++++++++---------- 5 files changed, 25 insertions(+), 27 deletions(-) diff --git a/homeassistant/components/zeroconf/manifest.json b/homeassistant/components/zeroconf/manifest.json index 26577bd0bbe..718f3047a07 100644 --- a/homeassistant/components/zeroconf/manifest.json +++ b/homeassistant/components/zeroconf/manifest.json @@ -8,5 +8,5 @@ "iot_class": "local_push", "loggers": ["zeroconf"], "quality_scale": "internal", - "requirements": ["zeroconf==0.91.1"] + "requirements": ["zeroconf==0.93.1"] } diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index e1aeaeb5c20..726227381df 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -53,7 +53,7 @@ voluptuous-serialize==2.6.0 voluptuous==0.13.1 webrtcvad==2.0.10 yarl==1.9.2 -zeroconf==0.91.1 +zeroconf==0.93.1 # Constrain pycryptodome to avoid vulnerability # see https://github.com/home-assistant/core/pull/16238 diff --git a/requirements_all.txt b/requirements_all.txt index b7789648b8f..1ed53d0b136 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2766,7 +2766,7 @@ zamg==0.3.0 zengge==0.2 # homeassistant.components.zeroconf -zeroconf==0.91.1 +zeroconf==0.93.1 # homeassistant.components.zeversolar zeversolar==0.3.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index b68ea0b6144..a4e6630b76c 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -2036,7 +2036,7 @@ youtubeaio==1.1.5 zamg==0.3.0 # homeassistant.components.zeroconf -zeroconf==0.91.1 +zeroconf==0.93.1 # homeassistant.components.zeversolar zeversolar==0.3.1 diff --git a/tests/components/thread/test_diagnostics.py b/tests/components/thread/test_diagnostics.py index 94ca4373715..15ab0750316 100644 --- a/tests/components/thread/test_diagnostics.py +++ b/tests/components/thread/test_diagnostics.py @@ -1,7 +1,6 @@ """Test the thread websocket API.""" import dataclasses -import time from unittest.mock import Mock, patch import pytest @@ -191,50 +190,49 @@ async def test_diagnostics( """Test diagnostics for thread routers.""" cache = mock_async_zeroconf.zeroconf.cache = DNSCache() - now = time.monotonic() * 1000 cache.async_add_records( [ - *TEST_ZEROCONF_RECORD_1.dns_addresses(created=now), - TEST_ZEROCONF_RECORD_1.dns_service(created=now), - TEST_ZEROCONF_RECORD_1.dns_text(created=now), - TEST_ZEROCONF_RECORD_1.dns_pointer(created=now), + *TEST_ZEROCONF_RECORD_1.dns_addresses(), + TEST_ZEROCONF_RECORD_1.dns_service(), + TEST_ZEROCONF_RECORD_1.dns_text(), + TEST_ZEROCONF_RECORD_1.dns_pointer(), ] ) cache.async_add_records( [ - *TEST_ZEROCONF_RECORD_2.dns_addresses(created=now), - TEST_ZEROCONF_RECORD_2.dns_service(created=now), - TEST_ZEROCONF_RECORD_2.dns_text(created=now), - TEST_ZEROCONF_RECORD_2.dns_pointer(created=now), + *TEST_ZEROCONF_RECORD_2.dns_addresses(), + TEST_ZEROCONF_RECORD_2.dns_service(), + TEST_ZEROCONF_RECORD_2.dns_text(), + TEST_ZEROCONF_RECORD_2.dns_pointer(), ] ) # Test for invalid cache - cache.async_add_records([TEST_ZEROCONF_RECORD_3.dns_pointer(created=now)]) + cache.async_add_records([TEST_ZEROCONF_RECORD_3.dns_pointer()]) # Test for invalid record cache.async_add_records( [ - *TEST_ZEROCONF_RECORD_4.dns_addresses(created=now), - TEST_ZEROCONF_RECORD_4.dns_service(created=now), - TEST_ZEROCONF_RECORD_4.dns_text(created=now), - TEST_ZEROCONF_RECORD_4.dns_pointer(created=now), + *TEST_ZEROCONF_RECORD_4.dns_addresses(), + TEST_ZEROCONF_RECORD_4.dns_service(), + TEST_ZEROCONF_RECORD_4.dns_text(), + TEST_ZEROCONF_RECORD_4.dns_pointer(), ] ) # Test for record without xa cache.async_add_records( [ - *TEST_ZEROCONF_RECORD_5.dns_addresses(created=now), - TEST_ZEROCONF_RECORD_5.dns_service(created=now), - TEST_ZEROCONF_RECORD_5.dns_text(created=now), - TEST_ZEROCONF_RECORD_5.dns_pointer(created=now), + *TEST_ZEROCONF_RECORD_5.dns_addresses(), + TEST_ZEROCONF_RECORD_5.dns_service(), + TEST_ZEROCONF_RECORD_5.dns_text(), + TEST_ZEROCONF_RECORD_5.dns_pointer(), ] ) # Test for record without xp cache.async_add_records( [ - *TEST_ZEROCONF_RECORD_6.dns_addresses(created=now), - TEST_ZEROCONF_RECORD_6.dns_service(created=now), - TEST_ZEROCONF_RECORD_6.dns_text(created=now), - TEST_ZEROCONF_RECORD_6.dns_pointer(created=now), + *TEST_ZEROCONF_RECORD_6.dns_addresses(), + TEST_ZEROCONF_RECORD_6.dns_service(), + TEST_ZEROCONF_RECORD_6.dns_text(), + TEST_ZEROCONF_RECORD_6.dns_pointer(), ] ) assert await async_setup_component(hass, DOMAIN, {}) From c1447d5ce47188fedb8649199e5f83bfd8729e4a Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 3 Sep 2023 17:06:21 -0500 Subject: [PATCH 29/35] Bump zeroconf to 0.96.0 (#99549) --- homeassistant/components/zeroconf/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/zeroconf/manifest.json b/homeassistant/components/zeroconf/manifest.json index 718f3047a07..53b0dd5f5b5 100644 --- a/homeassistant/components/zeroconf/manifest.json +++ b/homeassistant/components/zeroconf/manifest.json @@ -8,5 +8,5 @@ "iot_class": "local_push", "loggers": ["zeroconf"], "quality_scale": "internal", - "requirements": ["zeroconf==0.93.1"] + "requirements": ["zeroconf==0.96.0"] } diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 726227381df..2b1e73a5900 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -53,7 +53,7 @@ voluptuous-serialize==2.6.0 voluptuous==0.13.1 webrtcvad==2.0.10 yarl==1.9.2 -zeroconf==0.93.1 +zeroconf==0.96.0 # Constrain pycryptodome to avoid vulnerability # see https://github.com/home-assistant/core/pull/16238 diff --git a/requirements_all.txt b/requirements_all.txt index 1ed53d0b136..19a447d43a3 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2766,7 +2766,7 @@ zamg==0.3.0 zengge==0.2 # homeassistant.components.zeroconf -zeroconf==0.93.1 +zeroconf==0.96.0 # homeassistant.components.zeversolar zeversolar==0.3.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index a4e6630b76c..615a305e50a 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -2036,7 +2036,7 @@ youtubeaio==1.1.5 zamg==0.3.0 # homeassistant.components.zeroconf -zeroconf==0.93.1 +zeroconf==0.96.0 # homeassistant.components.zeversolar zeversolar==0.3.1 From 7ded08464f7074f30ec4e0b0066ca5147ffa9d22 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 4 Sep 2023 02:52:21 -0500 Subject: [PATCH 30/35] Bump zeroconf to 0.97.0 (#99554) changelog: https://github.com/python-zeroconf/python-zeroconf/compare/0.96.0...0.97.0 --- homeassistant/components/zeroconf/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/zeroconf/manifest.json b/homeassistant/components/zeroconf/manifest.json index 53b0dd5f5b5..4969b2a5a65 100644 --- a/homeassistant/components/zeroconf/manifest.json +++ b/homeassistant/components/zeroconf/manifest.json @@ -8,5 +8,5 @@ "iot_class": "local_push", "loggers": ["zeroconf"], "quality_scale": "internal", - "requirements": ["zeroconf==0.96.0"] + "requirements": ["zeroconf==0.97.0"] } diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 2b1e73a5900..84c6eba445f 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -53,7 +53,7 @@ voluptuous-serialize==2.6.0 voluptuous==0.13.1 webrtcvad==2.0.10 yarl==1.9.2 -zeroconf==0.96.0 +zeroconf==0.97.0 # Constrain pycryptodome to avoid vulnerability # see https://github.com/home-assistant/core/pull/16238 diff --git a/requirements_all.txt b/requirements_all.txt index 19a447d43a3..8da4c2d662c 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2766,7 +2766,7 @@ zamg==0.3.0 zengge==0.2 # homeassistant.components.zeroconf -zeroconf==0.96.0 +zeroconf==0.97.0 # homeassistant.components.zeversolar zeversolar==0.3.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 615a305e50a..45e04e054b1 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -2036,7 +2036,7 @@ youtubeaio==1.1.5 zamg==0.3.0 # homeassistant.components.zeroconf -zeroconf==0.96.0 +zeroconf==0.97.0 # homeassistant.components.zeversolar zeversolar==0.3.1 From 19c2bbcd939e966350d1586cb7df49fba9790031 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 6 Sep 2023 12:37:42 -0500 Subject: [PATCH 31/35] Bump zeroconf to 0.98.0 (#99748) --- homeassistant/components/zeroconf/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/zeroconf/manifest.json b/homeassistant/components/zeroconf/manifest.json index 4969b2a5a65..117744a2775 100644 --- a/homeassistant/components/zeroconf/manifest.json +++ b/homeassistant/components/zeroconf/manifest.json @@ -8,5 +8,5 @@ "iot_class": "local_push", "loggers": ["zeroconf"], "quality_scale": "internal", - "requirements": ["zeroconf==0.97.0"] + "requirements": ["zeroconf==0.98.0"] } diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 84c6eba445f..d03dc72863d 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -53,7 +53,7 @@ voluptuous-serialize==2.6.0 voluptuous==0.13.1 webrtcvad==2.0.10 yarl==1.9.2 -zeroconf==0.97.0 +zeroconf==0.98.0 # Constrain pycryptodome to avoid vulnerability # see https://github.com/home-assistant/core/pull/16238 diff --git a/requirements_all.txt b/requirements_all.txt index 8da4c2d662c..cc51a8e0497 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2766,7 +2766,7 @@ zamg==0.3.0 zengge==0.2 # homeassistant.components.zeroconf -zeroconf==0.97.0 +zeroconf==0.98.0 # homeassistant.components.zeversolar zeversolar==0.3.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 45e04e054b1..07c7c2a7ba7 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -2036,7 +2036,7 @@ youtubeaio==1.1.5 zamg==0.3.0 # homeassistant.components.zeroconf -zeroconf==0.97.0 +zeroconf==0.98.0 # homeassistant.components.zeversolar zeversolar==0.3.1 From f753f5af6ee96dbb5b59338605580590b462ace9 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Fri, 8 Sep 2023 21:02:06 +0200 Subject: [PATCH 32/35] Make WS command render_template not give up if initial render raises (#99808) --- .../components/websocket_api/commands.py | 6 +- homeassistant/helpers/event.py | 11 +- .../components/websocket_api/test_commands.py | 317 +++++++++++++++--- tests/helpers/test_event.py | 21 -- 4 files changed, 281 insertions(+), 74 deletions(-) diff --git a/homeassistant/components/websocket_api/commands.py b/homeassistant/components/websocket_api/commands.py index a05f2aa8e3f..ea21b7b5eba 100644 --- a/homeassistant/components/websocket_api/commands.py +++ b/homeassistant/components/websocket_api/commands.py @@ -542,9 +542,8 @@ async def handle_render_template( timed_out = await template_obj.async_render_will_timeout( timeout, variables, strict=msg["strict"], log_fn=log_fn ) - except TemplateError as ex: - connection.send_error(msg["id"], const.ERR_TEMPLATE_ERROR, str(ex)) - return + except TemplateError: + timed_out = False if timed_out: connection.send_error( @@ -583,7 +582,6 @@ async def handle_render_template( hass, [TrackTemplate(template_obj, variables)], _template_listener, - raise_on_template_error=True, strict=msg["strict"], log_fn=log_fn, ) diff --git a/homeassistant/helpers/event.py b/homeassistant/helpers/event.py index 51a8f1f1982..40364b7b367 100644 --- a/homeassistant/helpers/event.py +++ b/homeassistant/helpers/event.py @@ -917,7 +917,6 @@ class TrackTemplateResultInfo: def async_setup( self, - raise_on_template_error: bool, strict: bool = False, log_fn: Callable[[int, str], None] | None = None, ) -> None: @@ -955,8 +954,6 @@ class TrackTemplateResultInfo: ) if info.exception: - if raise_on_template_error: - raise info.exception if not log_fn: _LOGGER.error( "Error while processing template: %s", @@ -1239,7 +1236,6 @@ def async_track_template_result( hass: HomeAssistant, track_templates: Sequence[TrackTemplate], action: TrackTemplateResultListener, - raise_on_template_error: bool = False, strict: bool = False, log_fn: Callable[[int, str], None] | None = None, has_super_template: bool = False, @@ -1266,11 +1262,6 @@ def async_track_template_result( An iterable of TrackTemplate. action Callable to call with results. - raise_on_template_error - When set to True, if there is an exception - processing the template during setup, the system - will raise the exception instead of setting up - tracking. strict When set to True, raise on undefined variables. log_fn @@ -1286,7 +1277,7 @@ def async_track_template_result( """ tracker = TrackTemplateResultInfo(hass, track_templates, action, has_super_template) - tracker.async_setup(raise_on_template_error, strict=strict, log_fn=log_fn) + tracker.async_setup(strict=strict, log_fn=log_fn) return tracker diff --git a/tests/components/websocket_api/test_commands.py b/tests/components/websocket_api/test_commands.py index 70f08477a72..b1b2027c65d 100644 --- a/tests/components/websocket_api/test_commands.py +++ b/tests/components/websocket_api/test_commands.py @@ -1234,27 +1234,27 @@ EMPTY_LISTENERS = {"all": False, "entities": [], "domains": [], "time": False} ERR_MSG = {"type": "result", "success": False} -VARIABLE_ERROR_UNDEFINED_FUNC = { +EVENT_UNDEFINED_FUNC_1 = { "error": "'my_unknown_func' is undefined", "level": "ERROR", } -TEMPLATE_ERROR_UNDEFINED_FUNC = { - "code": "template_error", - "message": "UndefinedError: 'my_unknown_func' is undefined", +EVENT_UNDEFINED_FUNC_2 = { + "error": "UndefinedError: 'my_unknown_func' is undefined", + "level": "ERROR", } -VARIABLE_WARNING_UNDEFINED_VAR = { +EVENT_UNDEFINED_VAR_WARN = { "error": "'my_unknown_var' is undefined", "level": "WARNING", } -TEMPLATE_ERROR_UNDEFINED_VAR = { - "code": "template_error", - "message": "UndefinedError: 'my_unknown_var' is undefined", +EVENT_UNDEFINED_VAR_ERR = { + "error": "UndefinedError: 'my_unknown_var' is undefined", + "level": "ERROR", } -TEMPLATE_ERROR_UNDEFINED_FILTER = { - "code": "template_error", - "message": "TemplateAssertionError: No filter named 'unknown_filter'.", +EVENT_UNDEFINED_FILTER = { + "error": "TemplateAssertionError: No filter named 'unknown_filter'.", + "level": "ERROR", } @@ -1264,16 +1264,19 @@ TEMPLATE_ERROR_UNDEFINED_FILTER = { ( "{{ my_unknown_func() + 1 }}", [ - {"type": "event", "event": VARIABLE_ERROR_UNDEFINED_FUNC}, - ERR_MSG | {"error": TEMPLATE_ERROR_UNDEFINED_FUNC}, + {"type": "event", "event": EVENT_UNDEFINED_FUNC_1}, + {"type": "event", "event": EVENT_UNDEFINED_FUNC_2}, + {"type": "result", "success": True, "result": None}, + {"type": "event", "event": EVENT_UNDEFINED_FUNC_1}, + {"type": "event", "event": EVENT_UNDEFINED_FUNC_2}, ], ), ( "{{ my_unknown_var }}", [ - {"type": "event", "event": VARIABLE_WARNING_UNDEFINED_VAR}, + {"type": "event", "event": EVENT_UNDEFINED_VAR_WARN}, {"type": "result", "success": True, "result": None}, - {"type": "event", "event": VARIABLE_WARNING_UNDEFINED_VAR}, + {"type": "event", "event": EVENT_UNDEFINED_VAR_WARN}, { "type": "event", "event": {"result": "", "listeners": EMPTY_LISTENERS}, @@ -1282,11 +1285,19 @@ TEMPLATE_ERROR_UNDEFINED_FILTER = { ), ( "{{ my_unknown_var + 1 }}", - [ERR_MSG | {"error": TEMPLATE_ERROR_UNDEFINED_VAR}], + [ + {"type": "event", "event": EVENT_UNDEFINED_VAR_ERR}, + {"type": "result", "success": True, "result": None}, + {"type": "event", "event": EVENT_UNDEFINED_VAR_ERR}, + ], ), ( "{{ now() | unknown_filter }}", - [ERR_MSG | {"error": TEMPLATE_ERROR_UNDEFINED_FILTER}], + [ + {"type": "event", "event": EVENT_UNDEFINED_FILTER}, + {"type": "result", "success": True, "result": None}, + {"type": "event", "event": EVENT_UNDEFINED_FILTER}, + ], ), ], ) @@ -1325,16 +1336,20 @@ async def test_render_template_with_error( ( "{{ my_unknown_func() + 1 }}", [ - {"type": "event", "event": VARIABLE_ERROR_UNDEFINED_FUNC}, - ERR_MSG | {"error": TEMPLATE_ERROR_UNDEFINED_FUNC}, + {"type": "event", "event": EVENT_UNDEFINED_FUNC_1}, + {"type": "event", "event": EVENT_UNDEFINED_FUNC_2}, + {"type": "result", "success": True, "result": None}, + {"type": "event", "event": EVENT_UNDEFINED_FUNC_1}, + {"type": "event", "event": EVENT_UNDEFINED_FUNC_2}, + {"type": "event", "event": EVENT_UNDEFINED_FUNC_1}, ], ), ( "{{ my_unknown_var }}", [ - {"type": "event", "event": VARIABLE_WARNING_UNDEFINED_VAR}, + {"type": "event", "event": EVENT_UNDEFINED_VAR_WARN}, {"type": "result", "success": True, "result": None}, - {"type": "event", "event": VARIABLE_WARNING_UNDEFINED_VAR}, + {"type": "event", "event": EVENT_UNDEFINED_VAR_WARN}, { "type": "event", "event": {"result": "", "listeners": EMPTY_LISTENERS}, @@ -1343,11 +1358,19 @@ async def test_render_template_with_error( ), ( "{{ my_unknown_var + 1 }}", - [ERR_MSG | {"error": TEMPLATE_ERROR_UNDEFINED_VAR}], + [ + {"type": "event", "event": EVENT_UNDEFINED_VAR_ERR}, + {"type": "result", "success": True, "result": None}, + {"type": "event", "event": EVENT_UNDEFINED_VAR_ERR}, + ], ), ( "{{ now() | unknown_filter }}", - [ERR_MSG | {"error": TEMPLATE_ERROR_UNDEFINED_FILTER}], + [ + {"type": "event", "event": EVENT_UNDEFINED_FILTER}, + {"type": "result", "success": True, "result": None}, + {"type": "event", "event": EVENT_UNDEFINED_FILTER}, + ], ), ], ) @@ -1386,19 +1409,35 @@ async def test_render_template_with_timeout_and_error( [ ( "{{ my_unknown_func() + 1 }}", - [ERR_MSG | {"error": TEMPLATE_ERROR_UNDEFINED_FUNC}], + [ + {"type": "event", "event": EVENT_UNDEFINED_FUNC_2}, + {"type": "result", "success": True, "result": None}, + {"type": "event", "event": EVENT_UNDEFINED_FUNC_2}, + ], ), ( "{{ my_unknown_var }}", - [ERR_MSG | {"error": TEMPLATE_ERROR_UNDEFINED_VAR}], + [ + {"type": "event", "event": EVENT_UNDEFINED_VAR_ERR}, + {"type": "result", "success": True, "result": None}, + {"type": "event", "event": EVENT_UNDEFINED_VAR_ERR}, + ], ), ( "{{ my_unknown_var + 1 }}", - [ERR_MSG | {"error": TEMPLATE_ERROR_UNDEFINED_VAR}], + [ + {"type": "event", "event": EVENT_UNDEFINED_VAR_ERR}, + {"type": "result", "success": True, "result": None}, + {"type": "event", "event": EVENT_UNDEFINED_VAR_ERR}, + ], ), ( "{{ now() | unknown_filter }}", - [ERR_MSG | {"error": TEMPLATE_ERROR_UNDEFINED_FILTER}], + [ + {"type": "event", "event": EVENT_UNDEFINED_FILTER}, + {"type": "result", "success": True, "result": None}, + {"type": "event", "event": EVENT_UNDEFINED_FILTER}, + ], ), ], ) @@ -1409,7 +1448,73 @@ async def test_render_template_strict_with_timeout_and_error( template: str, expected_events: list[dict[str, str]], ) -> None: - """Test a template with an error with a timeout.""" + """Test a template with an error with a timeout. + + In this test report_errors is enabled. + """ + caplog.set_level(logging.INFO) + await websocket_client.send_json( + { + "id": 5, + "type": "render_template", + "template": template, + "timeout": 5, + "strict": True, + "report_errors": True, + } + ) + + for expected_event in expected_events: + msg = await websocket_client.receive_json() + assert msg["id"] == 5 + for key, value in expected_event.items(): + assert msg[key] == value + + assert "Template variable error" not in caplog.text + assert "Template variable warning" not in caplog.text + assert "TemplateError" not in caplog.text + + +@pytest.mark.parametrize( + ("template", "expected_events"), + [ + ( + "{{ my_unknown_func() + 1 }}", + [ + {"type": "result", "success": True, "result": None}, + ], + ), + ( + "{{ my_unknown_var }}", + [ + {"type": "result", "success": True, "result": None}, + ], + ), + ( + "{{ my_unknown_var + 1 }}", + [ + {"type": "result", "success": True, "result": None}, + ], + ), + ( + "{{ now() | unknown_filter }}", + [ + {"type": "result", "success": True, "result": None}, + ], + ), + ], +) +async def test_render_template_strict_with_timeout_and_error_2( + hass: HomeAssistant, + websocket_client, + caplog: pytest.LogCaptureFixture, + template: str, + expected_events: list[dict[str, str]], +) -> None: + """Test a template with an error with a timeout. + + In this test report_errors is disabled. + """ caplog.set_level(logging.INFO) await websocket_client.send_json( { @@ -1427,30 +1532,164 @@ async def test_render_template_strict_with_timeout_and_error( for key, value in expected_event.items(): assert msg[key] == value - assert "Template variable error" not in caplog.text - assert "Template variable warning" not in caplog.text - assert "TemplateError" not in caplog.text + assert "TemplateError" in caplog.text +@pytest.mark.parametrize( + ("template", "expected_events_1", "expected_events_2"), + [ + ( + "{{ now() | random }}", + [ + { + "type": "event", + "event": { + "error": "TypeError: object of type 'datetime.datetime' has no len()", + "level": "ERROR", + }, + }, + {"type": "result", "success": True, "result": None}, + { + "type": "event", + "event": { + "error": "TypeError: object of type 'datetime.datetime' has no len()", + "level": "ERROR", + }, + }, + ], + [], + ), + ( + "{{ float(states.sensor.foo.state) + 1 }}", + [ + { + "type": "event", + "event": { + "error": "UndefinedError: 'None' has no attribute 'state'", + "level": "ERROR", + }, + }, + {"type": "result", "success": True, "result": None}, + { + "type": "event", + "event": { + "error": "UndefinedError: 'None' has no attribute 'state'", + "level": "ERROR", + }, + }, + ], + [ + { + "type": "event", + "event": { + "result": 3.0, + "listeners": EMPTY_LISTENERS | {"entities": ["sensor.foo"]}, + }, + }, + ], + ), + ], +) async def test_render_template_error_in_template_code( - hass: HomeAssistant, websocket_client, caplog: pytest.LogCaptureFixture + hass: HomeAssistant, + websocket_client, + caplog: pytest.LogCaptureFixture, + template: str, + expected_events_1: list[dict[str, str]], + expected_events_2: list[dict[str, str]], ) -> None: - """Test a template that will throw in template.py.""" + """Test a template that will throw in template.py. + + In this test report_errors is enabled. + """ await websocket_client.send_json( - {"id": 5, "type": "render_template", "template": "{{ now() | random }}"} + { + "id": 5, + "type": "render_template", + "template": template, + "report_errors": True, + } ) - msg = await websocket_client.receive_json() - assert msg["id"] == 5 - assert msg["type"] == const.TYPE_RESULT - assert not msg["success"] - assert msg["error"]["code"] == const.ERR_TEMPLATE_ERROR + for expected_event in expected_events_1: + msg = await websocket_client.receive_json() + assert msg["id"] == 5 + for key, value in expected_event.items(): + assert msg[key] == value + + hass.states.async_set("sensor.foo", "2") + + for expected_event in expected_events_2: + msg = await websocket_client.receive_json() + assert msg["id"] == 5 + for key, value in expected_event.items(): + assert msg[key] == value assert "Template variable error" not in caplog.text assert "Template variable warning" not in caplog.text assert "TemplateError" not in caplog.text +@pytest.mark.parametrize( + ("template", "expected_events_1", "expected_events_2"), + [ + ( + "{{ now() | random }}", + [ + {"type": "result", "success": True, "result": None}, + ], + [], + ), + ( + "{{ float(states.sensor.foo.state) + 1 }}", + [ + {"type": "result", "success": True, "result": None}, + ], + [ + { + "type": "event", + "event": { + "result": 3.0, + "listeners": EMPTY_LISTENERS | {"entities": ["sensor.foo"]}, + }, + }, + ], + ), + ], +) +async def test_render_template_error_in_template_code_2( + hass: HomeAssistant, + websocket_client, + caplog: pytest.LogCaptureFixture, + template: str, + expected_events_1: list[dict[str, str]], + expected_events_2: list[dict[str, str]], +) -> None: + """Test a template that will throw in template.py. + + In this test report_errors is disabled. + """ + await websocket_client.send_json( + {"id": 5, "type": "render_template", "template": template} + ) + + for expected_event in expected_events_1: + msg = await websocket_client.receive_json() + assert msg["id"] == 5 + for key, value in expected_event.items(): + assert msg[key] == value + + hass.states.async_set("sensor.foo", "2") + + for expected_event in expected_events_2: + msg = await websocket_client.receive_json() + assert msg["id"] == 5 + for key, value in expected_event.items(): + assert msg[key] == value + + assert "TemplateError" in caplog.text + + async def test_render_template_with_delayed_error( hass: HomeAssistant, websocket_client, caplog: pytest.LogCaptureFixture ) -> None: diff --git a/tests/helpers/test_event.py b/tests/helpers/test_event.py index dc06b9d94c8..00ad580693e 100644 --- a/tests/helpers/test_event.py +++ b/tests/helpers/test_event.py @@ -3239,27 +3239,6 @@ async def test_async_track_template_result_multiple_templates_mixing_domain( ] -async def test_async_track_template_result_raise_on_template_error( - hass: HomeAssistant, -) -> None: - """Test that we raise as soon as we encounter a failed template.""" - - with pytest.raises(TemplateError): - async_track_template_result( - hass, - [ - TrackTemplate( - Template( - "{{ states.switch | function_that_does_not_exist | list }}" - ), - None, - ), - ], - ha.callback(lambda event, updates: None), - raise_on_template_error=True, - ) - - async def test_track_template_with_time(hass: HomeAssistant) -> None: """Test tracking template with time.""" From ff393f6b86064a680b58de429ea187f92b37e527 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Fri, 8 Sep 2023 21:01:34 +0200 Subject: [PATCH 33/35] Bump hatasmota to 0.7.1 (#99818) --- homeassistant/components/tasmota/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/tasmota/test_sensor.py | 10 ++++++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/tasmota/manifest.json b/homeassistant/components/tasmota/manifest.json index 220bc4e31fb..9843f64fc25 100644 --- a/homeassistant/components/tasmota/manifest.json +++ b/homeassistant/components/tasmota/manifest.json @@ -8,5 +8,5 @@ "iot_class": "local_push", "loggers": ["hatasmota"], "mqtt": ["tasmota/discovery/#"], - "requirements": ["HATasmota==0.7.0"] + "requirements": ["HATasmota==0.7.1"] } diff --git a/requirements_all.txt b/requirements_all.txt index cc51a8e0497..bd1541b0821 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -29,7 +29,7 @@ DoorBirdPy==2.1.0 HAP-python==4.7.1 # homeassistant.components.tasmota -HATasmota==0.7.0 +HATasmota==0.7.1 # homeassistant.components.mastodon Mastodon.py==1.5.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 07c7c2a7ba7..623c45a5946 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -28,7 +28,7 @@ DoorBirdPy==2.1.0 HAP-python==4.7.1 # homeassistant.components.tasmota -HATasmota==0.7.0 +HATasmota==0.7.1 # homeassistant.components.doods # homeassistant.components.generic diff --git a/tests/components/tasmota/test_sensor.py b/tests/components/tasmota/test_sensor.py index 4e79b8ad0d5..c14c7ffe53c 100644 --- a/tests/components/tasmota/test_sensor.py +++ b/tests/components/tasmota/test_sensor.py @@ -626,6 +626,16 @@ async def test_battery_sensor_state_via_mqtt( "unit_of_measurement": "%", } + # Test polled state update + async_fire_mqtt_message( + hass, + "tasmota_49A3BC/stat/STATUS11", + '{"StatusSTS":{"BatteryPercentage":50}}', + ) + await hass.async_block_till_done() + state = hass.states.get("sensor.tasmota_battery_level") + assert state.state == "50" + @pytest.mark.parametrize("status_sensor_disabled", [False]) async def test_single_shot_status_sensor_state_via_mqtt( From 6e952134e7d0f036aad5fc1e8c206e6995e964b0 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Fri, 8 Sep 2023 21:03:27 +0200 Subject: [PATCH 34/35] Bumped version to 2023.9.1 --- homeassistant/const.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index cfdb5095128..cac54748211 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -7,7 +7,7 @@ from typing import Final APPLICATION_NAME: Final = "HomeAssistant" MAJOR_VERSION: Final = 2023 MINOR_VERSION: Final = 9 -PATCH_VERSION: Final = "0" +PATCH_VERSION: Final = "1" __short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}" __version__: Final = f"{__short_version__}.{PATCH_VERSION}" REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 11, 0) diff --git a/pyproject.toml b/pyproject.toml index e4403bd7c30..b74e7914fd7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "homeassistant" -version = "2023.9.0" +version = "2023.9.1" license = {text = "Apache-2.0"} description = "Open-source home automation platform running on Python 3." readme = "README.rst" From 2dcf6a6f5bd07b6294aa0a84ea5161f49a4e50a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hjelseth=20H=C3=B8yer?= Date: Tue, 5 Sep 2023 21:14:39 +0200 Subject: [PATCH 35/35] Bump millheater to 0.11.2 (#99683) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update Mill lib Signed-off-by: Daniel Hjelseth Høyer --- homeassistant/components/mill/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/mill/manifest.json b/homeassistant/components/mill/manifest.json index b2dbf993dae..a4c824b3674 100644 --- a/homeassistant/components/mill/manifest.json +++ b/homeassistant/components/mill/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://www.home-assistant.io/integrations/mill", "iot_class": "local_polling", "loggers": ["mill", "mill_local"], - "requirements": ["millheater==0.11.1", "mill-local==0.2.0"] + "requirements": ["millheater==0.11.2", "mill-local==0.2.0"] } diff --git a/requirements_all.txt b/requirements_all.txt index bd1541b0821..9a704bd2b25 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1213,7 +1213,7 @@ micloud==0.5 mill-local==0.2.0 # homeassistant.components.mill -millheater==0.11.1 +millheater==0.11.2 # homeassistant.components.minio minio==7.1.12 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 623c45a5946..7beceb953a8 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -927,7 +927,7 @@ micloud==0.5 mill-local==0.2.0 # homeassistant.components.mill -millheater==0.11.1 +millheater==0.11.2 # homeassistant.components.minio minio==7.1.12