Skip to content

Instantly share code, notes, and snippets.

script:
play_plex_album_on_roku_tv:
alias: Play Plex album on Roku TV
sequence:
# turn on the TV if it's not on
- choose:
- conditions:
- condition: state
entity_id: media_player.43_tcl_roku_tv
state: standby
@joe248
joe248 / playlists.yaml
Last active December 23, 2022 08:08
Home Assistant Playlist Package
# Media is stored in .homeassistant/media/
# To use this in your own installation:
# 1. Replace all 'media_player.43_tcl_roku_tv' entities with your media player
# 2. Create a script for each playlist with the tracks you want
# 3. Edit the roku_finished_playing_track automation to conform to your media player, triggering whenever it finishes playing a track
# 4. Start playing a playlist by calling the script for that playlist
input_select:
current_playlist:
options:
@joe248
joe248 / update_nest_target_humidity.php
Created November 18, 2019 17:14
PHP Script to update Nest thermostat target humidity based on outside temperature
<?php
require_once dirname(__FILE__) . '/../includes/nest.class.php';
// Your Nest username and password.
define('USERNAME', 'YOUR_NEST_USERNAME');
define('PASSWORD', 'YOUR_NEST_PASSWORD');
define("MAX_HUMIDITY", 45);
define("MIN_HUMIDITY", 15);
@joe248
joe248 / electricity_cost_manager.py
Last active June 21, 2023 12:56
Home Assistant AppDaemon App to reduce energy usage during ComEd peak load events
# Helpful links:
# https://www.pjm.com/-/media/planning/res-adeq/load-forecast/20181017-summer-2018-peaks-and-5cps.ashx?la=en
# https://www.comed.com/SiteCollectionDocuments/MyAccount/MyService/ComEd_5_Peaks.pdf
# https://www.citizensutilityboard.org/blog/2019/01/23/comeds-hourly-pricing-how-to-calculate-the-customer-capacity-charge/
# https://secure.comed.com/MyAccount/MyService/Pages/UsageDataTool.aspx
# NOTE: This was originally written for a Nest thermostat, hence the use of the term 'Eco mode'. Instead of turning the thermostat off during times of high load or high price, I would just switch it into Eco mode. I no longer have a Nest so I now just switch my thermostat off, but I still refer to this as Eco mode in the script. I use the ECO_ACTIVATED_DUE_TO_PRICE input_boolean in Home Assistant as a flag to know whether or not 'Eco mode' was activated due to this script vs. someone manually turning off the thermostat.
import appdaemon.plugins.hass.hassapi as hass
import datetime
@joe248
joe248 / __init__.py
Last active May 16, 2023 12:05
Home Assistant PJM Load Data Sensor
"""The PJM component."""