Skip to content

Instantly share code, notes, and snippets.

View shbatm's full-sized avatar

shbatm shbatm

View GitHub Profile
@shbatm
shbatm / purge_clients.py
Created February 28, 2020 04:33
Purge Junk Unifi Clients
#!/usr/bin/env python3
import requests
from urllib.parse import urljoin
username = "REDACTED"
password = r"REDACTED"
cloud_key_ip = "192.168.1.2"
controller_port = 8443
site_name = "default"
@shbatm
shbatm / 001-README.md
Last active August 20, 2023 21:33
Home Assistant USBIP Z-Wave Setup w/ More Robust Restart Management
@shbatm
shbatm / isy_button_light.yaml
Last active August 1, 2023 15:20
Home Assistant Blueprint: ISY/IoX Button Light Control
blueprint:
name: ISY/IoX Button Light Control
description: |-
Control a light with an ISY/IoX button like a KeypadLinc or RemoteLinc.
Supports ON, FAST ON, OFF, FAST OFF, and a Nightlight mode (turn fast off while off)
Transition times are 1s for On/Off and 0s for Fast On/Fast Off.
domain: automation
input:
[{"id":"cf4c09c8.62a618","type":"subflow","name":"Proximity Direction","info":"","category":"","in":[{"x":100,"y":120,"wires":[{"id":"f3d3f8e3.baa6d8"}]}],"out":[{"x":900,"y":100,"wires":[{"id":"39d50f9b.dce93","port":0},{"id":"f3d3f8e3.baa6d8","port":1}]},{"x":900,"y":140,"wires":[{"id":"a83c7954.ef7ff8","port":0},{"id":"f3d3f8e3.baa6d8","port":2}]}],"env":[],"color":"#DDAA99","status":{"x":900,"y":200,"wires":[{"id":"811548e6.c2d138","port":0}]}},{"id":"fb59e76e.78b738","type":"switch","z":"cf4c09c8.62a618","name":"To/From","property":"payload","propertyType":"msg","rules":[{"t":"lte","v":"data.event.old_state.state","vt":"msg"},{"t":"gt","v":"data.event.old_state.state","vt":"msg"}],"checkall":"true","repair":false,"outputs":2,"x":380,"y":120,"wires":[["f1af8369.45e2d","47cc6705.3dbdb8"],["5df4fd11.b2f164","fe55edd.ac4731"]]},{"id":"f1af8369.45e2d","type":"counter","z":"cf4c09c8.62a618","name":"","init":"0","step":"1","lower":"","upper":"2","mode":"increment","outputs":"1","x":660,"y":100,"wires":[["39d50f
@shbatm
shbatm / room_card.yaml
Created December 24, 2020 12:40
Consolidated Room Card for Lovelace
#################################################################
# #
# YAML Anchors for Room Cards #
# #
#################################################################
---
# The following custom cards must be installed in HACS:
# - text-element
# - stack-in-card (or vertical-stack-in-card)
@shbatm
shbatm / device_tracker_purge.py
Created December 20, 2020 13:53
Purge Device Tracker Entries from Home Assistant Storage
#! /usr/local/bin/python3
# WARNING: USE AT YOUR OWN RISK, NOT RESPONSIBLE FOR BOTCHED HOME ASSISTANT CONFIGURATIONS
# Change the two lines below and run with `python3 device_tracker_purge.py`
PATH = "/config/.storage/core.entity_registry"
PURGE_PATTERN = "^device_tracker\."
import json
import logging
@shbatm
shbatm / get-image-urls.js
Created September 20, 2020 17:27 — forked from tobek/get-image-urls.js
Save images from chrome inspector/dev tools network tab
/* open up chrome dev tools (Menu > More tools > Developer tools)
* go to network tab, refresh the page, wait for images to load (on some sites you may have to scroll down to the images for them to start loading)
* right click/ctrl click on any entry in the network log, select Copy > Copy All as HAR
* open up JS console and enter: var har = [paste]
* (pasting could take a while if there's a lot of requests)
* paste the following JS code into the console
* copy the output, paste into a text file
* open up a terminal in same directory as text file, then: wget -i [that file]
*/
@shbatm
shbatm / ceiling-light.svg
Last active June 9, 2020 15:06
Ceiling Light SVG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shbatm
shbatm / README.md
Created December 16, 2018 21:20
Running diyHue on a non-default HTTP and HTTPS port

How to use non-default Ports for diyHue Project using NGINX

This GIST contains the files required to be modified in order to run diyHue on non-default HTTP and HTTPS ports.

This example uses ports 8080 for HTTP and 8443 for HTTPS and redirects the necessary paths from NGINX's default site.

Changes made to diyHue Files

The following lines must be changed in the diyHue source code, as there is no option provided to change the ports by default.

@shbatm
shbatm / README.md
Last active February 11, 2019 07:06
ISY Climate Device Mode Definitions