Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aneisch committed Jun 4, 2024
1 parent f6d9ba5 commit 79c67a4
Show file tree
Hide file tree
Showing 25 changed files with 1,035 additions and 1,014 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![Build Status](https://github.com/aneisch/home-assistant-config/actions/workflows/check-ha-release-compatibility.yml/badge.svg)](https://github.com/aneisch/home-assistant-config/actions)
[![GitHub last commit](https://img.shields.io/github/last-commit/aneisch/home-assistant-config)](https://github.com/aneisch/home-assistant-config/commits/master)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/y/aneisch/home-assistant-config)](https://github.com/aneisch/home-assistant-config/graphs/commit-activity)
[![HA Version](https://img.shields.io/badge/Running%20Home%20Assistant-2024.5.5%20(Latest)-brightgreen)](https://github.com/home-assistant/home-assistant/releases/latest)
[![HA Version](https://img.shields.io/badge/Running%20Home%20Assistant%20-2024.6.0b5%20(Out%20of%20Date)-Red)](https://github.com/home-assistant/home-assistant/releases/latest)
<br><a href="https://www.buymeacoffee.com/aneisch" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-black.png" width="150px" height="35px" alt="Buy Me A Coffee" style="height: 35px !important;width: 150px !important;" ></a>


Expand Down Expand Up @@ -57,8 +57,8 @@ Also using Grafana/Influx for graphing, both running in Docker containers on NUC
Description | value
-- | --
Lines of ESPHome YAML | 2802
Lines of Home Assistant YAML | 9169
[Integrations](https://www.home-assistant.io/integrations/) in use | 60
Lines of Home Assistant YAML | 9171
[Integrations](https://www.home-assistant.io/integrations/) in use | 61
Zigbee devices in [`zha`](https://www.home-assistant.io/integrations/zha/) | 26
Z-Wave devices in [`zwave_js`](https://www.home-assistant.io/integrations/zwave_js/) | 37

Expand All @@ -69,10 +69,11 @@ Entities in the [`binary_sensor`](https://www.home-assistant.io/components/binar
Entities in the [`button`](https://www.home-assistant.io/components/button) domain | 15
Entities in the [`camera`](https://www.home-assistant.io/components/camera) domain | 15
Entities in the [`climate`](https://www.home-assistant.io/components/climate) domain | 1
Entities in the [`conversation`](https://www.home-assistant.io/components/conversation) domain | 1
Entities in the [`conversation`](https://www.home-assistant.io/components/conversation) domain | 2
Entities in the [`counter`](https://www.home-assistant.io/components/counter) domain | 1
Entities in the [`cover`](https://www.home-assistant.io/components/cover) domain | 16
Entities in the [`device_tracker`](https://www.home-assistant.io/components/device_tracker) domain | 4
Entities in the [`event`](https://www.home-assistant.io/components/event) domain | 1
Entities in the [`fan`](https://www.home-assistant.io/components/fan) domain | 3
Entities in the [`group`](https://www.home-assistant.io/components/group) domain | 18
Entities in the [`image`](https://www.home-assistant.io/components/image) domain | 7
Expand All @@ -90,17 +91,17 @@ Entities in the [`plant`](https://www.home-assistant.io/components/plant) domain
Entities in the [`remote`](https://www.home-assistant.io/components/remote) domain | 1
Entities in the [`script`](https://www.home-assistant.io/components/script) domain | 48
Entities in the [`select`](https://www.home-assistant.io/components/select) domain | 3
Entities in the [`sensor`](https://www.home-assistant.io/components/sensor) domain | 424
Entities in the [`sensor`](https://www.home-assistant.io/components/sensor) domain | 441
Entities in the [`siren`](https://www.home-assistant.io/components/siren) domain | 1
Entities in the [`sun`](https://www.home-assistant.io/components/sun) domain | 1
Entities in the [`switch`](https://www.home-assistant.io/components/switch) domain | 167
Entities in the [`switch`](https://www.home-assistant.io/components/switch) domain | 174
Entities in the [`timer`](https://www.home-assistant.io/components/timer) domain | 6
Entities in the [`tts`](https://www.home-assistant.io/components/tts) domain | 1
Entities in the [`update`](https://www.home-assistant.io/components/update) domain | 32
Entities in the [`vacuum`](https://www.home-assistant.io/components/vacuum) domain | 1
Entities in the [`weather`](https://www.home-assistant.io/components/weather) domain | 1
Entities in the [`zone`](https://www.home-assistant.io/components/zone) domain | 6
**Total state objects** | **1208**
**Total state objects** | **1234**
## The HACS integrations/plugins that I use:
**Appdaemon**:<br>
[aneisch/follow_me_appdaemon](https://github.com/aneisch/follow_me_appdaemon)<br>
Expand Down
2 changes: 1 addition & 1 deletion configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ lovelace:

media_source:

media_extractor:
#media_extractor:

mobile_app:

Expand Down
3 changes: 2 additions & 1 deletion custom_components/alexa_media/alexa_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,14 @@ def is_contact_sensor(appliance: dict[str, Any]) -> bool:
)

def is_switch(appliance: dict[str, Any]) -> bool:
"""Is the given appliance a switch controlled locally by an Echo."""
"""Is the given appliance a switch controlled locally by an Echo, which ist not redeclared as a light."""
return (
is_local(appliance)
and (
"SMARTPLUG" in appliance.get("applianceTypes", [])
or "SWITCH" in appliance.get("applianceTypes", [])
)
and appliance.get("customerDefinedDeviceType") != "LIGHT"
and has_capability(appliance, "Alexa.PowerController", "powerState")
)

Expand Down
2 changes: 1 addition & 1 deletion custom_components/alexa_media/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
PERCENTAGE,
)

__version__ = "4.10.0"
__version__ = "4.10.1"
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"
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 @@ -9,5 +9,5 @@
"issue_tracker": "https://github.com/alandtse/alexa_media_player/issues",
"loggers": ["alexapy", "authcaptureproxy"],
"requirements": ["alexapy==1.27.10", "packaging>=20.3", "wrapt>=1.14.0"],
"version": "4.10.0"
"version": "4.10.1"
}
2 changes: 1 addition & 1 deletion custom_components/alexa_media/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"exclude_devices": "Appareil exclu (séparé par des virgules)",
"hass_url": "URL pour accéder à Home Assistant",
"include_devices": "Appareil inclus (séparé par des virgules)",
"otp_secret": "Clé d'application 2FA (2 facteurs) intégrée (génère automatiquement des codes 2FA). Il ne s'agit pas d'un code à six chiffres.",
"otp_secret": "Clé d'application 2FA (2 facteurs) intégrée (génère automatiquement des codes 2FA). Il ne s'agit pas d'un code à six chiffres.",
"password": "Mot de passe",
"scan_interval": "Secondes entre les analyses",
"securitycode": "Code 2FA (recommandé pour éviter les problèmes de connexion)",
Expand Down
30 changes: 15 additions & 15 deletions custom_components/alexa_media/translations/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"exclude_devices": "Dispositivo excluído (separado por vírgula)",
"hass_url": "URL para aceder o Home Assistant",
"include_devices": "Dispositivo incluído (separado por vírgula)",
"otp_secret": "Chave de aplicativo 2FA integrada (gerar códigos 2FA automaticamente)",
"otp_secret": "Chave de aplicativo 2FA integrada (gera códigos 2FA automaticamente). Isso não tem seis dígitos.",
"password": "Senha",
"scan_interval": "Segundos entre análises",
"securitycode": "Código 2FA (recomendado para evitar problemas de login)",
Expand All @@ -60,38 +60,38 @@
},
"services": {
"clear_history": {
"description": "Clear last entries from Alexa Voice history for each Alexa account.",
"description": "Limpe as últimas entradas do histórico do Alexa Voice para cada conta Alexa.",
"fields": {
"email": {
"description": "Accounts to clear. Empty will clear all.",
"name": "Email address"
"description": "Contas a limpar. Vazio vai limpar tudo.",
"name": "Endereço de email"
},
"entries": {
"description": "Number of entries to clear from 1 to 50. If empty, clear 50.",
"name": "Number of Entries"
"description": "Número de entradas a limpar de 1 a 50. Se estiver vazio, limpe 50.",
"name": "Número de entradas"
}
},
"name": "Clear Amazon Voice History"
"name": "Limpar histórico de voz da Amazon"
},
"force_logout": {
"description": "Force account to logout. Used mainly for debugging.",
"description": "Forçar o logout da conta. Usado principalmente para depuração.",
"fields": {
"email": {
"description": "Accounts to clear. Empty will clear all.",
"name": "Email address"
"description": "Contas a limpar. Vazio vai limpar tudo.",
"name": "Endereço de email"
}
},
"name": "Force Logout"
"name": "Forçar logout"
},
"update_last_called": {
"description": "Forces update of last_called echo device for each Alexa account.",
"description": "Força a atualização do dispositivo de echo last_called para cada conta Alexa.",
"fields": {
"email": {
"description": "List of Alexa accounts to update. If empty, will update all known accounts.",
"name": "Email address"
"description": "Lista de contas Alexa para atualizar. Se estiver vazio, atualizará todas as contas conhecidas.",
"name": "Endereço de email"
}
},
"name": "Update Last Called Sensor"
"name": "Atualizar último sensor chamado"
}
}
}
22 changes: 11 additions & 11 deletions custom_components/alexa_media/translations/zh-Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,35 +60,35 @@
},
"services": {
"clear_history": {
"description": "Clear last entries from Alexa Voice history for each Alexa account.",
"description": "清除每个 Alexa 帐户的 Alexa Voice 历史记录中的最后条目。",
"fields": {
"email": {
"description": "Accounts to clear. Empty will clear all.",
"name": "Email address"
"name": "电子邮件地址"
},
"entries": {
"description": "Number of entries to clear from 1 to 50. If empty, clear 50.",
"name": "Number of Entries"
"description": "要清除的条目数从 1 到 50。如果为空,则清除 50。",
"name": "参赛作品数量"
}
},
"name": "Clear Amazon Voice History"
"name": "清除 Amazon 语音历史记录"
},
"force_logout": {
"description": "Force account to logout. Used mainly for debugging.",
"description": "强制帐户注销。主要用于调试。",
"fields": {
"email": {
"description": "Accounts to clear. Empty will clear all.",
"name": "Email address"
"name": "电子邮件地址"
}
},
"name": "Force Logout"
"name": "强制注销"
},
"update_last_called": {
"description": "Forces update of last_called echo device for each Alexa account.",
"description": "强制更新每个 Alexa 帐户的 last_called 回声设备。",
"fields": {
"email": {
"description": "List of Alexa accounts to update. If empty, will update all known accounts.",
"name": "Email address"
"description": "要更新的 Alexa 帐户列表。如果为空,将更新所有已知帐户。",
"name": "电子邮件地址"
}
},
"name": "Update Last Called Sensor"
Expand Down
4 changes: 1 addition & 3 deletions custom_components/mail_and_packages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,7 @@ async def _async_update_data(self):
"""Fetch data."""
async with asyncio.timeout(self.timeout):
try:
data = await self.hass.async_add_executor_job(
process_emails, self.hass, self.config
)
data = await process_emails(self.hass, self.config)
except Exception as error:
_LOGGER.error("Problem updating sensors: %s", error)
raise UpdateFailed(error) from error
Expand Down
8 changes: 4 additions & 4 deletions custom_components/mail_and_packages/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def is_on(self) -> bool:
usps_check = os.path.exists(usps_image)
_LOGGER.debug("USPS Check: %s", usps_check)
if usps_check:
image_hash = hash_file(usps_image)
none_hash = hash_file(usps_none)
image_hash = self.hass.add_job(hash_file, usps_image)
none_hash = self.hass.add_job(hash_file, usps_none)

_LOGGER.debug("USPS Image hash: %s", image_hash)
_LOGGER.debug("USPS None hash: %s", none_hash)
Expand All @@ -112,8 +112,8 @@ def is_on(self) -> bool:
amazon_check = os.path.exists(amazon_image)
_LOGGER.debug("Amazon Check: %s", amazon_check)
if amazon_check:
image_hash = hash_file(amazon_image)
none_hash = hash_file(amazon_none)
image_hash = self.hass.add_job(hash_file, amazon_image)
none_hash = self.hass.add_job(hash_file, amazon_none)

_LOGGER.debug("Amazon Image hash: %s", image_hash)
_LOGGER.debug("Amazon None hash: %s", none_hash)
Expand Down
13 changes: 6 additions & 7 deletions custom_components/mail_and_packages/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ async def async_camera_image(
) -> bytes | None:
"""Return image response."""
try:
with open(self._file_path, "rb") as file:
return file.read()
file = await self.hass.async_add_executor_job(open, self._file_path, "rb")
return file.read()
except FileNotFoundError:
_LOGGER.warning(
"Could not read camera %s image from file: %s",
Expand All @@ -133,6 +133,7 @@ def update_file_path(self) -> None:
"""Update the file_path."""
_LOGGER.debug("Camera Update: %s", self._type)
_LOGGER.debug("Custom No Mail: %s", self._no_mail)
file_path = None

if not self._coordinator.last_update_success:
_LOGGER.debug("Update to update camera image. Unavailable.")
Expand All @@ -145,25 +146,23 @@ def update_file_path(self) -> None:
if self._type == "usps_camera":
# Update camera image for USPS informed delivery images
image = self._coordinator.data[ATTR_IMAGE_NAME]
file_path = f"{os.path.dirname(__file__)}/mail_none.gif"

if ATTR_IMAGE_PATH in self._coordinator.data.keys():
path = self._coordinator.data[ATTR_IMAGE_PATH]
file_path = f"{self.hass.config.path()}/{path}{image}"
else:
if self._no_mail is None:
file_path = f"{os.path.dirname(__file__)}/mail_none.gif"
else:
if self._no_mail:
file_path = self._no_mail

elif self._type == "amazon_camera":
# Update camera image for Amazon deliveries
image = self._coordinator.data[ATTR_AMAZON_IMAGE]
file_path = f"{os.path.dirname(__file__)}/no_deliveries.jpg"

if ATTR_IMAGE_PATH in self._coordinator.data.keys():
path = f"{self._coordinator.data[ATTR_IMAGE_PATH]}amazon/"
file_path = f"{self.hass.config.path()}/{path}{image}"
else:
file_path = f"{os.path.dirname(__file__)}/no_deliveries.jpg"

self.check_file_path_access(file_path)
self._file_path = file_path
Expand Down
2 changes: 1 addition & 1 deletion custom_components/mail_and_packages/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

DOMAIN = "mail_and_packages"
DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "0.3.25"
VERSION = "0.3.27"
ISSUE_URL = "http://github.com/moralmunky/Home-Assistant-Mail-And-Packages"
PLATFORM = "sensor"
PLATFORMS = ["binary_sensor", "camera", "sensor"]
Expand Down
Loading

0 comments on commit 79c67a4

Please sign in to comment.