From 7952c8911c975f176758360c5bf4f28a0435d4e7 Mon Sep 17 00:00:00 2001 From: Daniel <49846893+danielbrunt57@users.noreply.github.com> Date: Sat, 21 Dec 2024 17:14:53 -0800 Subject: [PATCH 1/4] fix: strip spaces from include_devices, exclude_devices (#2761) closes #2556 closes #2751 --- custom_components/alexa_media/config_flow.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/custom_components/alexa_media/config_flow.py b/custom_components/alexa_media/config_flow.py index 70997c3e..5551ffb1 100644 --- a/custom_components/alexa_media/config_flow.py +++ b/custom_components/alexa_media/config_flow.py @@ -959,6 +959,15 @@ async def async_step_init( if CONF_PUBLIC_URL in self._config_entry.data: if not user_input[CONF_PUBLIC_URL].endswith("/"): user_input[CONF_PUBLIC_URL] = user_input[CONF_PUBLIC_URL] + "/" + """Remove leading/trailing spaces in device strings""" + if CONF_INCLUDE_DEVICES in self._config_entry.data: + user_input[CONF_INCLUDE_DEVICES] = user_input[ + CONF_INCLUDE_DEVICES + ].strip() + if CONF_EXCLUDE_DEVICES in self._config_entry.data: + user_input[CONF_EXCLUDE_DEVICES] = user_input[ + CONF_EXCLUDE_DEVICES + ].strip() self.hass.config_entries.async_update_entry( self._config_entry, data=user_input, options=self._config_entry.options From bc8ffcdd2106650a0345064557f88af107a66bf8 Mon Sep 17 00:00:00 2001 From: alams154 <31905246+alams154@users.noreply.github.com> Date: Sat, 21 Dec 2024 19:15:17 -0600 Subject: [PATCH 2/4] fix: restore Amazon air quality monitor entities (#2758) closes #2756 --- custom_components/alexa_media/alexa_entity.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/custom_components/alexa_media/alexa_entity.py b/custom_components/alexa_media/alexa_entity.py index 41778457..8c927842 100644 --- a/custom_components/alexa_media/alexa_entity.py +++ b/custom_components/alexa_media/alexa_entity.py @@ -107,8 +107,10 @@ def is_alexa_guard(appliance: dict[str, Any]) -> bool: def is_temperature_sensor(appliance: dict[str, Any]) -> bool: """Is the given appliance the temperature sensor of an Echo.""" - return is_local(appliance) and has_capability( - appliance, "Alexa.TemperatureSensor", "temperature" + return ( + is_local(appliance) + and has_capability(appliance, "Alexa.TemperatureSensor", "temperature") + and appliance["friendlyDescription"] != "Amazon Indoor Air Quality Monitor" ) From 330e046916da4fd5cde4eb8ecdc25aaaf00654de Mon Sep 17 00:00:00 2001 From: Daniel <49846893+danielbrunt57@users.noreply.github.com> Date: Sat, 21 Dec 2024 17:16:04 -0800 Subject: [PATCH 3/4] feat: add new attribute: `previous_volume` (#2766) closes #2765 --- custom_components/alexa_media/media_player.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/custom_components/alexa_media/media_player.py b/custom_components/alexa_media/media_player.py index b5fa0e80..df6b29b6 100644 --- a/custom_components/alexa_media/media_player.py +++ b/custom_components/alexa_media/media_player.py @@ -245,6 +245,7 @@ def __init__(self, device, login, second_account_index=0): self._media_is_muted = None self._media_vol_level = None self._previous_volume = None + self._saved_volume = None self._source = None self._source_list = [] self._connected_bluetooth = None @@ -1129,14 +1130,23 @@ async def async_set_volume_level(self, volume): """Set volume level, range 0..1.""" if not self.available: return + + # Save the current volume level before we change it + _LOGGER.debug("Saving previous volume level: %s", self.volume_level) + self._previous_volume = self.volume_level + + # Change the volume level on the device if self.hass: self.hass.async_create_task(self.alexa_api.set_volume(volume)) else: await self.alexa_api.set_volume(volume) self._media_vol_level = volume + + # Let http2push update the new volume level if not ( self.hass.data[DATA_ALEXAMEDIA]["accounts"][self._login.email]["http2"] ): + # Otherwise we do it ourselves await self.async_update() @property @@ -1164,19 +1174,19 @@ async def async_mute_volume(self, mute): self._media_is_muted = mute if mute: - self._previous_volume = self.volume_level + self._saved_volume = self.volume_level if self.hass: self.hass.async_create_task(self.alexa_api.set_volume(0)) else: await self.alexa_api.set_volume(0) else: - if self._previous_volume is not None: + if self._saved_volume is not None: if self.hass: self.hass.async_create_task( - self.alexa_api.set_volume(self._previous_volume) + self.alexa_api.set_volume(self._saved_volume) ) else: - await self.alexa_api.set_volume(self._previous_volume) + await self.alexa_api.set_volume(self._saved_volume) else: if self.hass: self.hass.async_create_task(self.alexa_api.set_volume(50)) @@ -1620,6 +1630,7 @@ def extra_state_attributes(self): "last_called_summary": self._last_called_summary, "connected_bluetooth": self._connected_bluetooth, "bluetooth_list": self._bluetooth_list, + "previous_volume": self._previous_volume, } return attr From c1070466560662689155ddfe76a86ee3f1ba5486 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 22 Dec 2024 01:18:24 +0000 Subject: [PATCH 4/4] 5.2.0 Automatically generated by python-semantic-release --- custom_components/alexa_media/const.py | 2 +- custom_components/alexa_media/manifest.json | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_components/alexa_media/const.py b/custom_components/alexa_media/const.py index 9282c85c..91a8e071 100644 --- a/custom_components/alexa_media/const.py +++ b/custom_components/alexa_media/const.py @@ -15,7 +15,7 @@ PERCENTAGE, ) -__version__ = "5.1.0" +__version__ = "5.2.0" PROJECT_URL = "https://github.com/alandtse/alexa_media_player/" ISSUE_URL = f"{PROJECT_URL}issues" NOTIFY_URL = f"{PROJECT_URL}wiki/Configuration%3A-Notification-Component#use-the-notifyalexa_media-service" diff --git a/custom_components/alexa_media/manifest.json b/custom_components/alexa_media/manifest.json index 03151944..82abee65 100644 --- a/custom_components/alexa_media/manifest.json +++ b/custom_components/alexa_media/manifest.json @@ -9,5 +9,5 @@ "issue_tracker": "https://github.com/alandtse/alexa_media_player/issues", "loggers": ["alexapy", "authcaptureproxy"], "requirements": ["alexapy==1.29.5", "packaging>=20.3", "wrapt>=1.14.0"], - "version": "5.1.0" + "version": "5.2.0" } diff --git a/pyproject.toml b/pyproject.toml index f48b58b0..706c2e8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "alexa_media_player" -version = "5.1.0" +version = "5.2.0" description = "This is a custom component to allow control of Amazon Alexa devices in [Homeassistant](https://home-assistant.io) using the unofficial Alexa API." authors = [ "Keaton Taylor ",