Skip to content

Instantly share code, notes, and snippets.

@garbled1
garbled1 / directional_bond.yaml
Last active May 6, 2023 19:15
Homeassistant Blueprint - Directional Light Bonding with Brightness Sync
blueprint:
name: Directional Light Bonding with Brightness Sync
description: Bind light entity B to entity A's state
domain: automation
input:
light_1:
name: Controller Light A
selector:
entity:
domain: light
@garbled1
garbled1 / build_cbz.sh
Created October 28, 2020 15:17
Download webcomics with dosage into CBZ files nightly. Uses to_cbz and dosage
#!/bin/bash
source ~/venv/bin/activate
rm /comics/download/WebToons/*/complete.txt
dosage -b /comics/download -c @
COMIC_DL=/comics/download
COMIC_CBZ=/comics/cbz
COMIC_TMP=/comics/tmp
@garbled1
garbled1 / dawn.sh
Created May 18, 2020 16:02
Bash script to run something at dawn
#!/bin/bash
civ_tw=$(curl -s 'https://api.sunrise-sunset.org/json?lat=X&lng=Y&date=today&formatted=0' | json_pp | grep civil_twilight_begin | awk '{print $3}' | sed -e 's/[",]//g')
date_sec_ct=$(date -d ${civ_tw} +%s)
date_now=$(date +%s)
sleepsec=$((${date_sec_ct} - ${date_now}))
end_at=$((${date_sec_ct} + 3600))
echo "Sleeping for ${sleepsec}"
sleep ${sleepsec}
A few notes about MiLights from messing about.
If you link a light to 1 remote, you can link it as zone 1, and then to another remote, as a different zone.
(Apparently 3.0 devices can remember 4 linkings in a ring buffer)
If you then unlink from any remoe, it unlinks everything. The bulb forgets all other links.
The bulb has no memory for who told it what to do. If you turn it on with remote 1 and set to red,
then turn it off, then turn it on with remote 2, it will be red.