Skip to content

Instantly share code, notes, and snippets.

View robsonke's full-sized avatar
💭
Hoorray!

Rob Sonke robsonke

💭
Hoorray!
View GitHub Profile
@robsonke
robsonke / toilet-light-control.yaml
Last active April 16, 2024 18:43
Toilet light control
blueprint:
name: Toilet light control
description: Turn on a light when motion is detected or when the door opens. And turn off once closing again.
There are also two timers, on for daytime and one for nighttime.
domain: automation
input:
motion_entity:
name: Motion Sensor
selector:
entity:
@robsonke
robsonke / motion-illuminance-dimmable-nightmode.yaml
Last active October 2, 2023 19:59
Based on https://gist.github.com/Danielbook/ad8dacabb8dc01e7cf062cbd8c1a00ed but with different brightness values for day and night and support for multiple motion sensors
blueprint:
name: Motion-activated Light with illuminance, nightmode and dimmable
description: Turn on a light when motion is detected and illuminance is below a
set Lux level. The light will dim before it is turned off to signal that it has
not detected motion in quite a while. There is also two timers, on for daytime
and one for nighttime.
domain: automation
input:
motion_entity:
name: Motion Sensor
@robsonke
robsonke / device-off-warning.yaml
Created September 16, 2022 18:18
Alert when cooling devices are off too long
blueprint:
name: Alert when cooling devices are off too long
description: Many of my devices do have a power metering including the option to turn off the device. This is nice but we want to avoid turning off a fridge for hours accidentally.
domain: automation
input:
switch:
name: Switch Entity
description: The switch we want to monitor.
selector:
entity:
@robsonke
robsonke / window-open-temperature.yaml
Last active February 23, 2022 20:37
Home Assistant Blueprint - Inform in case window is open and the temperature becomes below a specific value. Or inform when you open a window and it's already freezing cold.
blueprint:
name: Window Open Warning
description: Inform users when windows are open and the temperature is dropping too much.
domain: automation
input:
temp_sensor:
name: Temperature Sensor
description: Temperature Sensor to check.
selector:
entity:
@robsonke
robsonke / heating.yaml
Last active September 18, 2022 18:56
Home Assistant Blueprint for controlling your heater. Based on https://community.home-assistant.io/t/another-heating-control/259363 but without the person checks and using simple switch entities instead of climate control but plus checks on window sensors to avoid useless heating and price checks for dynamic energy pricing.
blueprint:
name: Heating Control
description: Control your heating with options if temp is below a specific value,
set temp, and heating between specific times.
domain: automation
input:
heating:
name: Climate Switch
description: The climate switch to use.
selector:
#!/bin/bash
#
# Simple Bash script to fix a merge conflict with either mine or yours as option
#
# @author R. Sonke
#
bold=$(tput bold)
normal=$(tput sgr0)
doTheMerge () {
#!/bin/sh
#############################################
## Bash script to cleanup git repositories ##
## Author: Rob Sonke ##
#############################################
# To execute this in all subdirs of the current dir:
# for d in ./*
# do
# (cd $d && ~/Downloads/removeOldBranches.sh)
@robsonke
robsonke / soundnodeapp.py
Created December 11, 2016 07:55
This lets soundnodeapp uses your own client id and eliminates the api limit.
import getpass
import json
import re
import requests
client_id = re.compile(',client_id:"(.*?)"').search(requests.get(re.compile('src="https://a-v2.sndcdn.com/assets/app-.*.js"').search(requests.get('https://soundcloud.com/').text).group()[5:-1]).text).group()[12:-1]
username = raw_input('Username: ')
password = getpass.getpass()
@robsonke
robsonke / resize-images.sh
Last active September 10, 2016 12:15
Resizes and renames image files in the current directory using sips (osx). Can be rewritten to imagemagick easily to make it work on Linux too.
# Given a collection of image files, this function will resize
# the images in the current folder and saves them in the subfolder resized
#
# Usage: resize-images
# Note: the read command is specific for ZSH shells, for Bash, use -p param. Same for the setopt, it's shopt for bash.
#
## Resize and rename images in the current directory and writes them to a resized subfolder
function resize-images() {
read "filename?What would you like the filename to be started with? []: "
read "width?What max width in pixels would you like your images? [1024]: "
@robsonke
robsonke / switchOsxLocation.sh
Last active May 9, 2016 06:48
A simple bash script switching osx locations based on the active wifi network
#! /bin/bash
#######################################################
## Simple bash script to change OSX network location ##
## based on the wifi network you're connected too. ##
## Author: Rob Sonke ##
#######################################################
#
# NOTE: Make sure you add this line to the /etc/sudoers file to allow