[OBSOLETE] Raspberry Pi Temperature Sensor

Using the
php page from my Pi I get to the smarthings page where I can authorize the token but when I hit Authorize I get a “Page isn’t working” Any Ideas??

the error on line 54 is simple enough - just enclose r.status_code in str()

ie print("Error: " + str(r.status_code))

Does it say “Page isn’t working” or “cannot authorize at this time”?

if the latter, note what I said above:
“One thing to point out (that I learned the hard way) is that your Smartapp must not have errors or throw exceptions when you are trying to authorize it. If it does, you will get a cryptic message saying that it cannot authorize you at this time, try later or contact support. The Smartapp doesn’t actually have to do anything though, just be free of errors.”

Page isn’t working. Is the message. I will make that correction and see what happens later this evening. Thanks

Well,
Fixing the code at line 54 stopped the error that I was getting. When running th epython code I now get an error 401. I suspect that is because I do not have the Auth code. opening the accesscode.php I get to the point where I am authorizing the devices and I get a page loading then a refresh and a “Page is not working”. I assume if all was working then I would have gotten another page that would give me the auth code, right? What other way is there t get the code?

Thanks

Has anyone gotten this to work with multiple temp sensors? So far I cannot get it to work at all :frowning: I found a way to get the Auth code I think. At least I was able to create a code to use with all Smatapps. I get no errors with the python script. It runs for about 15 minutes and exits with no errors. In live logging I see a update to a temp device but no data in the app.

I know this thread is a bit old, but I am hoping someone can help me.

I am trying to use the php script to get my auth token. I get as far as getting the “code” which is 6 characters, and it redirects to the php script, but then the script seems to get stuck, there is no response and the screen is just blank. From what I can tell, this code plus the the clientID and Secret should get me the access token.

Any ideas as to what the problem could be?

Have you looked into the much newer OmniThing? It is being actively developed and supported. Just an idea…

Thanks for your quick response, it looks fairly interesting, unfortunately, the documentation leaves a lot to be desired. I cannot figure out how to configure my DS18B20 temperature sensor to be read in as a device.

Right now it looks like only DHT sensors are suppoerted.

It is my son’s project. If you ask for a specific sensor to be added, he will probably do so. The platform is very flexible and very object oriented.

wow. cool. It’s a pretty standard temperature sensor that comes in a waterproof package. I want to use it to monitor my son’s fish tank

You can do it today using my ST_Anything project on a NodeMCU ESP8266 board. It already has support for the DS18B20 temperature sensors.

Hi

Please may you assist me as I am a total newbie and not tech savvie at all. I have managed to follow all steps successfully, however I get stuck at the script for the PHP (to get the Auth Token). I am not sure how to implement this script in order to get the Token - Do I add it to the Device Handler/ SmartApp or do I run it independently and if so how would I go about doing this.
This is hopefully the last hurdle… as I have multiple raspberry pi’s with sensors conected that I use to monitor mt Vivariums and would like ti intergrate it in to Smarthings/Actiontiles

Thanks in advance

I fumbled my way through this a few days ago using my mac! You run it independently by turning on PHP via Terminal, building a little local website in a folder using Textedit, and opening that site in your browser. It sounds intimidating but it was actually very easy.

I am running into a problem where the temperature gets updated to Smartthings but then quits after an indeterminate amount of time. It could run for a few minutes or a few hours but eventually, it stops. If I restart the 'updateFromPi.py" script it works again, for a while. Does anyone have any thoughts on how I can fix this?

What I did was have the script update smartthings 30 times, waiting 60 seconds in between each time. Then I set up a cron job to run it every 30 minutes.

1 Like

As of this morning my temp sensor stopped updating and I’m getting the following error when running the updateFromPi.py script. Any thoughts?
Traceback (most recent call last):
File “/home/pi/Desktop/updateFromPi.py”, line 68, in
main()
File “/home/pi/Desktop/updateFromPi.py”, line 52, in main
r = requests.get(endpoints_url)
File “/usr/lib/python2.7/dist-packages/requests/api.py”, line 70, in get
return request(‘get’, url, params=params, **kwargs)
File “/usr/lib/python2.7/dist-packages/requests/api.py”, line 56, in request
return session.request(method=method, url=url, **kwargs)
File “/usr/lib/python2.7/dist-packages/requests/sessions.py”, line 488, in request
resp = self.send(prep, **send_kwargs)
File “/usr/lib/python2.7/dist-packages/requests/sessions.py”, line 609, in send
r = adapter.send(request, **kwargs)
File “/usr/lib/python2.7/dist-packages/requests/adapters.py”, line 487, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘graph.api.smartthings.com’, port=443): Max retries exceeded with url: /api/smartapps/endpoints/XXXXXclientXXXXX?access_token=XXXXXXXXXX (Caused by NewConnectionError(’<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x75ec5490>: Failed to establish a new connection: [Errno 113] No route to host’,))

I’m having the same problem as a couple of others. I setup the Raspberry pi with Apache

sudo apt-get install apache2

Then I install PHP

sudo apt-get install php

And when i run the PHP page, it sends me to graph.api but when I click authorize I just get an HTTP 500 error. and the URL has this at the end of it

?code=oVTmSP

Or 6 other randomly generated letters. Please help

So, you don’t need that section of the code. If you go to the graph.api site, you’ll be able to “simulate” the Smart App. When you do that, you’ll be able to get the token that you need.