Skip to content

A system to visualise open/closed state, and the on/off state of various sensors/objects/sockets in Sheffield Hackspace.

Notifications You must be signed in to change notification settings

sheffieldhackspace/space-state-visualiser

Repository files navigation

Space State Visualiser

A system to visualise open/closed state, and the on/off state of various sensors/objects/sockets in Sheffield Hackspace.

illustration of hackspace, showing green and red objects

Visuals

The visuals are generated by nnenov

Development

install

python -m venv env
source ./env/bin/activate
pip install -r requirements.txt
echo "[]" > history.json

convert 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 run

test 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:app

run 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

About

A system to visualise open/closed state, and the on/off state of various sensors/objects/sockets in Sheffield Hackspace.

Topics

Resources

Stars

Watchers

Forks