Skip to content

Instantly share code, notes, and snippets.

View thejeffreystone's full-sized avatar

Jeffrey Stone thejeffreystone

View GitHub Profile
@finity69x2
finity69x2 / nws_wx_alert_custom.txt
Last active July 25, 2022 20:23
Home Assistant Configuration for Adding Weather Alerts from the US NWS using a Custom Sensor
This will allow several functions including a persistent pop-up notification on your HA front end, a notification to whichever notify service you use (I’m using Pushbullet in this example), and, if you use another custom component (https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639), it will also trigger an announcement to all of your Echo devices.
This integration uses a custom sensor.
you can find the code and the instructions for use at the following location:
https://github.com/eracknaphobia/nws_custom_component
NOTE: you will need to change the name of the file dep[ending on the version of ha you are installing it in. The instructions in that repo makes a note of that.
@finity69x2
finity69x2 / nws_wx_alert_rest.txt
Last active November 9, 2022 00:06
Home Assistant Configuration for Adding Weather Alerts from the US NWS using a REST Sensor
This will allow several functions including a persistent pop-up notification on your HA front end, a notification to whichever notify service you use (I’m using Pushbullet in this example), and, if you use another custom component (https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639), it will also trigger an announcement to all of your Echo devices.
You next need to find either your NWS Zone ID or County ID. It is better to use both ID's here.
You can find your Zone or County ID by going to https://alerts.weather.gov/, scroll down to your state and click on the “zone list” and/or "county list" then look for the entry for your county.
Once you have your desired ID you create a sensor, replacing my id (INZ009, INC033) with yours. The ID is case sensitive!
Then when you have your ID's, enter them into the configuration below.
@ErebusBat
ErebusBat / zwcfg.xml
Created January 16, 2018 13:24
Hass.io OZW Node Configuration for Leviton Decora DZ6HD Dimmer
<Node id="23" name="Front Room" location="" basic="4" generic="17" specific="1" roletype="5" devicetype="1536" nodetype="0" type="Multilevel Power Switch" listening="true" frequentListening="false" beaming="true" routing="true" max_baud_rate="40000" version="4" query_stage="Complete">
<Manufacturer id="1d" name="Leviton">
<Product type="3201" id="0001" name="DZ6HD: type=3201, id=0001" />
</Manufacturer>
<CommandClasses>
<CommandClass id="32" name="COMMAND_CLASS_BASIC" version="1" request_flags="4" innif="true" mapping="38">
<Instance index="1" />
</CommandClass>
<CommandClass id="38" name="COMMAND_CLASS_SWITCH_MULTILEVEL" version="4" innif="true">
@stevendanna
stevendanna / pre-commit
Last active March 21, 2016 15:42
Pre-commit hook to help prevent key leakage
#!/bin/bash
#
# Warn about possible cloud access keys before committing
#
exec </dev/tty
unset possible_keys
possible_keys=$(git diff --cached | egrep '^[+\-].*(AKIA|AWS_ACCESS|AWS_SECRET|OS_PASSWORD|OS_USERNAME)')
if [[ -n "$possible_keys" ]];then
echo -e "WARNING: Diff contains possible access keys:\n"
echo "${possible_keys}"
@urschrei
urschrei / jenks_zero.py
Created September 22, 2013 17:45
Calculate Jenks natural breaks on a dataset containing zero values, using Pandas and Pysal
import pandas as pd
import numpy as np
from pysal.esda.mapclassify import Natural_Breaks as nb
df = pd.DataFrame({'density': np.random.randint(0, 10, 500)})
# replace zero values with NaN
df.replace(to_replace={'density': {0: np.nan}}, inplace=True)
breaks = nb(df[df['density'].notnull()].density.values, k=5)
# this index will allow us to perform the join correctly
"""
combine.py
alternate between two audiofiles, beat by beat
By Paul Lamere, 2013-01-25
"""
import echonest.audio as audio
usage = """