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
mkdir -p /usr/shhm/.ssh/
ssh-keygen -f /usr/shhm/.ssh/space-state-deploy-key
export GIT_SSH_COMMAND="ssh -i /usr/shhm/.ssh/space-state-deploy-key"
git clone git clone …
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 crop them
py image_transform.pyFlask 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