A "I quit smoking" sensor

Take a look at this thread. Fuel price is provided bei tankerkoenig.de. You need an API-Key:

1 Like

Too bad…

Hier gibt es den einfachen Zugang zu den aktuellen Spritpreisen aller an die Markttransparenzstelle für Kraftstoffe (MTS-K) meldenden Tankstellen Deutschlands.

I live in the Netherlands, so that won’t be of use.

A little bit offtopic, but…
You can scrape the data, I do this to extract the local gasprice for the nearest Shell Express station.

  - platform: scrape
    resource: https://www.shellexpress.nl/nl_nl/station/se-nieuwerkerk-aan-den-ijssel
    name: Shell Express
    select: ".price-actual"
    value_template: '{{ value.split(" ")[0] }}'
    unit_of_measurement: "EUR/L"

image

3 Likes

Also off topic but I was looking for a dutch way to do it. I am using this app on my phone to get the cheapest gas prices around my position: https://directlease.nl/tankservice/

Maybe there is a way to gather the data from here for a bit more option than just shell.

Good job on quiting smoking OP.

Nice how you added it to Home Assistant

1 Like

OFFTOPIC

I checked that. The website has an api call for getting all stations with lat/lon. But from that you can only get to the station prices from a png image. That is of no use.

I tried mitmproxy to sniff the app, but that uses https/ssl traffic, so SSL certificates were invalid and therefor I was unable to read which api calls are made.

Perhaps someone with more technical skills can reverse-engineer the iOS app.

I was also thinking of scraping from

or

but I was having a hard time getting the filter right.

@jay448 @Bob_NL I suggest we start a new topic to continue this discussion.

Update: this discussion continues over here:

@jones sorry ask you but i dont understand. 1.65 tage is what??

Google: translate tage to English

German: tage
English: days

Google: translate Nichtraucher to English

German: Nichtraucher
English: non smoking

i believe its actualy nonsmoker

Thanks. It would be nice if we could improve the translator

1 Like

Right! My Homeassistant is a weird mix between German and Englisch. Sorry about that.

mine is even more wierd.

i got mostly dutch, but its also partly german and partly english :wink:

1 Like

Thank you jones! I have never smoked but did implement the Tankerkönig. Works flawlessly! Great stuff!

1 Like

@GraysonPeddie yes tage is days, but 1.65 is what? 1= one day and .65???

hmm, that isnt that hard to understand.
1.65 days is 1.65* 24 hours

so .65 is 15 hours and 10 minutes

1 day and 15.6 hours. 0.6 hour is 36 minutes.

oops, i calculated wrong. thx for correcting :wink:

1 Like

Thanks for your explanation.

I get the warning
Template sensor xxxxx has no entity ids configured to track nor were we able to extract the entities to track from the value template(s). This entity will only be able to be updated manually.

I read some posts for this problem:

but how can I change my config to avoid the warning`?

  - platform: template
    sensors:
      zusammen_tage:
        value_template: '{{ (( as_timestamp(now()) - as_timestamp(strptime("08.01.2012", "%d.%m.%Y")) ) / 86400 ) | round(2) }}'
        friendly_name: 'Tage zusammen'  
        unit_of_measurement: "Tage"

Look here. You have to add an entity to update the sensor. Use sensor.date like in the official docs: https://www.home-assistant.io/components/sensor.template/#working-without-entities

1 Like