Skip to content

Instantly share code, notes, and snippets.

@spinpwr
spinpwr / motion_lights.py
Last active December 31, 2022 16:04
Python class for appdaemon using Sonoff motion sensor
import hassapi as hass
#
# App to turn lights on when motion detected then off again after a delay
#
# Use with constraints to activate only for the hours of darkness
#
# Args:
#
# sensor: binary sensor to use as trigger
@spinpwr
spinpwr / auto_reschedule_cron.sh
Last active September 12, 2022 16:10
bash script that reschedules it self to run at random time in crontab
#!/usr/bin/env bash
# Script that reschedules is self in crontab
# Should be added to crontab manually first
# Also add/call the "real job" (actual program) you want to run in crontab
# Comes with NO warranty, use at your own risk!
# Max range for added random time
days=30
hours=10