- platform: rest
resource: https://brandstof-api.sanwil.net/api/v1/brandstof_prijzen/XXXX.png
name: Give The Station A Name
value_template: '{{ value_json.benzine_prijs }}'
unit_of_measurement: "€"
Still improving the code, so if there is a station which is not working or providing wrong prices let me know.
It’s working fine, only the last digit is hard to catch for your OCR software because sometimes it;'s missing or wrong and sometimes spot on. But I’m already happy with it. I don’t know what de refresh rate of the directlease.nl site is or at your site so probably the one hour refresh update I use is to much.
Below my results en code. (have to make the card a bit nicer
homeassistant:
customize_glob:
sensor.euro95*:
unit_of_measurement: "€/L"
sensor:
- platform: rest
resource: https://brandstof-api.sanwil.net/api/v1/brandstof_prijzen/4895.png
name: Shell Express Dorp
value_template: '{{ value_json.benzine_prijs }}'
unit_of_measurement: "€/L"
scan_interval: 3600 # once per hour only
- platform: rest
resource: https://brandstof-api.sanwil.net/api/v1/brandstof_prijzen/4916.png
name: Esso Randweg Noord
value_template: '{{ value_json.benzine_prijs }}'
unit_of_measurement: "€/L"
scan_interval: 3600 # once per hour only
- platform: rest
resource: https://brandstof-api.sanwil.net/api/v1/brandstof_prijzen/4929.png
name: Tango Smulders
value_template: '{{ value_json.benzine_prijs }}'
unit_of_measurement: "€/L"
scan_interval: 3600 # once per hour only
- platform: rest
resource: https://brandstof-api.sanwil.net/api/v1/brandstof_prijzen/4966.png
name: Tinq Praxis
value_template: '{{ value_json.benzine_prijs }}'
unit_of_measurement: "€/L"
scan_interval: 3600 # once per hour only
- platform: rest
resource: https://brandstof-api.sanwil.net/api/v1/brandstof_prijzen/5002.png
name: Gulf Leto
value_template: '{{ value_json.benzine_prijs }}'
unit_of_measurement: "€/L"
scan_interval: 3600 # once per hour only
- platform: scrape
name: Euro95 Advies
resource: "https://www.unitedconsumers.com/brandstofprijzen"
select: ".table div:nth-of-type(2) div:nth-of-type(3)"
value_template: "{{ value |replace('€', '') |replace(',', '.') |round(3) }}"
scan_interval: 3600 # once per hour only
Great. I improved the code again so it will use a cache of 3600 seconds. I don’t know how good/up to date directlease prices are but stations seem to be updated more times in a day from what I see.
Good that you use a scan_interval it helps with performance on the server side.
Well I was playing with this. Now I had something that works.
I was checking at your github and copied the code from there. That was working.
Now I’m checking for the prices nearby.
Somebody who has the prices from Argos and Tamoil? The sites doesn’t specify that like others I see.
Hi @sjee , the small number on the end is not recognized very well by the OCR software, so i’m afraid i can’t do much about that.
But I see that the other one (BP Heerbaan) should possibly work so I’m working on an improved version. But due the lack of time that’s going to be somewhere finished next week. Bare with me
No problem. When you find the station you are looking for and click on it, you see the prices appearing on the right. You need to get that image url in which you will find the picture *.png link.
@sanderdw is there any progress in making the code public? It works fine, but I would like to not have to rely on external services to make this work. And I am just very curious how this service works
@donnie-dominguez, @wimb0, code is now public: https://github.com/sanderdw/Dutch-Gas-prices-API, unfortunately no time yet to properly rewrite and document the ocr logic (_search_value). Also i translated some things in English for the technical re-use & readability of it. This version is not implemented yet on the main server as endpoints are changed.