Skip to content

Instantly share code, notes, and snippets.

View brianhanifin's full-sized avatar
💭
Happy to be contributing!

Brian Hanifin brianhanifin

💭
Happy to be contributing!
View GitHub Profile
@brianhanifin
brianhanifin / LetMeGoogleThatForYou.js
Created February 24, 2009 02:17 — forked from bollwyvl/LetMeGoogleThatForYou.js
Let Me Google That For You (LMGTFY)
CmdUtils.CreateCommand({
name: "lmgtfy",
synonyms: ["letmegooglethatforyou"],
takes: {"words to google": noun_arb_text},
icon: "http://letmegooglethatforyou.com/favicon.ico",
description: "Replaces the selected words with a <a href=\"http://www.tinyurl.com\">TinyUrl</a> of the <a href=\"\">Let Me Google That For You</a> link",
preview: function( pblock, urlToShorten ){
pblock.innerHTML = "Replaces the selected URL with a tiny LMGTFY url.";
var baseUrl = "http://tinyurl.com/api-create.php?url=http://letmegooglethatforyou.com/?q=";
pblock.innerHTML = "Replaces the selected URL with ",
@brianhanifin
brianhanifin / zigbee2mqtt_aqara_wireless_switch.yaml
Last active October 30, 2022 19:54 — forked from rhl2401/zigbee2mqtt_aqara_wireless_switch.yaml
Aqara Wireless Switch (single, double, hold)
blueprint:
name: Aqara Wireless Switch (single, double, hold)
description: 'Control anything using Aqara Wireless Switch.
Customizable actions for each press.
This version of the blueprint is for buttons supporting single, double and hold actions.
'
domain: automation
@brianhanifin
brianhanifin / ubiquity-craigslist-sandiego.js
Created February 28, 2009 01:59
Craigslist: San Diego Search
CmdUtils.makeSearchCommand({
name: "craigslist-sandiego",
url: "http://sandiego.craigslist.org/search/sss?query={QUERY}",
icon: "http://sandiego.craigslist.org/favicon.ico",
description: "Searches sandiego.craigslist.org"
});
//Note: This command was automatically generated by the create-new-search-command command.
@brianhanifin
brianhanifin / gist:0787b85749d6460a45eb2b17cba43b88
Created August 6, 2020 14:26
Script: inovelli_led, using the new OZW integration
# Calculation References:
# https://nathanfiscus.github.io/inovelli-notification-calc/
# https://community.inovelli.com/t/home-assistant-2nd-gen-switch-rgb-working/168/62
# https://docs.google.com/spreadsheets/u/1/d/1SGJrJHCUtz8AzznWL_mLCTJjjr2U0IpltcUkRr7N_6M/edit?usp=sharing
#
# Changes:
# July 22, 2020: Incorporating some changes from Kevin Schlichter.
# https://github.com/kschlichter/Home-Assistant-Inovelli-Red-Dimmer-Switch
#
# August 6, 2020: Converting `zwave` service to `ozw` service due to the new Z-Wave integration.
@brianhanifin
brianhanifin / _example.yaml
Last active January 24, 2020 23:01
post-2020-01-21 scripts
service: script.inovelli_led
data:
entity_id: zwave.dimmer_family_room
color: purple
dimmer: "true" # Set to "false" for the non-dimmable switch.
duration: 10 seconds
effect: chase
level: 10
@brianhanifin
brianhanifin / automation.front_door_locked.yaml
Last active January 22, 2020 03:40
post-2020-01-21 automations
---
alias: front_door_locked
initial_state: true
trigger:
- platform: state
entity_id: lock.front_door
from: 'unlocked'
to: 'locked'
action:
# Return the Status LED to normal.
@brianhanifin
brianhanifin / add_time()
Last active January 19, 2020 05:01
HASS Jinja2 Date/Time Macros
{% macro add_time(time, add_minutes) %}
{% if time|lower != 'unavailable' %}
{% set time = time.split(':') %}
{% set hour = time[0]|int %}
{% set minutes = time[1]|int %}
{% if (minutes + add_minutes) < 60 %}
{{ "%0.02d:%0.02d"|format(hour, minutes + add_minutes) }}
{% else %}
{{ "%0.02d:%0.02d"|format(hour + 1, (minutes + add_minutes) - 60) }}
{% endif %}
@brianhanifin
brianhanifin / csv entity state + attributes
Last active January 18, 2020 04:14
HASS-CLI Snippets
hass-cli --columns=ENTITY="entity_id,state,attributes[duration],attributes[remaining]" --no-headers --table-format tsv state list ^timer \
| grep active \
| sed -e 's/timer.//g' \
| sed -e 's/\<active\>//g' \
| sed -e 's/\t/,/g' \
| sed -e 's/,,/,/g' \
| sed -e 's/ //g' \
www/data/active_timers_snapshot.csv
@brianhanifin
brianhanifin / sonoff_s31_01
Last active November 7, 2019 16:10
See https://github.com/brianhanifin/esphome-config for current configuration + more.
# Sonoff S31 Power Monitoring Plug
#
substitutions:
devicename: sonoff_s31_01
upper_devicename: Sonoff S31 01
esphome:
name: ${devicename}
platform: ESP8266
board: esp01_1m
@brianhanifin
brianhanifin / 1. automation.xiaomi_button_click
Last active September 16, 2019 03:59
Home Assistant: Xiaomi Button Click Event Handler
alias: xiaomi_button_click
initial_state: on
trigger:
platform: event
event_type: xiaomi_aqara.click
action:
#click_types: single, double, long, both, double_both, long_both
- service: script.xiaomi_button_handler
data_template:
button: >