rest_command:
mindergas_post:
url: https://www.mindergas.nl/api/meter_readings
method: POST
headers:
AUTH-TOKEN: !secret mindergas_token
Content-Type: "application/json"
payload: '{ "date": "{{ date }}", "reading": {{ meterreading }} }'
verify_ssl: true
automation:
- alias: "update mindergas"
trigger:
- platform: time
at: "00:15:03" #Choose some random time near '00:00'
action:
- service: rest_command.mindergas_post
data_template:
date: "{{ (now().timestamp() - 60*60) | timestamp_custom('%Y-%m-%d') }}"
## use 1h before now, to make sure we use yesterdays date
meterreading: "{{ states('sensor.gas_consumption') }}"
Next to having my historical gas usage data in homeassistant, I also like to have it in mindergas.nl. This automates that process with data from homeassistant.
As I am very new to Home Assistant, can you please explain (in Dummy language) where I have to put this script? I have my gas meter running in HA and created an account at MinderGas.nl, but I have no idea how to continue right now
- alias: "update mindergas"
trigger:
- platform: time
at: "00:03:33" #Choose some random time near '00:00'
action:
- service: rest_command.mindergas_post
data_template:
date: "{{ (now().timestamp() - 60*60) | timestamp_custom('%Y-%m-%d') }}"
## use 1h before now, to make sure we use yesterdays date
meterreading: "{{ states('sensor.gas_meter_gas_consumption') }}"
part in configurations:
#uploads to mindergas
rest_command:
mindergas_post:
url: "https://www.mindergas.nl/api/meter_readings"
method: post
headers:
AUTH-TOKEN: !secret mindergas_token
Content-Type: "application/json"
payload: '{ "date": "{{ date }}", "reading": {{ meterreading }} }'
verify_ssl: true
Iām a newby migrating from Domoticz. So bear with me.
Iām running HA in a docker container on a RPi 4B. Running fine. However when I want to upload my mindergas meter reading successfully I have to turn off āverify_sslā. Otherwise I receive a ā401ā error which tells me āauthentication failedā.
Is this correct behaviour (ie do I have to switch off verify_ssl)? Or am I missing a setting in my yaml configuration?
Ik heb nooit problemen gehad met automatisch uploaden van mijn meterstand. Er zijn 2 wijzigingen in mijn systeem aangebracht nl. een nieuw modem van ziggo en de P1 kabel is vervangen door een home wizzard wifi P1. Als ik nu de Link gebruik voor upload krijg ik een foutmelding.
Heb je het uiteindelijk werkend gekregen?
Ik heb het zojuist geconfigureerd en bij mij werkt het.
Ik moest wel Home Assistant opnieuw opstarten voordat het werkte.
It took me some time because I got an 401 authentication error.
Finaly I found out the config.yml part had some strange characters in it. So I copied that part again into the configuration.yml restarted HA and yes it worked right away.
Further be awre of the gas sensor name it depends on the way you read the gas metric from your smart meter. I for instance use the Youless LS120 in combination with the youless integration so I have to use sensor.gas_usage as the sensor name.
When I manually start the automation from the automation dashboard the information is uploaded to mindergas.
Yesterday I checked my mindergas site and encounterd the last few days nothing has been uploaded. In the logs I see below message: