forked from openenergymonitor/emonpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemonpiupdate
executable file
·57 lines (43 loc) · 2.12 KB
/
emonpiupdate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
echo
echo "================================="
echo "EmonPi update started"
echo "================================="
echo
echo "EUID: $EUID"
echo
# Needed for emonPi LCD Hi-Link 3G dongle support
# ALLREADY INSTALLED
# sudo pip install xmltodict
# sudo pip install requests
sudo pip install paho-mqtt --upgrade
sudo /etc/init.d/emonhub stop
echo "Start ATmega328 serial upload using avrdude with latest.hex"
# Discrete Sampling
echo "Discrete Sampling"
echo "avrdude -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/home/pi/emonpi/firmware/compiled/latest.hex"
avrdude -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/home/pi/emonpi/firmware/compiled/latest.hex
# RFM12Pi with RFM12B update
# avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 38400 -U flash:w:/home/pi/RFM2Pi/firmware/RFM69CW_RF_Demo_ATmega328/RFM12_Demo_ATmega328.cpp.hex
# RFM69Pi with RFM69CW Update
# avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 38400 -U flash:w:/home/pi/RFM2Pi/firmware/RFM69CW_RF_Demo_ATmega328/RFM69CW_RF12_Demo_ATmega328.cpp.hex
sudo /etc/init.d/emonhub start
#########################################################################################################
# Add bash prompt RW / RO emonPi file-system indicator
if ! grep -q "# emonPi bash RW / RO prompt" /etc/bash.bashrc ; then
echo "Add RW bash prompt indicator"
sudo bash -c 'cat /home/pi/emonpi/bash-rw-indicator >> /etc/bash.bashrc'
fi
#########################################################################################################
# Move ~/.npm folder to RW folder ~/data/npm to allow npm packages to be installed when emonPi is in RO mode
if [ ! -d /home/pi/data/npm ]; then
echo "moving ~./npm to ~/data/npm and create symlink"
mv /home/pi/.npm /home/pi/data/npm
ln -s /home/pi/data/npm /home/pi/.npm
fi
#########################################################################################################
# Install / update nodeRED emonPixel & Emoncms nodes
cd /home/pi/.node-red
npm install https://github.com/openenergymonitor/node-red-contrib-emonpixel
npm install node-red-node-emoncms
cd /home/pi