Hi everybody, I just started with OpenHybrid and for a proof of concept I wanted to display data readings from a python script on a webpage. I’m a beginner with all this, with very limited coding knowledge.
OpenHybrid is running on a raspberry pi B+ (Jessie) and working fine so far.
I created an object, which is recognized and displayed correctly.
On the other hand I installed a DHT22 humidity sensor. Temperature and humidity can be read via python script (based on the adafruit test file):
#!/usr/bin/python #simpletest.py # Copyright (c) 2014 Adafruit Industries # Author: Tony DiCola # edit... import sys import Adafruit_DHT sensor = Adafruit_DHT.DHT22 pin = 4 humidity, temperature = Adafruit_DHT.read_retry(sensor, pin) if humidity is not None and temperature is not None: print 'Temp:{0:0.1f}*C Humidity:{1:0.1f}%'.format(temperature, humidity) else: print 'Failed to obtain a reading. Try again!'
My question is, how can I display this data, as I cannot include python call in the index.html? I tried to create an php-file (index.php) which called the script, but this does not seem to work either, as the php-script is not recognized. Code here:
<?php passthru("sudo /home/pi/DHT22read.py"); ?>
Any ideas, on how I could display the information within the index.html?
created
last reply
May '16- 5
replies
- 4.0k
views
- 3
users
- 1
like
- 8
links
