A system to visualise open/closed state, and the on/off state of various sensors/objects/sockets in Sheffield Hackspace.
The visuals are generated by nnenov
install
python -m venv env
source ./env/bin/activate
pip install -r requirements.txt
echo "[]" > history.jsonconvert images
# the info beamer Pi does not render images very well, so we downsize them to
# reduce the response times from 30s to 3s
for file in ./*; do
fn="${file%.*}"; convert -resize 800x "${file}" "${fn}.webp"
done
scp ./*.webp sensepi:/usr/shhm/space-state-visualiser/static/icons/
sed -i templates/index.html 's+png+webp+'Flask debug
flask --app server runtest MQTT commands
mosquitto_pub -h mosquitto.shhm.uk -t "SHHNoT/lights/room_d/command/switch:0" -m on
mosquitto_pub -h mosquitto.shhm.uk -t "state/SS/943CC682D374/input" -m '{"Door Open": false}'run in 'production'
pip install gunicorn eventlet
gunicorn -b 0.0.0.0 --worker-class eventlet -w 1 server:apprun with systemd
# set up permissions
sudo useradd -r -s /bin/false spacestate
sudo chmod g+w history.json
sudo chown $USER:spacestate history.json
# turn on systemd service
sudo cp space-state-visualiser.service /etc/systemd/system/space-state-visualiser.service
sudo systemctl enable space-state-visualiser.service
sudo systemctl start space-state-visualiser.service
sudo systemctl status space-state-visualiser.service