Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aneisch committed Aug 19, 2024
1 parent baf9f5f commit dd0fe03
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
<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>

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).
Expand Down Expand Up @@ -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
Expand Down
14 changes: 6 additions & 8 deletions automations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
18 changes: 18 additions & 0 deletions custom_components/alexa_media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from datetime import datetime, timedelta
from json import JSONDecodeError, loads
import logging
import os
import time
from typing import Optional

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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",
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 @@ -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"
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.28.2", "packaging>=20.3", "wrapt>=1.14.0"],
"version": "4.12.7"
"version": "4.12.9"
}
Binary file modified images/nodered_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/nodered_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions python_scripts/utility_meter_reset.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
19 changes: 15 additions & 4 deletions www/community/lovelace-wallpanel/wallpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class ScreenWakeLock {
}
}

const version = "4.25.6";
const version = "4.26.0";
const defaultConfig = {
enabled: false,
enabled_on_tabs: [],
Expand Down Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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 = [];
Expand All @@ -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);
});
Expand All @@ -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) {
Expand Down Expand Up @@ -3644,3 +3654,4 @@ EXIF.pretty = function(img) {
EXIF.readFromBinaryFile = function(file) {
return findEXIFinJPEG(file);
}

Binary file modified www/community/lovelace-wallpanel/wallpanel.js.gz
Binary file not shown.

0 comments on commit dd0fe03

Please sign in to comment.