Client code for connecting eywa
When you get a new Raspberry Pi 2 board, you need to do:
- Update your apt-get utility:
sudo apt-get update
- Install your favorite editor:
sudo apt-get install vim
- Install websocket clinet:
sudo pip install websocket-client
- Edit raspberry_pi_2/python2.7/profile.json file to configure your connection to eywa
- Run
python ws_client.py
under raspberry_pi_2/python2.7/ directory
- copy following script to /lib/systemd/system/ws_client.service
[Unit] Description=websocket client for eywa After=multi-user.target
[Service] Type=simple ExecStart=/usr/bin/python /home/pi/github.com/xcodersun/vivoclients/raspberry_pi_2/python2.7/ws_client.py -p /home/pi/github.com/xcodersun/vivoclients/raspberry_pi_2/python2.7/profile/example.json -c /home/pi/github.com/xcodersun/vivoclients/raspberry_pi_2/python2.7/config/example.json Restart=on-success RestartSec=300
[Install] WantedBy=multi-user.target
-
run following commands chmod +x /home/pi/github.com/xcodersun/vivoclients/raspberry_pi_2/python2.7/ws_client.py sudo systemctl daemon-reload sudo systemctl enable ws_client.service (Configure it to be automatically started at boot time) sudo systemctl start ws_client.service (Start service)
-
check the status sudo systemctl status ws_client.service