Skip to content

Instantly share code, notes, and snippets.

Andrew Elwell Elwell

Block or report user

Report or block Elwell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Elwell
Elwell / mq_apc.py
Created Feb 9, 2012
apcaccess (APCupsd) to MQTT python script
View mq_apc.py
#!/usr/bin/python
# Script to poll the UPS (via apcupsd) and publish interesting facts to
# MQTT.
# Published under GPL3+ by Andrew Elwell <Andrew.Elwell@gmail.com>
import subprocess
# we use mosquitto for the MQTT part
@Elwell
Elwell / lnet.conf
Created Jul 9, 2019
Lustre LNET metrics parsing for collectd
View lnet.conf
LoadPlugin table
<Plugin table>
<Table "/proc/sys/lnet/stats">
Plugin "lustre"
Instance "lnet"
Separator " "
<Result>
InstancePrefix "msgs_alloc"
Type gauge
ValuesFrom 0
View automations.yaml
- alias: Gloworb on for ISS pass
trigger:
platform: state
entity_id: binary_sensor.iss
to: 'on'
action:
service: light.turn_on
data:
brightness: 100
rgb_color: [0, 0, 255]
@Elwell
Elwell / ruuvi2influxdb.py
Created Jan 15, 2018
Ruuvitag to influxdb
View ruuvi2influxdb.py
#!/usr/bin/python3
from influxdb import InfluxDBClient
from ruuvitag_sensor.ruuvi import RuuviTagSensor
tags = {'F6:B4:FB:E9:7C:A8':'incubator'}
client = InfluxDBClient(host="localhost", port=8086, database="sensors")
@Elwell
Elwell / psu.ino
Created Aug 28, 2017
Arduino PSU control
View psu.ino
/* Arduino control for (ex) server PSU
* Andrew Elwell <Andrew.Elwell@gmail.com> August 2016
* Released under BSD licence
*/
/* Controls / Pins based on data sheet available at
* https://belfuse.com/resources/PowerSolutions/SFP1050/bcd20031_ab_sfp1050-12bg.pdf
*
* A6/B4/C4/D4 +3.3 standby (power to arduino)
* A3/B1/B3/C1/C3/D3 Return
View gist:acbfb4fc02585ab3aeb1208ec68108ba
aelwell@a042:/scratch/pawsey0001/aelwell/dnet/a042$ ./dnetc -bench
distributed.net client for Linux Copyright 1997-2016, distributed.net
Please visit http://www.distributed.net/ for up-to-date contest information.
Start the client with '-help' for a list of valid command line options.
dnetc v2.9112-521-CFR-16020313 for Linux (Linux 4.4.59-92.24-default).
Please provide the *entire* version descriptor when submitting bug reports.
The distributed.net bug report pages are at http://bugs.distributed.net/
@Elwell
Elwell / apc2pacube.py
Created Feb 24, 2012
apcaccess (APCupsd) to Pachube python script
View apc2pacube.py
#!/usr/bin/python
# Script to poll the UPS (via apcupsd) and publish interesting facts to
# pachube. You'll need to alter FEED_ID and insert your API key
# Published under GPL3+ by Andrew Elwell <Andrew.Elwell@gmail.com>
import subprocess # we scrape apcaccess output
import requests # CBA writing a pachube library
@Elwell
Elwell / doorbot.ino
Last active Nov 7, 2016
New doorbot stuff
View doorbot.ino
/* Artifactory Doorbot - Arduino code to connect to reader
and relays.
Andrew Elwell <Amdrew.Elwell@gmail.com>
Nov 2016
*/
/* Hardware Config - Via IRC with Lt_Lemming
* "I've not done the diagram yet, been too busy building it
View sample published info
andrew@mythic:~$ mosquitto_sub -t 'sensors/+/json' -v
sensors/garage/json { "temp": 32.40, "humidity": 35.90 }
sensors/ESP-10264644/json { "temp": 24.1, "humidity": 56.8 }
sensors/garage/json { "temp": 32.50, "humidity": 36.00 }
sensors/ESP-10264644/json { "temp": 24.1, "humidity": 56.7 }
sensors/garage/json { "temp": 32.40, "humidity": 36.00 }
sensors/ESP-10264644/json { "temp": 24.1, "humidity": 56.5 }
sensors/garage/json { "temp": 32.40, "humidity": 36.10 }
sensors/ESP-10264644/json { "temp": 24.1, "humidity": 56.4 }
^C
@Elwell
Elwell / gist:6505599
Created Sep 10, 2013
mosquitto debugging
View gist:6505599
read_pv was failing when publishing (hangs after publish), so knocked up a dummy test client with static dictionary
andrew@guruplug:~$ ./debug_mqtt.py
{'AC_Hz': 2925, 'PV_A': 11, 'Out_W': 3428, 'PV_W': 3355, 'PV_V': 3014, 'kWh_Total': 1851, 'timestamp': 1378793395.40962, 'pid': 6573, 'kWh_today': 17, 'AC_V': 11}
loop start
^C
^C
^Z
[2]+ Stopped ./debug_mqtt.py
andrew@guruplug:~$ killall debug_mqtt.py
You can’t perform that action at this time.