Raspberry Pi Monitor

Thanks I got it after some sleep and a cup of coffee I was able to think straight.

Next question…I have everything setup and can access the API via the web but Discovery is not finding anything in the SmartApp any thoughts?

There’re a couple of things I could think of

  • Do you have a firewall running on the Pi? UPnP works with UDP broadcast. I think my solution uses port 5000 and it needs ports 8080 and 8081 open as well.
  • You can run the jar with java -Dlogging.level.com.cl0udninja.raspberrypi.monitor=DEBUG -jar monitor.jar to see more logging and figure out what could be wrong.

If it still doesn’t work, you can add the device manually on the ST IDE, just go to Devices/New Device for type use the Raspberry Pi Monitor and for device id you need the IP address and the port (default is 8080) in this format ip:port. You need to convert both values to Hex.

You can use this online tool for the IP: https://ncalculators.com/digital-computation/ip-address-hex-decimal-binary.htm
And this for the port: https://ncalculators.com/digital-computation/ip-address-hex-decimal-binary.htm

So if your Pi’s IP is and the monitor runs on port 8080 the value you need to provide for Device Network Id is: C0A80164:1F90

I hope this works. If you send me the logs I could probably pinpoint what the problem is with UPnP

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!

1 Like

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.

Any ideas?

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;

Then mvn clean install and done. I’ll push the change to the repo at some point.

1 Like

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
Accept: application/json
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 IP correct? If you type in 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?