Dutch gas prices addon

We will be victorious… :smiley:

image

Thank you again!

1 Like

Just released 2022.1.2.1. It improves the OCR by almost always reading the superscript digit. It is not always correct though, sometimes an 8 is recognized as 3. After much tweaking i do not seem to get it any better then this…

1 Like

2022.2.16.1 is released. A single gas station now has the same attributes as when the radius is used. Those singles had station had a breaking change: the sensor name is not the street name anymore but the id is used.

1 Like

Updated, no issues to mention, except - it shows abnormally high prices. :smiley:

Thank you again, @EnsconcE :wink:

I have installed the add-on and configured it, when running the automation i can see in the logs of the add-on that the gas stations are being found, but the sensors are not being created, anyone an idea?

Show us your config and the automation…

this is the automation:

  • id: ‘1645209378666’
    alias: Brandstofprijzen
    description: ‘’
    trigger:
    • platform: time_pattern
      hours: ‘6’
      condition: []
      action:
    • service: mqtt.publish
      data:
      topic: dgp/gas_stations
      payload_template: ‘{“fuel_type”:“euro98”,“radius”:10,“latitude”:{{ state_attr(“person.MYNAME”, “latitude”) }},“longitude”:{{ state_attr(“person.MYNAME”, “longitude”) }}, “to_publish”:5}’
      mode: single

I did not put anything in my configuration.yaml, is that nessecary? did not find anything about that on this page: https://github.com/skons/hassio-addons/blob/d86d6c8135bdef05d4092354bdb7025689fc7283/dutch_gas_prices/DOCS.md

Also, the automations seems to work, because i am getting fuel stations in the log of the addon, the sensors just do not appear

I see, that is changed recently I think, I still use the configuration.yaml rest sensor. Afraid I can’t help, you have to wait for @EnsconcE or reach him on Git.

Also, have a look here, maybe you can find some differences in it :wink:

I configured this sensor now:

- platform: rest
  name: Gas stations within radius
  scan_interval: 30
  resource_template: http://192.168.68.132:5035/api/v1/gas_stations/euro98?radius=10&longitude={{ state_attr("person.MYNAME", "longitude") }}&latitude={{ state_attr("person.MYNAME", "latitude") }}
  method: GET
  json_attributes:
    - gas_stations
  value_template: >
    {% if (value_json.gas_stations[0].prijs) %}
      {{ value_json.gas_stations | length }}
    {% endif %}

but still not getting the sensors… :frowning:
Only got this sensor: sensor.dutch_gas_prices_status

In the logs of the addon i can see for example this:
[2022-02-18 20:25:53] DEBUG : station: return value ‘{‘station_id’: 2426, ‘price’: 2.299, ‘fuel_type’: ‘euro98’, ‘station_street’: ‘Rijksweg A16 Oostzijde’, ‘station_address’: ‘3342 LE Hendrik-ldo-Ambac’, ‘timestamp’: ‘2022-02-18T19:02:05.262193+00:00’, ‘status’: ‘Ok’, ‘processing_start’: ‘2022-02-18T19:25:53.854456+00:00’, ‘processing_time’: 0.01, ‘brand’: ‘Shell’, ‘name’: ‘Sandelingen (A16 oz)’, ‘latitude’: 51.83376, ‘longitude’: 4.62115, ‘fuel’: ‘euro98’}’

Please place code correctly, it is badly readable…

1 Like

Code looks ok. Have you looked also for entities disabled by default?

You should now have 5 sensors, looking like this:

Oh, and in your automation you use 6 hours, i use 5 minutes.
I don’t know, how that works exactly, but maybe it then works 6 hours later? :slight_smile:

I am running the automation manually to test, enabled all the entities but still no sensor :frowning:

I never tested it that way.

For use of the rest sensor you need to restart HA, configuration.yaml needs to be loaded after changes.

It then always takes 10-15 minutes after restart, before it starts to work. Don’t know why, it just works that way :smiley:

The rest sensor does not work anymore. You’ll only need automations that send “something” through mqtt. Can you post the log of the addon? Preferably with debug on, and the username and password redacted when sharing it online

Happy to see you here, @EnsconcE :smiley:

So, actually I have to remove it from my config now? (Afraid to break working things… ) :slight_smile:


[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Dutch gas prices
 Get gas prices from dutch gas stations
-----------------------------------------------------------
 Add-on version: 2022.2.16.1
 You are running the latest version of this add-on.
 System: Home Assistant OS 7.4  (amd64 / qemux86-64)
 Home Assistant Core: 2022.2.8
 Home Assistant Supervisor: 2022.01.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to DEBUG
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[20:55:00] INFO: Log_level: debug
[20:55:00] INFO: mqtt_host: 192.168.68.132
[20:55:00] INFO: mqtt_port: 1883
[20:55:00] DEBUG: mqtt_username: MYUSERNAME
[20:55:00] DEBUG: mqtt_password: MYPASSWORD

[20:56:55] INFO: Starting dutch gas prices...
[2022-02-18 20:56:55] INFO    : DGP initialized, launching client
[2022-02-18 20:56:55] INFO    : Connecting mqtt
[2022-02-18 20:56:55] INFO    : Connected with result code 0
[2022-02-18 20:57:07] INFO    : Received payload on topic 'dgp/gas_stations'
[2022-02-18 20:57:07] DEBUG   : gas_stations: Fuel 'euro98' new request
[2022-02-18 20:57:07] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2022-02-18 20:57:07] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places?fmt=web&fuel=euro98 HTTP/1.1" 200 None
[2022-02-18 20:57:07] DEBUG   : Station id '2523' new request
[2022-02-18 20:57:07] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2022-02-18 20:57:07] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/2523.png HTTP/1.1" 200 None
[2022-02-18 20:57:07] DEBUG   : STREAM b'IHDR' 16 13
[2022-02-18 20:57:07] DEBUG   : STREAM b'IDAT' 41 13235
[2022-02-18 20:57:10] DEBUG   : station: return value '{'station_id': 2523, 'price': 2.069, 'fuel_type': 'euro98', 'station_street': 'Noordeinde 158', 'station_address': '3341 U Hendrik-ldo-Ambacl', 'timestamp': '2022-02-18T19:57:10.695634+00:00', 'status': 'Ok', 'processing_start': '2022-02-18T19:57:07.387209+00:00', 'processing_time': 3.32, 'brand': 'Berkman', 'name': 'Hendrik-Ido-Ambacht', 'latitude': 51.847096, 'longitude': 4.656818, 'fuel': 'euro98'}'
[2022-02-18 20:57:10] DEBUG   : Station id '2151' new request
[2022-02-18 20:57:10] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2022-02-18 20:57:10] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/2151.png HTTP/1.1" 200 None
[2022-02-18 20:57:10] DEBUG   : STREAM b'IHDR' 16 13
[2022-02-18 20:57:10] DEBUG   : STREAM b'IDAT' 41 13295
[2022-02-18 20:57:14] DEBUG   : station: return value '{'station_id': 2151, 'price': 2.07, 'fuel_type': 'euro98', 'station_street': 'Boonsweg 42', 'station_address': '3274 LH Heinenoord', 'timestamp': '2022-02-18T19:57:14.525017+00:00', 'status': 'Ok', 'processing_start': '2022-02-18T19:57:10.714136+00:00', 'processing_time': 3.82, 'brand': 'Total', 'name': 'Express', 'latitude': 51.818826, 'longitude': 4.526354, 'fuel': 'euro98'}'
[2022-02-18 20:57:14] DEBUG   : Station id '2192' new request
[2022-02-18 20:57:14] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2022-02-18 20:57:14] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/2192.png HTTP/1.1" 200 None
[2022-02-18 20:57:14] DEBUG   : STREAM b'IHDR' 16 13
[2022-02-18 20:57:14] DEBUG   : STREAM b'IDAT' 41 14482
[2022-02-18 20:57:17] DEBUG   : station: return value '{'station_id': 2192, 'price': 2.079, 'fuel_type': 'euro98', 'station_street': 'Kooiwalweg 1-3', 'station_address': '2992 XA Barendrecht', 'timestamp': '2022-02-18T19:57:17.731404+00:00', 'status': 'Ok', 'processing_start': '2022-02-18T19:57:14.541040+00:00', 'processing_time': 3.2, 'brand': 'Argos', 'name': 'Barendrecht', 'latitude': 51.86935, 'longitude': 4.53507, 'fuel': 'euro98'}'
[2022-02-18 20:57:17] DEBUG   : Station id '28625' new request
[2022-02-18 20:57:17] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2022-02-18 20:57:17] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/28625.png HTTP/1.1" 200 None
[2022-02-18 20:57:17] DEBUG   : STREAM b'IHDR' 16 13
[2022-02-18 20:57:17] DEBUG   : STREAM b'IDAT' 41 13595
[2022-02-18 20:57:20] DEBUG   : station: return value '{'station_id': 28625, 'price': 2.079, 'fuel_type': 'euro98', 'station_street': 'Nijverheidsweg 75/77', 'station_address': '3341 U Hendrik-ldo-Ambacl', 'timestamp': '2022-02-18T19:57:20.956039+00:00', 'status': 'Ok', 'processing_start': '2022-02-18T19:57:17.745838+00:00', 'processing_time': 3.22, 'brand': 'Berkman', 'name': 'Hendrik-Ido-Ambacht', 'latitude': 51.8452, 'longitude': 4.654055, 'fuel': 'euro98'}'
[2022-02-18 20:57:20] DEBUG   : Station id '2166' new request
[2022-02-18 20:57:20] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2022-02-18 20:57:21] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/2166.png HTTP/1.1" 200 None
[2022-02-18 20:57:21] DEBUG   : STREAM b'IHDR' 16 13
[2022-02-18 20:57:21] DEBUG   : STREAM b'IDAT' 41 13878
[2022-02-18 20:57:24] DEBUG   : station: return value '{'station_id': 2166, 'price': 2.079, 'fuel_type': 'euro98', 'station_street': 'Abram v Rijckevorselweg 75', 'station_address': '3062 CX Rotterdam', 'timestamp': '2022-02-18T19:57:24.917840+00:00', 'status': 'Ok', 'processing_start': '2022-02-18T19:57:20.973957+00:00', 'processing_time': 3.95, 'brand': 'OK', 'name': 'Rijckevorselweg', 'latitude': 51.914095, 'longitude': 4.529154, 'fuel': 'euro98'}'
[2022-02-18 20:57:25] DEBUG   : Station id '2522' new request
[2022-02-18 20:57:25] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2022-02-18 20:57:25] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/2522.png HTTP/1.1" 200 None
[2022-02-18 20:57:25] DEBUG   : STREAM b'IHDR' 16 13
[2022-02-18 20:57:25] DEBUG   : STREAM b'IDAT' 41 18022
[2022-02-18 20:57:30] DEBUG   : station: return value '{'station_id': 2522, 'price': 2.1, 'fuel_type': 'euro98', 'station_street': 'Beneluxlaan 50 ‘', 'station_address': '3332 EB Zwijndrecht |', 'timestamp': '2022-02-18T19:57:30.338223+00:00', 'status': 'Ok', 'processing_start': '2022-02-18T19:57:25.006981+00:00', 'processing_time': 5.34, 'brand': 'AVIA', 'name': 'Walburg', 'latitude': 51.82335, 'longitude': 4.65369, 'fuel': 'euro98'}'
[2022-02-18 20:57:30] DEBUG   : Station id '11368' new request
[2022-02-18 20:57:30] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2022-02-18 20:57:30] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/11368.png HTTP/1.1" 200 None
[2022-02-18 20:57:30] DEBUG   : STREAM b'IHDR' 16 13
[2022-02-18 20:57:30] DEBUG   : STREAM b'IDAT' 41 15654
[2022-02-18 20:57:34] DEBUG   : station: return value '{'station_id': 11368, 'price': 2.109, 'fuel_type': 'euro98', 'station_street': 'Kompasstraat9', 'station_address': '2901 AM Capelle a/d IJssel', 'timestamp': '2022-02-18T19:57:34.331518+00:00', 'status': 'Ok', 'processing_start': '2022-02-18T19:57:30.366525+00:00', 'processing_time': 3.97, 'brand': 'Berkman', 'name': 'Capelle a/d IJssel', 'latitude': 51.910273, 'longitude': 4.561496, 'fuel': 'euro98'}'
[2022-02-18 20:57:34] DEBUG   : Station id '2430' new request
[2022-02-18 20:57:34] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2022-02-18 20:57:34] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/2430.png HTTP/1.1" 200 None
[2022-02-18 20:57:34] DEBUG   : STREAM b'IHDR' 16 13
[2022-02-18 20:57:34] DEBUG   : STREAM b'IDAT' 41 11822
[2022-02-18 20:57:37] DEBUG   : station: return value '{'station_id': 2430, 'price': 2.109, 'fuel_type': 'euro98', 'station_street': 'Lindtsedijk 56', 'station_address': '3336 LE Zwijndrecht', 'timestamp': '2022-02-18T19:57:37.794789+00:00', 'status': 'Ok', 'processing_start': '2022-02-18T19:57:34.346159+00:00', 'processing_time': 3.46, 'brand': 'Haan', 'name': 'Express de Lindt', 'latitude': 51.81055, 'longitude': 4.6218, 'fuel': 'euro98'}'
[2022-02-18 20:57:37] DEBUG   : Station id '2232' new request
[2022-02-18 20:57:37] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2022-02-18 20:57:37] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/2232.png HTTP/1.1" 200 None
[2022-02-18 20:57:38] DEBUG   : STREAM b'IHDR' 16 13
[2022-02-18 20:57:38] DEBUG   : STREAM b'IDAT' 41 17973
[2022-02-18 20:57:43] DEBUG   : station: return value '{'station_id': 2232, 'price': 2.109, 'fuel_type': 'euro98', 'station_street': 'Pr Alexanderlaan 25', 'station_address': '3068 PN Rotterdam', 'timestamp': '2022-02-18T19:57:43.823213+00:00', 'status': 'Ok', 'processing_start': '2022-02-18T19:57:37.813281+00:00', 'processing_time': 6.02, 'brand': 'OK', 'name': 'Pr Alexanderlaan', 'latitude': 51.9558, 'longitude': 4.54934, 'fuel': 'euro98'}'
[2022-02-18 20:57:43] DEBUG   : Station id '2211' new request
[2022-02-18 20:57:43] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2022-02-18 20:57:44] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/2211.png HTTP/1.1" 200 None
[2022-02-18 20:57:44] DEBUG   : STREAM b'IHDR' 16 13
[2022-02-18 20:57:44] DEBUG   : STREAM b'IDAT' 41 11962
[2022-02-18 20:57:48] DEBUG   : station: return value '{'station_id': 2211, 'price': 2.109, 'fuel_type': 'euro98', 'station_street': 'Hordijk 242', 'station_address': '3079 DL Rotterdam', 'timestamp': '2022-02-18T19:57:47.994813+00:00', 'status': 'Ok', 'processing_start': '2022-02-18T19:57:43.857951+00:00', 'processing_time': 4.15, 'brand': '', 'name': 'Zwaal', 'latitude': 51.873684, 'longitude': 4.543129, 'fuel': 'euro98'}'
[2022-02-18 20:57:48] DEBUG   : Station id '2345' new request
[2022-02-18 20:57:48] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2022-02-18 20:57:48] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/2345.png HTTP/1.1" 200 None
[2022-02-18 20:57:48] DEBUG   : STREAM b'IHDR' 16 13
[2022-02-18 20:57:48] DEBUG   : STREAM b'IDAT' 41 23360
[2022-02-18 20:57:55] DEBUG   : station: return value '{'station_id': 2345, 'price': 2.119, 'fuel_type': 'euro98', 'station_street': 'Couwenhoekseweg 6', 'station_address': '2905 LZ Capelle aan denJs!', 'timestamp': '2022-02-18T19:57:55.815607+00:00', 'status': 'Ok', 'processing_start': '2022-02-18T19:57:48.014446+00:00', 'processing_time': 7.81, 'brand': 'AVIA', 'name': 'de Couwenhoek', 'latitude': 51.93708, 'longitude': 4.59282, 'fuel': 'euro98'}'
[2022-02-18 20:57:55] DEBUG   : Station id '2318' new request
[2022-02-18 20:57:55] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2022-02-18 20:57:55] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/2318.png HTTP/1.1" 200 None
[2022-02-18 20:57:56] DEBUG   : STREAM b'IHDR' 16 13
[2022-02-18 20:57:56] DEBUG   : STREAM b'IDAT' 41 11094
[2022-02-18 20:57:59] DEBUG   : station: return value '{'station_id': 2318, 'price': 2.119, 'fuel_type': 'euro98', 'station_street': 'Kanaalweg 2', 'station_address': '2903 LS Capelle aan den IJs!', 'timestamp': '2022-02-18T19:57:59.140136+00:00', 'status': 'Ok', 'processing_start': '2022-02-18T19:57:55.834028+00:00', 'processing_time': 3.32, 'brand': 'Dijktank', 'name': 'Capelle aan den IJssel', 'latitude': 51.93521, 'longitude': 4.58243, 'fuel': 'euro98'}'
[2022-02-18 20:57:59] DEBUG   : Station id '2640' new request
[2022-02-18 20:57:59] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2022-02-18 20:57:59] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/2640.png HTTP/1.1" 200 None
[2022-02-18 20:57:59] DEBUG   : STREAM b'IHDR' 16 13
[2022-02-18 20:57:59] DEBUG   : STREAM b'IDAT' 41 13178
[2022-02-18 20:58:02] DEBUG   : station: return value '{'station_id': 2640, 'price': 2.119, 'fuel_type': 'euro98', 'station_street': 'Veerweg 173', 'station_address': '3351 HC Papendrecht', 'timestamp': '2022-02-18T19:58:02.979674+00:00', 'status': 'Ok', 'processing_start': '2022-02-18T19:57:59.182227+00:00', 'processing_time': 3.81, 'brand': '', 'name': 'Van Wijngaarden', 'latitude': 51.83009, 'longitude': 4.68687, 'fuel': 'euro98'}'
[2022-02-18 20:58:03] DEBUG   : Station id '2369' new request
[2022-02-18 20:58:03] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2022-02-18 20:58:03] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/2369.png HTTP/1.1" 200 None
[2022-02-18 20:58:03] DEBUG   : STREAM b'IHDR' 16 13
[2022-02-18 20:58:03] DEBUG   : STREAM b'IDAT' 41 18301

[2022-02-18 21:05:16] DEBUG   : station: return value '{'station_id': 2426, 'price': 2.299, 'fuel_type': 'euro98', 'station_street': 'Rijksweg A16 Oostzijde', 'station_address': '3342 LE Hendrik-ldo-Ambac', 'timestamp': '2022-02-18T20:05:16.870404+00:00', 'status': 'Ok', 'processing_start': '2022-02-18T20:05:11.490290+00:00', 'processing_time': 5.39, 'brand': 'Shell', 'name': 'Sandelingen (A16 oz)', 'latitude': 51.83376, 'longitude': 4.62115, 'fuel': 'euro98'}'
[2022-02-18 21:05:16] ERROR   : Unable to process payload '{'fuel_type': 'euro98', 'radius': 10, 'latitude': 51.878924561661385, 'longitude': 4.597088986501641, 'to_publish': 5}' with error: ''<' not supported between instances of 'NoneType' and 'float''
[2022-02-18 21:05:16] INFO    : publishing status to mqtt
[2022-02-18 21:05:16] DEBUG   : on_message: received the topic 'homeassistant/sensor/dgp/status/config'
[2022-02-18 21:05:16] DEBUG   : publish: Autodiscover 'True', State 'True' and Attributes 'True'
[2022-02-18 21:05:16] INFO    : publishing status done

The logs go further, but not sure if that is needed?

@BebeMischa yes you can. They are not in the doc anymore :wink:.

@Madoow the bottom part has the stuff i’m interested in. Can you also let me know what your setup is? Do you have musquitto and did you configure the mqtt integration?

@EnsconcE i have added the last part to my previous post. I have Mosquitto broker running and working, also using it for other integrations like Zigbee2MQTt etc.

Ah, well my addon uses the same technique as zigbee2mqtt… thanks for the log, and it is seems alright. Do you see something in the supervisor log? Or in the homeassistant log? And laat but not least, maybe the mosquito log?

@EnsconcE
Is it still so with the new version, that it takes a time after HA restart to fill the entities with data?