Skip to content

Commit 4283fa5

Browse files
Merge branch 'dev' into perf/optimize-boot
2 parents c44a636 + 5b10849 commit 4283fa5

File tree

6 files changed

+21
-24
lines changed

6 files changed

+21
-24
lines changed

custom_components/alexa_media/alexa_entity.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -757,9 +757,7 @@ def is_cap_state_still_acceptable(
757757
return False
758758

759759
try:
760-
time_of_sample = datetime.strptime(
761-
formatted_time_of_sample, "%Y-%m-%dT%H:%M:%S%z"
762-
)
760+
time_of_sample = datetime.fromisoformat(formatted_time_of_sample)
763761
except ValueError:
764762
return False
765763

custom_components/alexa_media/config_flow.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from functools import reduce
1515
import html as html_lib
1616
import logging
17-
import traceback
1817
from typing import Any, Optional
1918

2019
from aiohttp import ClientConnectionError, ClientSession, InvalidURL, web, web_response
@@ -405,13 +404,13 @@ async def async_step_start_proxy(self, user_input=None):
405404
write=30.0,
406405
pool=30.0,
407406
)
408-
_LOGGER.warning(
409-
"PROXY DEBUG >>> Session timeout set to: %s",
407+
_LOGGER.debug(
408+
"Proxy session timeout set to: %s",
410409
self.proxy.session.timeout,
411410
)
412411
else:
413412
_LOGGER.warning(
414-
"PROXY DEBUG >>> No session found on proxy object. Attrs: %s",
413+
"Proxy: No session found on proxy object. Attrs: %s",
415414
dir(self.proxy),
416415
)
417416
if not self.proxy_view:
@@ -1111,7 +1110,7 @@ async def wrapped(request, **kwargs):
11111110
for k, v in request.headers.items()
11121111
}
11131112
_LOGGER.debug(
1114-
"PROXY DEBUG >>> Request: %s %s | Remote: %s | Headers: %s",
1113+
"Proxy request: %s %s | Remote: %s | Headers: %s",
11151114
request.method,
11161115
request.url,
11171116
request.remote,
@@ -1129,7 +1128,7 @@ async def wrapped(request, **kwargs):
11291128
else "unknown"
11301129
)
11311130
_LOGGER.debug(
1132-
"PROXY DEBUG >>> Success: %s %s | Status: %s | Response headers: %s",
1131+
"Proxy response: %s %s | Status: %s | Response headers: %s",
11331132
request.method,
11341133
request.url,
11351134
result.status if hasattr(result, "status") else "unknown",
@@ -1147,17 +1146,13 @@ async def wrapped(request, **kwargs):
11471146
except web.HTTPException:
11481147
raise # Let aiohttp handle redirects (HTTPFound) and other HTTP exceptions
11491148
except Exception as ex: # pylint: disable=broad-except
1150-
tb = traceback.format_exc()
11511149
_LOGGER.warning(
1152-
"PROXY DEBUG >>> EXCEPTION at %s %s\n"
1153-
"Type: %s\n"
1154-
"Message: %s\n"
1155-
"Full traceback:\n%s",
1150+
"Proxy exception at %s %s: %s - %s",
11561151
request.method,
11571152
request.url,
11581153
type(ex).__name__,
11591154
ex,
1160-
tb,
1155+
exc_info=True,
11611156
)
11621157
return web_response.Response(
11631158
headers={"content-type": "text/html"},

custom_components/alexa_media/helpers.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,14 @@ def _devices_preview(devs: list[Entity]) -> str:
7878
for device in devices:
7979
dev_name = _device_name(device)
8080

81-
if dev_name and (
82-
(include_filter and dev_name not in include_filter)
83-
or (exclude_filter and dev_name in exclude_filter)
84-
):
81+
# If include_filter is set, we must have a name and it must match.
82+
if include_filter and (not dev_name or dev_name not in include_filter):
83+
_LOGGER.debug(
84+
"%s: Not including device: %s", account, _device_label(device)
85+
)
86+
continue
87+
# Exclude only when name is present and matches.
88+
if exclude_filter and dev_name and dev_name in exclude_filter:
8589
_LOGGER.debug("%s: Excluding device: %s", account, _device_label(device))
8690
continue
8791

custom_components/alexa_media/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
"wrapt>=1.14.0",
1515
"dictor>=0.1.12,<0.2"
1616
],
17-
"version": "5.12.0"
17+
"version": "5.12.2"
1818
}

custom_components/alexa_media/sensor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ def __init__(self, client, n_json, account, debug: bool = False):
10241024
n_json,
10251025
"date_time",
10261026
account,
1027-
"Next alarm",
1027+
f"next {self._type}",
10281028
"mdi:alarm",
10291029
debug=debug,
10301030
)
@@ -1044,7 +1044,7 @@ def __init__(self, client, n_json, account, debug: bool = False):
10441044
n_json,
10451045
"remainingTime",
10461046
account,
1047-
"Next timer",
1047+
f"next {self._type}",
10481048
(
10491049
"mdi:timer-outline"
10501050
if (version.parse(HA_VERSION) >= version.parse("0.113.0"))
@@ -1106,7 +1106,7 @@ def __init__(self, client, n_json, account, debug: bool = False):
11061106
n_json,
11071107
"alarmTime",
11081108
account,
1109-
"Next reminder",
1109+
f"next {self._type}",
11101110
"mdi:reminder",
11111111
debug=debug,
11121112
)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "alexa_media_player"
3-
version = "5.12.0"
3+
version = "5.12.2"
44
description = "This is a custom component to allow control of Amazon Alexa devices in [Homeassistant](https://home-assistant.io) using the unofficial Alexa API."
55
authors = [
66
"Keaton Taylor <keatonstaylor@gmail.com>",

0 commit comments

Comments
 (0)