Skip to content

Instantly share code, notes, and snippets.

blueprint:
name: Set door codes webhook
description: >
Webhook that sets a door code slot on multiple lock entities using set_usercode.
IMPORTANT: When setting up this automation, click the gear icon beside the Webhook ID
to choose whether the webhook is 'Only accessible from the local network'.
domain: automation
input:
secret_token:
name: Secret Token
@samj
samj / battery-health-check.py
Created November 27, 2023 11:18
A Python script to monitor MacBook battery health. It checks the battery's maximum capacity and sends a macOS notification if the capacity falls to 80% or below. Useful for keeping an eye on battery health and knowing when it might be time to consider servicing or replacing the MacBook's battery.
#!/usr/bin/env python3
import subprocess
import re
import os
def get_battery_health():
# Run the system_profiler command to get battery information
result = subprocess.run(["/usr/sbin/system_profiler", "SPPowerDataType"], capture_output=True, text=True)
output = result.stdout