Posting data once a day to Mindergas.nl

Moderator: leecollings

Post Reply
number3
Posts: 6
Joined: Friday 15 August 2014 20:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Posting data once a day to Mindergas.nl

Post by number3 »

After working on it for a week I have created a script that will post data to the website: mindergas.nl

If you don't mind your data being on an external webservice, then you can use this script.
I am still testing the correct working of the script at this time, but it looks like it works just fine.

Find my detailed description right here:
http://www.domoticz.com/wiki/Mindergas.nl
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Posting data once a day to Mindergas.nl

Post by ThinkPad »

'nickyb2' from Tweakers (also on this forum) created a simple Python script to upload gas consumption from smartmeter to Mindergas. I tested it, and it works fine.

You can find it here: http://gathering.tweakers.net/forum/lis ... 1#43606221
I am not active on this forum anymore.
number3
Posts: 6
Joined: Friday 15 August 2014 20:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: Posting data once a day to Mindergas.nl

Post by number3 »

Great finds... I'm not a bash/sed/curl programmer, but I agree it looks like it can be done in a simplere way.
Love the find on tweakers, will take a look into it.
Btw. the wiki article is quite simple, it installs some stuff, if you follow the step by step it does work, but I agree it can be improved.

So I will look into these two finds.
And document the results.
User avatar
tcviper
Posts: 89
Joined: Monday 30 June 2014 13:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Posting data once a day to Mindergas.nl

Post by tcviper »

Im seeing this when I run the script on my RPI2 with Domoticz:

Traceback (most recent call last):
File "/home/pi/domoticz/scripts/mindergas.py", line 61, in <module>
sys.exit(main())
File "/home/pi/domoticz/scripts/mindergas.py", line 34, in main
device_data = json.load(urllib2.urlopen("%s/json.htm?type=devices&rid=%s" % (args.url, args.device), timeout=5))
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 401, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 419, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1211, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1181, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 97] Address family not supported by protocol>


Any idea? Token and IDX of the gas meter are filled in correctly.

Update: Looks like adding -u http://192.168.1.16:80 (which is my domoticz address) now seems to b e working. Hope thats all :P
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Posting data once a day to Mindergas.nl

Post by ThinkPad »

How do you call the script from your crontab? Did you supply all the parameters needed?

The URL to Domoticz needs to be something like: "http://1.2.3.4:8080" i thought (without the quotes ofcourse).
If the URL is not supplied it will use "http://localhost:8080".

See also the wiki, it is all explained there: http://domoticz.com/wiki/Mindergas.nl#The_Python_way
I am not active on this forum anymore.
User avatar
tcviper
Posts: 89
Joined: Monday 30 June 2014 13:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Posting data once a day to Mindergas.nl

Post by tcviper »

That's why i posted Update at the bottom of my post :)
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Posting data once a day to Mindergas.nl

Post by ThinkPad »

Did it work this night :) ?
I am not active on this forum anymore.
User avatar
tcviper
Posts: 89
Joined: Monday 30 June 2014 13:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Posting data once a day to Mindergas.nl

Post by tcviper »

Looks like it did :) Thx!
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Posting data once a day to Mindergas.nl

Post by Derik »

dear all..
I will try to use the phyton way..
install phyton.
make the script
make the crontab..

Is there a way to test. this option?

Because it is not working...
ScreenShot014.jpg
ScreenShot014.jpg (14.58 KiB) Viewed 2250 times
ScreenShot015.jpg
ScreenShot015.jpg (101.56 KiB) Viewed 2250 times
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Posting data once a day to Mindergas.nl

Post by Derik »

Should i perhaps remove the http://?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest