This is a very lean little project based on SpringBoot 2.0M7 and Pi4J. I'm planning to use this in a SmartThings SmartApp later so I can see my Pi's status in the SmartThings app. The idea came from here
Simply
mvn clean install
Change the src/main/resource/application.properties
file and set the IP address or hostname of the Pi for the variable upnp.config.address
. You can also pass this information with the -Dupnp.config.address=<myipaddress>
parameter at startup
sudo nano /etc/rc.local
Then add the below line above the last one (that exits)
java -jar /path/to/jar/raspberrypi.monitor.jar &
http://raspberrypi:8080/api/pi
Would yield something like this:
{
"cpuTemperature": 52.1,
"serialNumber": "0000000000000000",
"cpuCoreVoltage": 1.2,
"modelName": "ARMv7 Processor rev 4 (v7l)",
"boardType": "RaspberryPi_3B",
"totalMemory": 967700480,
"usedMemory": 221253632,
"freeMemory": 401907712,
"sharedMemory": 14475264,
"javaVersion": "1.8.0_152",
"hostname": "raspberrypi",
"ipAddresses": [
"192.168.1.40",
"172.17.0.1"
],
"cpuFrequency": 600000000
}