diff --git a/README.md b/README.md index 8d561f13..56a9ccb4 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,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.8.1%20(Latest)-brightgreen)](https://github.com/home-assistant/home-assistant/releases/latest) +[![HA Version](https://img.shields.io/badge/Running%20Home%20Assistant-2024.8.2%20(Latest)-brightgreen)](https://github.com/home-assistant/home-assistant/releases/latest)
Buy Me A Coffee I do my best to keep [Home Assistant](https://github.com/home-assistant/home-assistant) on the [latest release](https://github.com/home-assistant/home-assistant/releases/latest). I'm heavily utilizing [AppDaemon](http://appdaemon.readthedocs.io/en/latest/) and [NodeRed](https://flows.nodered.org/node/node-red-contrib-home-assistant-websocket) for advanced/templated automations. See [Appdaemon config](https://github.com/aneisch/home-assistant-config/tree/master/extras/appdaemon) and my NodeRed screenshots below for details. Most of my setup is run as Docker containers (see [docker-compose](https://github.com/aneisch/home-assistant-config/tree/master/extras/docker-compose) for container list). @@ -59,7 +59,7 @@ Home Assistant and other containers have ingress handled automatically by [Traef Description | value -- | -- Lines of ESPHome YAML | 3250 -Lines of Home Assistant YAML | 9669 +Lines of Home Assistant YAML | 9667 [Integrations](https://www.home-assistant.io/integrations/) in use | 62 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 diff --git a/automations.yaml b/automations.yaml index 0a0c3988..3c1b7f8b 100644 --- a/automations.yaml +++ b/automations.yaml @@ -171,12 +171,6 @@ trigger: - platform: state entity_id: - # below set by esphome now - # - binary_sensor.front_door - # - binary_sensor.back_porch_door - # - binary_sensor.garage_exterior_door - # - binary_sensor.garage_interior_door - # - binary_sensor.master_bedroom_exterior_door - input_boolean.kitchen_motion - binary_sensor.living_room_motion - binary_sensor.hallway_motion @@ -659,11 +653,15 @@ - action: python_script.compute_utility_costs data: meter_entity: sensor.water_usage -- alias: Reset Utility Meters - id: reset_utility_meters +- id: reset_utility_meters + alias: Reset Utility Meters trigger: - platform: time at: 00:00:00 + enabled: true + condition: + - condition: template + value_template: '{{ now().day == 1 }}' action: - action: python_script.utility_meter_reset data: diff --git a/custom_components/alexa_media/__init__.py b/custom_components/alexa_media/__init__.py index dadc1b2b..b50517db 100644 --- a/custom_components/alexa_media/__init__.py +++ b/custom_components/alexa_media/__init__.py @@ -11,6 +11,7 @@ from datetime import datetime, timedelta from json import JSONDecodeError, loads import logging +import os import time from typing import Optional @@ -1288,6 +1289,7 @@ async def http2_error_handler(message): async def async_unload_entry(hass, entry) -> bool: """Unload a config entry.""" email = entry.data["email"] + login_obj = hass.data[DATA_ALEXAMEDIA]["accounts"][email]["login_obj"] _LOGGER.debug("Attempting to unload entry for %s", hide_email(email)) for component in ALEXA_COMPONENTS + DEPENDENT_ALEXA_COMPONENTS: _LOGGER.debug("Forwarding unload entry to %s", component) @@ -1329,6 +1331,22 @@ async def async_unload_entry(hass, entry) -> bool: _LOGGER.debug("Removing alexa_media data structure") if hass.data.get(DATA_ALEXAMEDIA): hass.data.pop(DATA_ALEXAMEDIA) + # Delete cookiefile + if callable(getattr(AlexaLogin, "delete_cookiefile", None)): + try: + await login_obj.delete_cookiefile() + _LOGGER.debug("Deleted cookiefile") + except Exception as ex: + _LOGGER.error( + "Failed to delete cookiefile: %s", + ex, + ) + else: + _LOGGER.warn( + "Could not remove cookiefile: /config/.storage/alexa_media.%s.pickle." + " Please manually delete the file.", + email, + ) else: _LOGGER.debug( "Unable to remove alexa_media data structure: %s", diff --git a/custom_components/alexa_media/const.py b/custom_components/alexa_media/const.py index 13cbc8b2..01c402a0 100644 --- a/custom_components/alexa_media/const.py +++ b/custom_components/alexa_media/const.py @@ -15,7 +15,7 @@ PERCENTAGE, ) -__version__ = "4.12.7" +__version__ = "4.12.9" 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 d3b0ca68..c7c16227 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.28.2", "packaging>=20.3", "wrapt>=1.14.0"], - "version": "4.12.7" + "version": "4.12.9" } diff --git a/images/nodered_1.png b/images/nodered_1.png index 19171e22..f44251c7 100644 Binary files a/images/nodered_1.png and b/images/nodered_1.png differ diff --git a/images/nodered_2.png b/images/nodered_2.png index c6826926..f409dda9 100644 Binary files a/images/nodered_2.png and b/images/nodered_2.png differ diff --git a/python_scripts/utility_meter_reset.py b/python_scripts/utility_meter_reset.py index 807d0596..4d8caa69 100644 --- a/python_scripts/utility_meter_reset.py +++ b/python_scripts/utility_meter_reset.py @@ -1,6 +1,9 @@ ResetEntity = data.get('cycle_reset_entity_id') MeterEntity = data.get('meter_entity') +# Comment this out once the sensor.utilities_cycle_end is fixed +hass.services.call("utility_meter", "calibrate", {'value': '0', 'entity_id': MeterEntity}) + # Handle Meter Reset -- Run daily at midnight via automation # Get state of reset entity (probably sensor.utilities_cycle_start) diff --git a/www/community/lovelace-wallpanel/wallpanel.js b/www/community/lovelace-wallpanel/wallpanel.js index 9b9b1629..b8618891 100644 --- a/www/community/lovelace-wallpanel/wallpanel.js +++ b/www/community/lovelace-wallpanel/wallpanel.js @@ -107,7 +107,7 @@ class ScreenWakeLock { } } -const version = "4.25.6"; +const version = "4.26.0"; const defaultConfig = { enabled: false, enabled_on_tabs: [], @@ -670,7 +670,7 @@ class WallpanelView extends HuiView { this.lastEnergyCollectionUpdate = 0; this.screensaverStopNavigationPathTimeout = null; - this.lovelace = getHaPanelLovelace().__lovelace; + this.lovelace = null; this.__hass = elHass.__hass; this.__cards = []; this.__badges = []; @@ -1108,6 +1108,7 @@ class WallpanelView extends HuiView { createInfoBoxContent() { logger.debug("Creating info box content"); + this.lovelace = getHaPanelLovelace().__lovelace; this.infoBoxContentCreatedDate = new Date(); this.infoBoxContent.innerHTML = ''; this.__badges = []; @@ -1130,12 +1131,21 @@ class WallpanelView extends HuiView { div.style.justifyContent = 'center'; div.style.gap = '8px'; div.style.margin = '0px'; + div.style.minWidth = '200px' config.badges.forEach(badge => { - let badgeConfig = structuredClone(badge); + let badgeConfig = JSON.parse(JSON.stringify(badge)); logger.debug("Creating badge:", badgeConfig); + let style = {}; + if (badgeConfig.wp_style) { + style = badgeConfig.wp_style; + delete badgeConfig.wp_style; + } const createBadgeElement = this._createBadgeElement ? this._createBadgeElement : this.createBadgeElement; const badgeElement = createBadgeElement.bind(this)(badgeConfig); badgeElement.hass = this.hass; + for (const attr in style) { + badgeElement.style.setProperty(attr, style[attr]); + } this.__badges.push(badgeElement); div.append(badgeElement); }); @@ -1144,7 +1154,7 @@ class WallpanelView extends HuiView { if (config.cards) { config.cards.forEach(card => { // Copy object - let cardConfig = structuredClone(card); + let cardConfig = JSON.parse(JSON.stringify(card)); logger.debug("Creating card:", cardConfig); let style = {}; if (cardConfig.wp_style) { @@ -3644,3 +3654,4 @@ EXIF.pretty = function(img) { EXIF.readFromBinaryFile = function(file) { return findEXIFinJPEG(file); } + diff --git a/www/community/lovelace-wallpanel/wallpanel.js.gz b/www/community/lovelace-wallpanel/wallpanel.js.gz index 26bbb6f9..88ad6c48 100644 Binary files a/www/community/lovelace-wallpanel/wallpanel.js.gz and b/www/community/lovelace-wallpanel/wallpanel.js.gz differ