Immutable Page History Attachments

MQTT/battery

MQTT / battery

Run this as a user-cronjob

#!/bin/sh

user="tomk32"
device="x240"
mosquitto_pub   -d  -h mqtt.devlol.org --insecure -t "$user/$device/temp" -m "`acpi -tt|cut -d' ' -f4`"
mosquitto_pub   -d  -h mqtt.devlol.org --insecure -t "$user/$device/battery" -m "`acpi -b|cut -d',' -f2|cut -d' ' -f2`"
mosquitto_pub   -d  -h mqtt.devlol.org --insecure -t "$user/$device/mem-used" -m "`free|grep Mem|awk '{print int($3/$2 * 100)"%"}'`"