Thanks I manually added and is working fine!
Any chance to add a reboot button on this?
Nice work btw.
Pi4J doesn’t support it but by executing a shell command could work
I finally managed to implement the UPNP discovery but since I am not a Java guy, i ended up with a Python based solution.
My github version here if it can help.
Thank you, i’ll check it out!
I noticed you added device health? Will this give some type of notification if the device goes off-line, etc? I’m wondering if this device can be monitored by WebCoRE?
it does show the little red dot if the PI is not accessible, yes
This is a great integration. Unfortunately it appears that the java process stops answering requests after a day or two. The way to get it back is a “sudo killall java”, then re-starting the process. I have this running on 5 pi’s, all exhibit this behavior but not in any predictable way.
I’ve seen the UPnP process failing and that brings down the whole enchilada. I’ve made a change locally but didn’t push it that if the UPnP service dies it doesn’t bring down the whole Spring application. Just open the class
UpnpListener and remove the below lines:
ConfigurableApplicationContext context = (ConfigurableApplicationContext) UpnpListener.this.applicationContext; context.close();
mvn clean install and done. I’ll push the change to the repo at some point.
Excellent. I’ll try it on one of my units for a few days before pushing it to them all. Thanks!
In case you would like to switch to a python implementation, mine is running fine for 10 days now. I have 2 Pi running.
I’m trying to install the monitor on my pi but when I type this:
“java -jar target/raspberrypi.ledcontroller-0.0.1-SNAPSHOT.jar”
I get this:
“Error: Unable to access jarfile target/raspberrypi.ledcontroller-0.0.1-SNAPSHOT.jar”
I assume it’s something I need to download but couldn’t find it in the repo.
what am I doing wrong?
You need to build first. Install Maven and JDK and run mvn clean install.
Hi, I get the following error message when trying to access the api page (build completes with no errors, apache runs fine on localhost):
There was an unexpected error (type=Internal Server Error, status=500).
No converter found for return value of type: class com.cl0udninja.raspberrypi.monitor.web.dto.SystemInfoDTO
Could you pls share the whole stack trace? Are you running the jar with sudo? Frankly I didn’t keep this up to date, the upnp causes the service to die every couple of days, so I got rid of it in another repo.
Thanks for taking the time to respond. I got the api running on the Pi and found it by manually creating the device and using ‘Add a Thing’ on the app. The issue now is that the app is blank, live logging on smartThings shows the following when I press restart on the SmartApp:
f8f651cf-f944-426e-afb4-2c3299095e45 12:04:29: debug Getting Pi data GET /api/pi HTTP/1.1
User-Agent: Linux UPnP/1.0 SmartThings
f8f651cf-f944-426e-afb4-2c3299095e45 12:04:29: debug Device network id: 728A82E8:1F90
f8f651cf-f944-426e-afb4-2c3299095e45 12:04:29: debug Executing ‘refresh’
The jar file doesn’t react with any output.
Is the 18.104.22.168 IP correct? If you type in http://22.214.171.124:8080/api/pi into your browser do you get a response?
For some stupid reason I had assumed host was referring to the device that sent the refresh request…
When I originally converted the IP to hex I omitted the periods, I included those and reset the network ID.
Works perfectly now! Thank you for the help and this great piece of work…now to figure out how to issue a state change when a face is detected on the pi. Any tips on how to approach this?
I’m glad to hear that! If you’re using the version with the UPnP though (https://github.com/cl0udninja/raspberrypi.monitor) it tends to die every couple of days. If you delete the following files from the downloaded repo and to a fresh maven clean install it has no stability issues:
src/main/java/com/cl0udninja/raspberrypi/monitor/UPnPConnector.java src/main/java/com/cl0udninja/raspberrypi/monitor/web/UpnpListener.java src/main/java/com/cl0udninja/raspberrypi/monitor/web/UpnpSettingsController.java
As a result it won’t be discoverable any more and you need to provide the IP address and manually add your PI.
@cl0udninja I can’t get your smart app to find the monitor. I let it run for 30 minutes and nothing.