Skip to content

Commit

Permalink
Merge pull request #2046 from custom-components/dev
Browse files Browse the repository at this point in the history
chore: release 2023-09-30
  • Loading branch information
alandtse authored Sep 30, 2023
2 parents 62c8f9c + aaf81a0 commit b90221d
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 14 deletions.
10 changes: 7 additions & 3 deletions custom_components/alexa_media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,12 +838,12 @@ async def http2_connect() -> HTTP2EchoClient:
)
return
http2 = HTTP2EchoClient(
hass,
login_obj,
msg_callback=http2_handler,
open_callback=http2_open_handler,
close_callback=http2_close_handler,
error_callback=http2_error_handler,
loop=hass.loop,
)
_LOGGER.debug("%s: HTTP2 created: %s", hide_email(email), http2)
await http2.async_run()
Expand Down Expand Up @@ -1191,10 +1191,14 @@ async def http2_error_handler(message):
)
hass.data[DATA_ALEXAMEDIA]["accounts"][email]["http2"] = None
if not login_obj.close_requested and (
login_obj.session.closed or message == "<class 'aiohttp.streams.EofStream'>"
login_obj.session.closed or isinstance(message, AlexapyLoginError)
):
hass.data[DATA_ALEXAMEDIA]["accounts"][email]["http2error"] = 5
_LOGGER.debug("%s: Immediate abort on EoFstream", hide_email(email))
_LOGGER.debug("%s: Login error detected.", hide_email(email))
hass.bus.async_fire(
"alexa_media_relogin_required",
event_data={"email": hide_email(email), "url": login_obj.url},
)
return
hass.data[DATA_ALEXAMEDIA]["accounts"][email]["http2error"] = errors + 1

Expand Down
2 changes: 1 addition & 1 deletion custom_components/alexa_media/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/custom-components/alexa_media_player/issues",
"loggers": ["alexapy", "authcaptureproxy"],
"requirements": ["alexapy==1.27.0", "packaging>=20.3", "wrapt>=1.12.1"],
"requirements": ["alexapy==1.27.2", "packaging>=20.3", "wrapt>=1.12.1"],
"version": "4.6.5"
}
7 changes: 5 additions & 2 deletions custom_components/alexa_media/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ async def async_unload_entry(hass, entry) -> bool:
if "entities" not in account_dict:
continue
for device in account_dict["entities"]["media_player"].values():
entity_id = device.entity_id.split(".")
hass.services.async_remove(SERVICE_NOTIFY, f"{DOMAIN}_{entity_id[1]}")
if device.entity_id:
entity_id = device.entity_id.split(".")
hass.services.async_remove(
SERVICE_NOTIFY, f"{DOMAIN}_{entity_id[1]}"
)
else:
other_accounts = True
if not other_accounts:
Expand Down
11 changes: 9 additions & 2 deletions custom_components/alexa_media/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,14 +557,21 @@ async def async_will_remove_from_hass(self):
def _handle_event(self, event):
"""Handle events.
This will update PUSH_ACTIVITY events to see if the sensor
should be updated.
This will update PUSH_ACTIVITY or NOTIFICATION_UPDATE events to see if
the sensor should be updated.
"""
try:
if not self.enabled:
return
except AttributeError:
pass
if "notification_update" in event:
if (
event["notification_update"]["dopplerId"]["deviceSerialNumber"]
== self._client.device_serial_number
):
_LOGGER.debug("Updating sensor %s", self)
self.schedule_update_ha_state(True)
if "push_activity" in event:
if (
event["push_activity"]["key"]["serialNumber"]
Expand Down
29 changes: 24 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "Apache-2.0"

[tool.poetry.dependencies]
python = ">=3.11,<4.0"
alexapy = "1.27.0"
alexapy = "1.27.2"
aiohttp = ">=3.8.1"
packaging = ">=20.3"
wrapt = ">=1.12.1"
Expand Down

0 comments on commit b90221d

Please sign in to comment.