Skip to content

Instantly share code, notes, and snippets.

View j4velin's full-sized avatar
:octocat:

Thomas Hoffmann j4velin

:octocat:
View GitHub Profile
@j4velin
j4velin / hue_knx.yaml
Created October 24, 2025 18:55
HA Blueprint to switch a Hue light from KNX
blueprint:
name: Switch Hue light from KNX
description: Turn a Hue light on or off from a KNX telegram
domain: automation
input:
knx_address:
name: KNX group address to switch the light
target_light:
name: Hue light entity to switch
selector:
#! /usr/bin/python
from flask import Flask
from flask import request
import subprocess
import datetime
http_server = Flask(__name__)
scan = None
@j4velin
j4velin / door.py
Created May 25, 2024 08:49
React on door ring button press by taking a photo, sending UDP broadcast and playing jingle bells
#!/usr/bin/python3
from gpiozero import Button, TonalBuzzer
from gpiozero.tones import Tone
from picamera import PiCamera
from time import sleep
import socket
import threading
buzzer = TonalBuzzer(27, octaves=1, mid_tone="A4")
@j4velin
j4velin / firefly.py
Created October 8, 2022 19:15
DKB -> Firefly CSV Converter
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import csv
import re
accounts = [ "add account numbers here" ]
def handleAccount(input):
@j4velin
j4velin / scan.sh
Last active October 24, 2025 18:58
Scans the given number of pages and moves the resulting pdf to the input directory for the ocr.sh script
#!/bin/bash
count=$1
resolution=150
if [ $count -gt 1 ]; then
scanimage --batch=scan_%d.tiff --batch-count=$count --format=tiff --resolution $resolution --batch-prompt
resultcode=$?
if [ $resultcode -eq 0 ]; then
tiffcp $(ls -v | grep scan_) scan.tiff
rm scan_*
@j4velin
j4velin / ocr.sh
Last active January 20, 2022 14:30
Script to run ocrmypdf on new pdf files and move the ocr'ed version to the paperless input directory
#/bin/bash
workdir=/home/pi/ocr.work
scaninput=/home/pi/scaninput
outdir=/home/pi/paperless.consume
inotifywait -m -e close_write -e moved_to $scaninput |
while read -r path action file; do
echo "Waiting for $file..."
sleep 10
@j4velin
j4velin / fan_control.py
Last active March 7, 2020 17:26
Temperature based fan control script for Raspberry Pi 4
#! /usr/bin/python
import subprocess
import time
import re
from gpiozero import LED
PIN = LED(17)
MAX_TEMP = 50
MIN_TEMP = 45