Upload gas usage to mindergas.nl  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Upload gas usage to mindergas.nl

Post by jvdz »

Are you running this as a DzEvents script?
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
mvveelen
Posts: 678
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Upload gas usage to mindergas.nl

Post by mvveelen »

Yes, I tried. But saving scripts gives me a "save error" so I prefer to use a bash script.

I also tried the slave-master construction, but I keep getting errors because I use an RPi 3B+ and a Synology with Domoticz in Docker.
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Upload gas usage to mindergas.nl

Post by jvdz »

It is an DzEvents script as you can see in the scriptsource, so will not work in any other way!
/home/pi/domoticz/scripts/dzVents/scripts/upload_gas_usage_to_minderGas.lua
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Upper78
Posts: 5
Joined: Tuesday 28 March 2017 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10228
Contact:

Re: Upload gas usage to mindergas.nl

Post by Upper78 »

Hi mvveelen,

I just tested with your script, and the only thing that needs to be changed is the URL from mindergas.
This has changed. Change line 40 to https://www.mindergas.nl/api/meter_readings as the url, and it works.
User avatar
sincze
Posts: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Upload gas usage to mindergas.nl

Post by sincze »

As my experience with dZVents is 0,0 and the and the wiki described a version with special tools required in BASH I had to give it a small different BASH twist for 2 house holds that wanted to have this done.

Best Practices:
- No mindergas key in the main script but in separate config file.
- Needs no special tools or apt-get installs

Find the mindergas.sh here.
https://github.com/sincze/bash/blob/main/mindergas.sh
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Upload gas usage to mindergas.nl

Post by Derik »

MM Hi..
Oud topic..
maar ik gebruikt eerst een ander script wat niet meer werkt na een nieuw armbian installatie.

Welk script werkt nu goed?
En uploaden jullie alleen gas? Of ook KWH/2 als zijnde gas, voor een wp verbruik [ de oude api ]
Nieuw is wel Kwh maar ik zoek eigen de /2 versie
En natuurlijk de kwh versie altijd welkom
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
njlammerts
Posts: 139
Joined: Wednesday 12 August 2020 17:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Fryslan
Contact:

Re: Upload gas usage to mindergas.nl

Post by njlammerts »

I used the script from Sándor Incze because this seems to be the latest (2023) script for uploaden to Mindergas.nl. The older scripts give an arror "meterstand is geen getal"

The script from Sándor runs ok, but i get ( a simular message) "Error no value!" as result.

Does anyone has a solution?
HvdW
Posts: 504
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: Upload gas usage to mindergas.nl

Post by HvdW »

Here is a script that should work.
jq is the ingredient that you need.

Code: Select all

#!/bin/bash

# LET OP
# METERSTAND check your domoticz port and domoticz idx (rid) for gas
# check your mindergas token
# LET OP

#Token to authenicate with mindergas.nl
TOKEN=your token

#fetch meterstand (use jq to parse JSON object correctly)
METERSTAND=`curl -s "http://127.0.0.1:8383/json.htm?type=devices&rid=16" | jq '.result[0].Counter'| tr -d '"'`

#Get OS date, and format it corectly.
NOW=$(date +"%Y-%m-%d")

#Build JSON by hand 😉
JSON='{ "date":"'$NOW'", "reading":"'$METERSTAND'" }'

#post using curl to API
curl -v -H "Content-Type:application/json" -H "AUTH-TOKEN:$TOKEN" -d "$JSON" https://www.mindergas.nl/api/meter_readings

# don't forget:
# https://ehoco.nl/stand-gasmeter-uploaden-naar-mindergas-nl/
# sudo apt install jq -y
and in crontab for a daily upload.

Code: Select all

58 23 * * * /home/pi/scripts/mindergas-upload.sh
Bugs bug me.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest