Skip to content

Instantly share code, notes, and snippets.

@tserong
tserong / set-minsoc.py
Created November 9, 2023 08:07
Set the minum state of charge to the specified value, or zero if it's a maintenance day and the --check-maintenance paramenter is set.
#!/usr/bin/env python3
import argparse
import dbus
import logging
import requests
from datetime import datetime
# Note that when log output lands in /var/log/messages via cron, lines are
# truncated at about 250 characters for some reason.
#!/bin/bash
HOME=${HOME:-/tmp}
WARNING_URL=ftp://ftp.bom.gov.au/anon/gen/fwo/IDT29000.txt
LAST_WARNING=$HOME/sheep-graziers-warning.last
NEXT_WARNING=$HOME/sheep-graziers-warning.next
rm -f $NEXT_WARNING
/usr/bin/curl -s -o $NEXT_WARNING $WARNING_URL
[ -e "$NEXT_WARNING" ] || exit 0
@tserong
tserong / rc.local
Created July 1, 2022 04:10
/data/rc.local script for Victron Cerbo GX to install custom crontab entry to run /home/root/sched.py
#!/bin/sh
if ! grep -q 'sched\.py' /etc/crontab; then
mount | grep -q 'on / .*ro'
is_ro=$?
if [ $is_ro -eq 0 ]; then
mount -o remount,rw /
fi
cat >> /etc/crontab <<EOF
# Set scheduled charges based on zcell maintenance cycle
@tserong
tserong / sched.py
Created July 1, 2022 02:59
Set scheduled charges on a single ZCell, to generally keep the battery full except for peak electricity usage times, and maintenance cycle days
#!/usr/bin/env python3
#
# Set scheduled charges on a single ZCell, to generally keep the
# battery full except for peak electricity usage times, and maintenance
# cycle days. Peak electricity usage times are 07:00-10:00 and
# 16:00-21:00 per Aurora Energy in Tasmania. This will need adjusting
# by one hour if used during daylight savings time.
#
# This script is designed to be run on the GX from cron at 07:00 each
# day (just as peak electricity starts), because that makes the scheduled
@tserong
tserong / zcell-warnings.sh
Created April 27, 2022 06:16
Log ZCell voltage, bus voltage and warning indicator status
#!/bin/bash
#
# Polls the ZCell BMS REST API once per second and prints the
# voltage, bus voltage and warning indicator status if they've
# changed since the last poll. Runs indefinitely.
# Requires `curl` and `jq`.
#
# Note: this only looks at the first battery in the system
# (".list[0]" in the `jq` invocation).
#
@tserong
tserong / zcell-soc.sh
Last active April 27, 2022 06:22
Log ZCell state of charge
#!/bin/bash
#
# Polls the ZCell BMS REST API once per minute and prints the
# current state of charge. Runs indefinitely.
# Requires `curl` and `jq`.
#
# Note: this only looks at the first battery in the system
# (".list[0]" in the `jq` invocation).
#
#!/usr/bin/env python3
#
# This script sets the service name (i.e. drive group) for the given OSDs
# on the host on which it is executed.
#
# For example, to set service_name=osd.foo for OSDs 1, 2 and 3, you'd run:
#
# ./set-osd-service-name.py osd.foo 1 2 3
#
# For each OSD specified, it will set service_name in that OSD's unit.meta
@tserong
tserong / zcell-contactor-state.sh
Last active April 27, 2022 06:21
Log ZCell contactor state
#!/bin/bash
#
# Polls the ZCell BMS REST API once per second and prints the
# state of the Charge, Discharge and Energy Extrator (Strip)
# contactors if they've changed since the last poll. Will
# run forever, or until all three contactors are open at the
# same time, whichever comes first.
# Requires `curl` and `jq`.
#
# Note: this only looks at the first battery in the system
#!/usr/bin/env python3
#
# This script sets the osdspec_affinity (i.e. drive group) for the given OSDs
# on the host on which it is executed.
#
# For example, to set osdspec_affinity=foo for OSDs 1, 2 and 3, you'd run:
#
# ./set-osdspec-affinity.py foo 1 2 3
#
# For each OSD specified, it will:

Hommus

Ingredients

  • 2 cloves garlic, chopped
  • 1/4 cup water
  • 1/4 cup lemon juice
  • 1 400g can chickpeas, drained & rinsed
  • 1/2 cup tahini
  • 1 tsp salt