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 / 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 / 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 / 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 / _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 / 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 / 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: >
@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
[root@photos ~]# DMAPD_DEBUG=y dmapd -f
Loading /usr/lib/dmapd/0.0.48/modules/libav-meta-reader-gst.so.
Loading /usr/lib/dmapd/0.0.48/modules/libav-render-gst.so.
(process:703): GLib-GObject-CRITICAL **: Object class AVRender doesn't implement property 'volume' from interface 'DACPPlayer'
(process:703): GLib-GObject-CRITICAL **: Object class AVRender doesn't implement property 'shuffle-state' from interface 'DACPPlayer'
(process:703): GLib-GObject-CRITICAL **: Object class AVRender doesn't implement property 'repeat-state' from interface 'DACPPlayer'
@brianhanifin
brianhanifin / gist:1328593
Created October 31, 2011 19:27
Obj-C: Code execution timing snippet
NSDate *start = [NSDate date];
.
.
.
NSLog(@"duration: %f", [start timeIntervalSinceNow]);