Dutch gas prices addon

Is it also possible to do this for 2 locations?
For example 5 stations around my home and 5 around my work. I get the lat/lon from 2 zones then: zone.home and zone.work

Yes, check this one

1 Like

What I mean was this. I have 5 fixed gas stations. But want same as 5 nearest (refresh based on price)

alias: Update gas stations
trigger:
  - platform: time_pattern
    minutes: "5"
  - platform: homeassistant
    event: start
action:

# home
  - service: mqtt.publish
    data:
      topic: dgp/gas_stations
      payload_template: >-
        {"fuel_type":"euro95","radius":5,"latitude":{{
        state_attr("zone.home", "latitude") }},"longitude":{{
        state_attr("zone.home", "longitude")
        }},"friendly_name_template":"[brand] ([station_street])",
        "to_publish":5}

# Work
  - service: mqtt.publish
    data:
      topic: dgp/gas_stations
      payload_template: >-
        {"fuel_type":"euro95","radius":5,"latitude":{{
        state_attr("zone.work", "latitude") }},"longitude":{{
        state_attr("zone.work", "longitude")
        }},"friendly_name_template":"[brand] ([station_street])",
        "to_publish":5}

This automation is not working. I only get 5 and not 10

Yeah, you should use the property identifier in the payload_template. The link i sent describes the usage, if you scroll up a bit you can see the property used but with optional described behind it

Just released version 2023.10.15.1 with multiple fixes. Be aware, there could be a breaking change depending on how you use the entities. @ArenaCloser your issue should be fixed also.

2 Likes

For me it’s working now also. Thanks for the great work!

1 Like

How can i add a city or town name?

It’s in the attributes, so you can extract it :wink: Just edit the automations payload template adding the station adress.

i have home assistant installed with proxmox. so mine question is after the install. i see this in config i dont know what is needed more. ?

Is it working? Is the logging showing errors? You can always set the “Ongebruikte optionele configuraties” to true to see if there is something you maybe should configure.

Hopefully somebody can help me.
I cant figure out why it’s not working, don’t get the entity’s

Iam running haos in a vm on truenas.

i get the following error message:

2024-02-04 16:46:11] INFO    : DGP initialized, launching client
[2024-02-04 16:46:11] INFO    : Connecting to mqtt host '192.168.50.240' with clientname 'f5a8083e-dutch-gas-prices'
[2024-02-04 16:46:11] INFO    : Using username 'mqtt_user' to connect to '192.168.50.240'
[2024-02-04 16:46:11] INFO    : Connected with result code '0'
[2024-02-04 16:46:24] INFO    : Received payload '{"fuel_type":"euro95","radius":10,"latitude":52.379425048828125,"longitude":4.661164263750353,"friendly_name_template":"[brand] ([station_street])",
        "to_publish":3}' on topic 'dgp/gas_stations'
[2024-02-04 16:46:24] DEBUG   : gas_station: Fuel 'euro95' new request
[2024-02-04 16:46:24] DEBUG   : _write_allstationdata: URL 'https://tankservice.app-it-up.com/Tankservice/v1/places?fmt=web&fuel=euro95'
[2024-02-04 16:46:24] DEBUG   : _write_allstationdata: headers '{'Accept': '*/*', 'Connection': 'keep-alive', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36 OPR/54.0.2952.71'}'
[2024-02-04 16:46:24] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2024-02-04 16:46:24] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places?fmt=web&fuel=euro95 HTTP/1.1" 403 1105
[2024-02-04 16:46:24] ERROR   : _write_allstationdata: statuscode '403'
[2024-02-04 16:46:24] ERROR   : _write_allstationdata: Used header '{'Accept': '*/*', 'Connection': 'keep-alive', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36 OPR/54.0.2952.71'}'
[2024-02-04 16:46:24] DEBUG   : Starting new HTTPS connection (1): api.ipify.org:443
[2024-02-04 16:46:24] DEBUG   : https://api.ipify.org:443 "GET / HTTP/1.1" 200 14
[2024-02-04 16:46:24] ERROR   : _write_allstationdata: Used IP '**.***.***.***'
[2024-02-04 16:46:24] ERROR   : _write_allstationdata: Response text '<html><head><title>Apache Tomcat/7.0.76 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 403 - Toegang geweigerd; mail naar [email protected] voor vragen</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Toegang geweigerd; mail naar [email protected] voor vragen</u></p><p><b>description</b> <u>Access to the specified resource has been forbidden.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.76</h3></body></html>'
[2024-02-04 16:46:24] INFO    : There are '0' stations within range for fuel type 'euro95'
[2024-02-04 16:46:24] DEBUG   : stations: return value '{'gas_stations': []}'
[2024-02-04 16:46:24] DEBUG   : publish_stations: there is a result, processing stations
[2024-02-04 16:46:24] INFO    : publishing stations to mqtt
[2024-02-04 16:46:24] DEBUG   : publish_stations: Publishing the top '3' lowest price gas stations
[2024-02-04 16:46:24] INFO    : publishing stations done
[2024-02-04 16:46:24] INFO    : publishing status to mqtt
[2024-02-04 16:46:24] DEBUG   : on_message: received the topic 'homeassistant/sensor/dgp/status/config'
[2024-02-04 16:46:25] DEBUG   : publish_status: Waiting for discovery on topic 'homeassistant/sensor/dgp/status/config'
[2024-02-04 16:46:25] DEBUG   : publish_status: Autodiscover 'True', State 'True' and Attributes 'True'
[2024-02-04 16:46:25] INFO    : publishing status done

Mqtt is up and running without errors

The automation i use is:

alias: Benzine Prijzen
description: ""
trigger:
  - platform: time_pattern
    minutes: "5"
  - platform: homeassistant
    event: start
action:
  - service: mqtt.publish
    data:
      topic: dgp/gas_stations
      payload_template: |-
        {"fuel_type":"euro95","radius":10,"latitude":{{
                state_attr("person.edwink023", "latitude") }},"longitude":{{
                state_attr("person.edwink023", "longitude")
                }},"friendly_name_template":"[brand] ([station_street])",
                "to_publish":3}

Same here. Just sent an email to: tankservice-block(at)app-it-up.com

Ls,

k gebruik Dutch Gasprices voor mijn HomeAssistant. Ik krijg sinds een paar dagen een foutmelding.

Kunt u zien of mijn IP-adres (x.x.x.x) geblokkeerd is, en als dat zo is opgeheven kan worden?

Reply:
Ik kan me niet herinneren dat we je ooit toestemming hebben gegeven om onze data zo maar te gebruiken. Lijkt me terecht dat je wordt geblokkeerd.

Als je vindt dat dat anders is horen we graag waar we de factuur heen kunnen sturen voor het gebruik van de data.

mvg,

Directlease Tankservice

Strange reply. That means nobody can use their website also to check for the prices… And the line if you thing different about this let us know where we can send the invoice…

the website is a free service: Goedkoop Tanken - DirectLease Tankservice
And we (tekkie tekkie guys) make use of the options to use it otherway… haha

Also I have issues with the integrations. Also the English version with different way of collecting data.

Directlease is blocking IP numbers that use the server otherwise then visiting the website. I did a test to manage outgoing traffic from HA over a VPN and now it working again. When switch back my original IP is back and in logs I see that im blocked. I think this is the end of a Wonderfull add-on…

My first reaction was to advise my customers to do business elsewhere. However, no one should force Directlease if the company does not like sharing. Directlease’s response shows that there is no priority in the field of corporate governance. On the other hand, if no one ever asked for it, then this is a conceivable response, even if the response does not demonstrate any degree of intelligence.

Is this the only party that collects the data? I think there must be another way through a company that cares about society?

Can I make up from the last couple reports that this add-on no longer works?

The addon is working, if you keep your requests to a minimum. If you’ll start requesting station data every hour or so (exact treshold/timeout is not known) you will be blocked by the website that is providing the data. So, only request when you need it, not when you want it.

Well, that does not play well with my intended use. I had notifications running, when price goes down. So I need a frequent check. :wink:

But when your IP is blocked already there is nothing you can do. Some tried to ask to remove the block but they didn’t. We used the server incorrect…

Only what will help is when ISP gives you a different IP number.