Seneye Fish Tank Monitor
Posted: Thursday 13 March 2014 8:57
Hi,
I have some Seneye Fish Tank Monitors in my house and wanted to get the information they collected into Domoticz.
Seneye provides access to the information it captures via its API website - api.seneye.com
I created some dummy sensors and then a script that read the information from the site and uploaded to the dummy sensors, you need to change the parts like this <YOUR_STUFF> to match your own credentials and devices:
I run the script as a cron job on my Raspberry Pi checking the values every 15 minutes.
To make this better ideally I would like to be able to add some other types of sensor, e.g. ph & nh3. Right now I am just using dummy temperature sensors. If anyone knows how to do this I would appreciate it.
Anyway I hope someone else finds it useful.
Cheers.
I have some Seneye Fish Tank Monitors in my house and wanted to get the information they collected into Domoticz.
Seneye provides access to the information it captures via its API website - api.seneye.com
I created some dummy sensors and then a script that read the information from the site and uploaded to the dummy sensors, you need to change the parts like this <YOUR_STUFF> to match your own credentials and devices:
Code: Select all
#!/usr/bin/python
#import library to do http requests:
import urllib2
#define variables
seneyeurl = 'https://api.seneye.com/v1/devices/17128/exps?user=<YOUR_SENEYE_EMAIL>&pwd=<YOUR_SENEYE_PASSWORD>'
domourl1 = 'http://<YOUR_DOMO_IP>:<YOUR_DOMO_PORT>/json.htm?type=command¶m=udevice&idx='
domourl2 = '&nvalue=0&svalue='
tempid = '<YOUR_DUMMY_SENSOR_ID>'
phid = '<YOUR_DUMMY_SENSOR_ID>'
nh3id = '<YOUR_DUMMY_SENSOR_ID>'
lightid = '<YOUR_DUMMY_SENSOR_ID>'
#download the data:
file = urllib2.urlopen(seneyeurl)
#convert to string:
data = file.read()
#close file because we dont need it anymore:
file.close()
#split the raw data into an array split on comma
text = data.split(',')
#select the values needed and set as variables
temperature = text[4]
ph = text[10]
nh3 = text[16]
light = text[20]
#temperature - strip off extra characters not needed
temperature = temperature.replace('"','')
temperature = temperature.replace('curr:','')
print temperature
#create URL and send to Domoticz
tempurl = domourl1 + tempid + domourl2 + temperature
urllib2.urlopen(tempurl)
#ph - strip off extra characters not needed
ph = ph.replace('"','')
ph = ph.replace('curr:','')
print ph
#create URL and send to Domoticz
phurl = domourl1 + phid + domourl2 + ph
urllib2.urlopen(phurl)
#nh3 - strip off extra characters not needed
nh3 = nh3.replace('"','')
nh3 = nh3.replace('curr:','')
print nh3
#create URL and send to Domoticz
nh3url = domourl1 + nh3id + domourl2 + nh3
urllib2.urlopen(nh3url)
#light - strip off extra characters not needed
light = light.replace('"','')
light = light.replace('curr:','')
print light
#create URL and send to Domoticz
lighturl = domourl1 + lightid + domourl2 + light
urllib2.urlopen(lighturl)
To make this better ideally I would like to be able to add some other types of sensor, e.g. ph & nh3. Right now I am just using dummy temperature sensors. If anyone knows how to do this I would appreciate it.
Anyway I hope someone else finds it useful.
Cheers.