[OBSOLETE] Raspberry Pi Device Type

Take a look at forking my repo and submitting a pull request. I think I might have SmartThings under one repository so let me know if you’d like me to move it to a separate one for easier management.

Fork a repo

I’ve recently received my new Raspberry Pi 2 and so I’m switching to that one as my dedicated server and will now use my old RPi B as my R&D device. I will resume developing this template to see if I can make it discoverable on the network, similar to the Sonos systems.

Update: I’ve looked into the documentation about how to find LAN devices on the network and it looks like there’s an option to use SSDP. I’ve successfully broadcasted the SSDP protocol using node.js and node-ssdp running on my RPi. My next step is to try and communicate with it using a SmartApp. If anyone is interested in seeing my development let me know so that I can share my documentation on which step I’m on.

NickW,

Great work! I was just setting up my Rpi this week for the garage project and was thinking if it was possible to integrate with ST. Seem like you are few steps ahead! Very interested on your new finding. Do you know if the SSDP will work on the old rpi B model?

thanks!

3:51:33 PM: error groovy.json.JsonException: Lexing failed on line: 1, column: 1, while reading ‘<’, no possible valid JSON value or punctuation could be recognized. @ line 125

i keep getting this error. any suggestions, I’m new to smartthings, and would like to be able to use my hardwired door sensors that go to my pi, and also the temp sensors. but i cannot get past this error

After I found that WebIoPi doesn’t fully work with the Raspberry Pi 2, I looked at berryio, It looks much better than webiopi and it supports api commands.

I started a new branch on the berryio to add a smartthings api command and have just gotten it to populate the same device tiles as the original webiopi version. I also modified your device type to talk to the new api command.

here are links to what I have so far. keep in mind, I am new to this so my code has room for improvement.

2 Likes

Thanks for posting this. I’ve added a note to the GitHub README and I’ll also make a note to the top post in this thread.

@NickW I’m giving this a try and I’m getting an error. When I try to access http://myraspberrypi:8000/macros/getData it 404’s. Likewise, in the SmartThings logging I see:

groovy.json.JsonException: Lexing failed on line: 1, column: 1, while reading '<', no possible valid JSON value or punctuation could be recognized. @ line 125

This is on a Raspberry Pi B+. Not sure what’s wrong. WebIOPi starts fine and I see it in a ps aux.

Thoughts?

Seeing the same thing here, any ideas anywhere?

seeing the same here. when I enable the logging in the device type this is what i am seeing.

> ffc7f141-0563-49f5-9248-59e95915e04a 7:10:59 PM: error groovy.json.JsonException: Lexing failed on line: 1, column: 1, while reading '<', no possible valid JSON value or punctuation could be recognized. @ line 125
> ffc7f141-0563-49f5-9248-59e95915e04a 7:10:59 PM: debug body: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
> <head>
> <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
> <title>Error response</title>
> </head>
> <body>
> <h1>Error response</h1>
> <p>Error code: 500</p>
> <p>Message: Internal Server Error.</p>
> <p>Error code explanation: 500 - Server got itself in trouble.</p>
> </body>
> </html>

Something not configured correctly on the Pi side?

Problem is “psutil.avail_phymem” not returning any data.
Log: File “myproject/python/raspberrypi.py”, line 39, in getData
memAvail = round(psutil.avail_phymem()/1000000,1)
AttributeError: ‘module’ object has no attribute 'avail_phymem’
Like test you can change in raspberry.py memAvail = round(psutil.avail_phymem()/1000000,1) to memAvail = 0

Thanks for the help… I modified the script to use this instead and it’s working great.

memAvail = round(psutil.virtual_memory().available/1000000,1)

1 Like

@NickW, yes I am very interested to learn about your project.
I am still in the first steps to integrate my RRPi with ST but I am aiming to have RPi as a 433Mhz receiver and transmitter and utilize inexpensive 433Mhz devices (door sensors, temperature, light switches, etc)
Please so share your findings!
Cheers

Hi @Garnet
Did you find new information on this topic (Registering the RPi for callbacks).
If you have, would you mind sharing it with me?
Thanks a ton!

@lukas: I have not sorry.
I did send events initiated from the Pi but ST never saw them, so I was hopping that they would eventually fix this as surely they need the capability of responding to event triggers unless they just continually poll from ST which is not an acceptable approach IMHO.
I basically gave up and have been experimenting with the ST Aurdino Shield to do the same thing.

  • Do please let me know if you figure this out though, and good Luck.

@NickW firstly thank you very much for your time and great detailed breakdown on this project.
I’m a little stuck and wondered if you would kindly help me out a little as I’m pretty new to code. I can work out the basics here and there by breaking it down into chunks but that’s as far as have gone so far - trial and error. I’m not a code person (yet!)
Anyway, I have grabbed an older pi for the sake of it which I had laying about given the issues known with pi2 for this project and I wanted to follow your instructions directly to start with.
I have follows the instructions best I can but ended up installing webiopi via pi store with Python 2 and 3 already on the noobs rasp in.
I have added my details at ST IDE and the pi shows added and active having found its own ID as you said it would with IP address.
The ST app shows the pi as ‘off’ and the other icons are blank.
I’m a little stuck at this point. I’m going to learn to add sensors etc today but wanted to just get to the stage you and others have with reading pi cup temps etc.
I also figured I might like to have these readings for the pi itself long term and then sensors on top/‘seperate’ device if you like
I’ll post some pics up if I can now. I think it may be a macro issue due to how installed the webiopi. I did this as the files have moved from G code pages. Maybe I shouldn’t of done so.
I thank you massively in advance! I’d love to integrate this into my smart home

ok so I have managed to confirm my pi is live within ST developers and if I click refresh on the app then although nothing visually happens as such I can see the device last activity updates to reflect the recent press. I’m getting no other data from the pi and all the tiles are blank barring the refresh, restart and off.
please can anyone kindly advise? id love to see data from the pi live before I add any sensors etc if this is possible.

apologies my first responses were typed on my phone and I seem to be limited to three posts in a thread as I’m new here.

many thanks in advance!

Hi I’d still appreciate a little help if anyone can advise as I’d hate to give up on this project.
I’m ok with hardware but not coding but once I learn to code I’m hoping to give back to the community the best I can

So, it seems some of the links are outdated in this thread and the tutorial at GitHub. I soon found the new links I needed. Since the links to the Google code files don’t exist and are hosted elsewhere/independently, it is important to use the correct links within command lines.
This also explains why (along with my lack of code knowledge) why I had issues to start with getting the project live at my end.
I believe I have overcome most the issues now having done a fresh install exactly as per guide. I even stayed away from auto installing Webiopi configuration through pi store just incase.

So in short, my Webiopi is connected and weaved is too. Both of these work on wifi and cellular. I can control GPIO with weaved and smartthings all seems set up ok. The restart button in my ST app will show a log within the events if press this.
I’m putting the rest of my issues down to lack of coding knowledge.
The tiles are greyed out within my ST app but as I say the restart seems to work.
The only buttons I have are off, restart and refresh. The others have dotted lines in them. In other words I don’t have live coloured tiles like in the screenshot with live pi data.
Is this something to do with the code?
I’m pretty sure I got the macro install part ok too.

Sorry if I sound vague and I’ll give more detail if I can. I’ve spent countless hours guessing
I’d like to get the live pi data working before I concentrate on sensors etc

Many thanks

Hi Martin, I ran into a similar issue with the blank tiles, I had to change a line that was doing the memory check on line 39 of raspberrypi.py:

memAvail = round(psutil.virtual_memory().available/1000000,1)

as this command was failing to return a result and crashing the entire check.