Skip to content

Instantly share code, notes, and snippets.

View tathamoddie's full-sized avatar

Tatham Oddie tathamoddie

View GitHub Profile
@tathamoddie
tathamoddie / Run-Simulation.ps1
Created July 30, 2022 07:06
Run a solar and battery simulation using real historical data
<#
.SYNOPSIS
Run a solar and battery simulation using real historical data
.DESCRIPTION
Combines real usage data from Powershop's export format, in 30-minute buckets,
with real regional solar performance data from https://pv-map.apvi.org.au/live,
in 15-minute buckets, to simulate the effectiveness of a solar and battery system.
.EXAMPLE
.\Run-Simulation.ps1 `
-PeakGeneration 5.46 `
- alias: 'Washing Done'
mode: restart
trigger:
- platform: numeric_state
entity_id: sensor.washing_machine_power
above: 0
for:
minutes: 5
action:
- wait_for_trigger:
substitutions:
device_name: powerpal-gateway
friendly_name: Powerpal Gateway
esphome:
name: ${device_name}
platform: ESP32
board: m5stack-core-esp32
wifi:
@tathamoddie
tathamoddie / Find-JavaExe.ps1
Last active March 1, 2022 21:12
Attempting to find java.exe, on a Windows machine, in a way that's semi-reliable across Java versions, operating system versions, 32 vs 64-bit and whatever else can be thrown at us.
function Find-JavaExe {
<#
.SYNOPSIS
Locates java.exe on the current system via common conventions.
.DESCRIPTION
substitutions:
device_name: demo_deepsleep
friendly_name: Demo Deep Sleep
## Board config
esphome:
name: ${device_name}
platform: ESP32
board: m5stack-core-esp32
@tathamoddie
tathamoddie / configuration.yaml
Last active January 9, 2022 21:48
Home Assistant Australian RAT Finder
# Per https://www.home-assistant.io/docs/configuration/packages/#create-a-packages-folder
homeassistant:
packages: !include_dir_named packages
@tathamoddie
tathamoddie / RequiresPowerShell.bat
Created August 5, 2010 03:48
Batch file to automatically detect, download and install PowerShell 2 on to an XP SP3 machine
@echo off
REM If PowerShell 2 is not installed, this script will automatically download and install it.
REM Only works on XP SP3 with .NET 3.5. Only for dev boxes, not designed for servers.
REM Based on http://blog.codeassassin.com/2009/12/10/no-web-browser-need-powershell/
ver | find "XP" > nul
if %ERRORLEVEL% neq 0 goto not_xp
ver | find "5.1.2600" > nul
# Used with ESPHome. See https://tatham.blog/2020/08/30/esphome-nothing-to-firmware-in-30-minutes/
## Commom pieces of text we'll re-use later
# (makes it easier to copy and paste all of this code for another value later,
# because you only have to set the new name at the top of the file)
substitutions:
device_name: air_monitor_indoor
friendly_name: Air Monitor Indoor
area: Indoor
alias: Hot plants
trigger:
- platform: sun
event: sunset
offset: '-02:00:00'
condition:
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.south_yarra_temp_max_0
@tathamoddie
tathamoddie / lightning.yaml
Last active January 5, 2021 22:57
AS3935 and ESPHome config
substitutions:
device_name: lightning_detector
friendly_name: Lightning
## Board config
esphome:
name: ${device_name}
platform: ESP32
board: m5stack-core-esp32