home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.08k stars 31.09k forks source link

Tankerkoenig only delivers the 10 nearest stations #33117

Closed Armadill0 closed 4 years ago

Armadill0 commented 4 years ago

The problem

Hey guys,

I'm using home-assistant custom installed since some days and started using the Tankerkoenig integration today. I configured it via the configuration yaml, see below.

Afterwards I configured the third party plugin "auto-entities" to retrieve a list of stations with a specific fuel_type type ordered by price:

      - cards:
          - card:
              title: E5
              type: entities
            filter:
              include:
                - attributes:
                    fuel_type: e5
                  entity_id: sensor.tankerkoenig*
            sort:
              method: state
              numeric: true
            type: 'custom:auto-entities'
        title: Spritpreise Maisach
        type: vertical-stack

I also customized some station names for recognition, although I think this has nothing to do with this issue.

The problem is, that there are stations missing which should definitely be in the search radius I defined in the configuration.

Finally I compared the stations which are being displayed with the list of data which was retrieved from the Tankerkoenig API and now I am sure that I only get the first 10 devices frm the distance point of view. And this is the problem that my representation in the UI misses stations which is being sorted after the actual price of the fuel. image

I also increased the search radius to 15km. That brought a lot more stations than in the logs below, but the screenshot above is the result from that. So, that didn'thelp at all.

Environment

Problem-relevant configuration.yaml

tankerkoenig:
  api_key: <stripped>
  latitude: 48.211657
  longitude: 11.257939
  radius: 8
  scan_interval: 600

Traceback/Error logs

What made me curious that something is wrong were some missiung stations which definitely are (checked that via Tankerkeinig site, API and the HA logs) in the 8km radius I defined on the configuration. So I increased the logging to debug and found this:

Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: --- Logging error ---
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: Traceback (most recent call last):
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/usr/lib64/python3.8/logging/__init__.py", line 1081, in emit
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     msg = self.format(record)
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/usr/lib64/python3.8/logging/__init__.py", line 925, in format
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     return fmt.format(record)
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/colorlog/colorlog.py", line 123, in format
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     message = super(ColoredFormatter, self).format(record)
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/usr/lib64/python3.8/logging/__init__.py", line 664, in format
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     record.message = record.getMessage()
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/usr/lib64/python3.8/logging/__init__.py", line 369, in getMessage
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     msg = msg % self.args
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 590, in __repr__
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     return f"<Entity {self.name}: {self.state}>"
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/components/tankerkoenig/sensor.py", line 112, in state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     return self._coordinator.data[self._station_id].get(self._fuel_type)
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: KeyError: '5f7e4b7d-482f-4707-a016-00c104984937'
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: Call stack:
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/bin/hass", line 8, in <module>
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     sys.exit(main())
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/__main__.py", line 342, in main
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     exit_code = asyncio.run(setup_and_run_hass(config_dir, args))
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/usr/lib64/python3.8/asyncio/runners.py", line 43, in run
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     return loop.run_until_complete(main)
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/usr/lib64/python3.8/asyncio/base_events.py", line 603, in run_until_complete
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     self.run_forever()
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/usr/lib64/python3.8/asyncio/base_events.py", line 570, in run_forever
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     self._run_once()
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/usr/lib64/python3.8/asyncio/base_events.py", line 1859, in _run_once
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     handle._run()
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/usr/lib64/python3.8/asyncio/events.py", line 81, in _run
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     self._context.run(self._callback, *self._args)
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/components/tankerkoenig/sensor.py", line 65, in async_setup_platform
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     _LOGGER.debug("Added sensors %s", entities)
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: Unable to print the message and arguments - possible formatting error.
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: Use the traceback above to help find the error.
[...]
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:28 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: Traceback (most recent call last):
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py", line 434, in _async_add_entity
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     await entity.async_update_ha_state()
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     self._async_write_ha_state()
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     state = self.state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/components/tankerkoenig/sensor.py", line 112, in state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     return self._coordinator.data[self._station_id].get(self._fuel_type)
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: KeyError: 'd70e98c9-f54b-4131-b02f-e0bf25bcbe7c'
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:28 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: Traceback (most recent call last):
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py", line 434, in _async_add_entity
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     await entity.async_update_ha_state()
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     self._async_write_ha_state()
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     state = self.state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/components/tankerkoenig/sensor.py", line 112, in state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     return self._coordinator.data[self._station_id].get(self._fuel_type)
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: KeyError: 'c7ef3329-82d0-4cd7-9106-781ddf0164ec'
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:28 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: Traceback (most recent call last):
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py", line 434, in _async_add_entity
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     await entity.async_update_ha_state()
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     self._async_write_ha_state()
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     state = self.state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/components/tankerkoenig/sensor.py", line 112, in state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     return self._coordinator.data[self._station_id].get(self._fuel_type)
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: KeyError: '51d4b6bd-a095-1aa0-e100-80009459e03a'
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:28 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: Traceback (most recent call last):
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py", line 434, in _async_add_entity
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     await entity.async_update_ha_state()
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     self._async_write_ha_state()
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     state = self.state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:   File "/opt/homeassistant/.local/share/virtualenvs/homeassistant-3PYgz4ZP/lib/python3.8/site-packages/homeassistant/components/tankerkoenig/sensor.py", line 112, in state
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]:     return self._coordinator.data[self._station_id].get(self._fuel_type)
Mar 21 21:56:28 homeassistant.home.pfh pipenv[65491]: KeyError: '5e793b3b-c021-4e36-bd2c-55e357a3638e'

There are a LOT of those errors for exactly the stations which I missed before.

So I further digged into that, played around with some custom logging at the error point in the sensor.py file and finally found some early logging of tankerkoenig:

Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] Received data: {'ok': True, 'license': 'CC BY 4.0 -  https://creativecommons.tankerkoenig.de', 'data': 'MTS-K', 'status': 'ok', 'stations': [{'id': '123dd3f2-f551-4ecf-bda6-5b0be1a37005', 'name': 'BK-Tankstelle Uwe Möderl', 'brand': '', 'street': 'Hauptstraße', 'place': 'Maisach', 'lat': 48.2176, 'lng': 11.26055, 'dist': 0.7, 'diesel': 1.119, 'e5': 1.249, 'e10': 1.209, 'isOpen': True, 'houseNumber': '9', 'postCode': 82216}, {'id': '51d4b6b2-a095-1aa0-e100-80009459e03a', 'name': 'JET MAISACH GERTRAUD-KOELBL-STR. 2', 'brand': 'JET', 'street': 'GERTRAUD-KOELBL-STR. 2', 'place': 'MAISACH', 'lat': 48.217339, 'lng': 11.265664, 'dist': 0.9, 'diesel': 1.119, 'e5': 1.249, 'e10': 1.219, 'isOpen': True, 'houseNumber': '', 'postCode': 82216}, {'id': '00060293-0001-4444-8888-acdc00000001', 'name': 'Erich Walter OHG', 'brand': 'BFT', 'street': 'Rosen Str.', 'place': 'Maisach', 'lat': 48.221450805664, 'lng': 11.265246391296, 'dist': 1.2, 'diesel': 1.129, 'e5': 1.259, 'e10': None, 'isOpen': True, 'houseNumber': '2', 'postCode': 82216}, {'id': 'aa2f7830-2c0a-4a37-803e-8824a8eef426', 'name': 'FUERSTENFELDBRUCK, AUGSBURGER STR.', 'brand': 'Shell', 'street': 'AUGSBURGER STR. 42', 'place': 'FUERSTENFELDBRUCK', 'lat': 48.186668, 'lng': 11.246658, 'dist': 2.9, 'diesel': 1.129, 'e5': 1.289, 'e10': 1.259, 'isOpen': True, 'houseNumber': '', 'postCode': 82256}, {'id': '19275bf1-8186-47d8-b5eb-261431afaced', 'name': 'Esso Tankstelle', 'brand': 'ESSO', 'street': 'SCHLOSSSTR. 161 A', 'place': 'OLCHING', 'lat': 48.198251, 'lng': 11.301376, 'dist': 3.5, 'diesel': 1.139, 'e5': 1.259, 'e10': None, 'isOpen': True, 'houseNumber': '', 'postCode': 82140}, {'id': '80ce1182-e40d-4765-bbb7-f48060768a23', 'name': 'FUERSTENFELDBRUCK - MUENCHNER STRAS', 'brand': 'Agip', 'street': 'Muenchner Strasse', 'place': 'Fuerstenfeldbruck', 'lat': 48.17665, 'lng': 11.26006, 'dist': 3.9, 'diesel': 1.139, 'e5': 1.299, 'e10': 1.269, 'isOpen': True, 'houseNumber': '24/26', 'postCode': 82256}, {'id': '42ddd4e2-9c2e-41d5-b441-eb9f54259535', 'name': 'Fürstenfeldbruck Münchner Strasse 30', 'brand': 'avanti', 'street': 'Münchner Str.', 'place': 'Fürstenfeldbruck', 'lat': 48.17659, 'lng': 11.25996, 'dist': 3.9, 'diesel': 1.119, 'e5': 1.279, 'e10': 1.249, 'isOpen': True, 'houseNumber': '30', 'postCode': 82256}, {'id': '983529d6-7912-43c6-9748-933d49159ca6', 'name': 'BayWa Tankstelle Fürstenfeldbrück', 'brand': 'BayWa', 'street': 'Hubertusstr.', 'place': 'Fürstenfeldbrück', 'lat': 48.17844, 'lng': 11.23107, 'dist': 4.2, 'diesel': 1.119, 'e5': None, 'e10': None, 'isOpen': True, 'houseNumber': '1', 'postCode': 82256}, {'id': '00060039-0001-4444-8888-acdc00000001', 'name': 'Mattern GmbH', 'brand': 'Freie Tankstelle', 'street': 'Heimstettättenstr.', 'place': 'Fürstenfeldbruck', 'lat': 48.177364349365, 'lng': 11.234202384949, 'dist': 4.2, 'diesel': 1.177, 'e5': 1.297, 'e10': None, 'isOpen': True, 'houseNumber': '8', 'postCode': 82256}, {'id': '8fec9d65-531f-447f-b2ef-4fafa4c094a4', 'name': 'Aral Tankstelle', 'brand': 'ARAL', 'street': 'Zadarstrasse', 'place': 'Fürstenfeldbruck', 'lat': 48.1775322, 'lng': 11.2272863, 'dist': 4.4, 'diesel': 1.169, 'e5': 1.319, 'e10': 1.289, 'isOpen': True, 'houseNumber': '11', 'postCode': 82256}, {'id': '5f7e4b7d-482f-4707-a016-00c104984937', 'name': 'AEZ Tankstelle', 'brand': 'Freie', 'street': 'Heimstättenstr.', 'place': 'Fürstenfeldbruck', 'lat': 48.17409, 'lng': 11.2326, 'dist':  4.6, 'diesel': 1.198, 'e5': 1.318, 'e10': None, 'isOpen': False, 'houseNumber': '44', 'postCode': 82256}, {'id': 'c7ef3329-82d0-4cd7-9106-781ddf0164ec', 'name': 'REWE Tankstelle', 'brand': 'REWE', 'street': 'Hermann-Böcker-Straße', 'place': 'Olching Geiselbullach', 'lat': 48.2215, 'lng': 11.33199, 'dist': 5.6, 'diesel': 1.119, 'e5': 1.239, 'e10': 1.219, 'isOpen': False, 'houseNumber': '13', 'postCode': 82140}, {'id': 'd70e98c9-f54b-4131-b02f-e0bf25bcbe7c', 'name': 'Rewe Tankstelle', 'brand': 'Rewe Tankstelle Olching', 'street': 'Hermann Böcker Str.', 'place': 'Olching', 'lat': 48.221498, 'lng': 11.332438, 'dist': 5.6, 'diesel': 1.119, 'e5': 1.239, 'e10': 1.219, 'isOpen': True, 'houseNumber': '13', 'postCode': 82140}, {'id': 'a34a8781-33c1-40b4-85a1-5e2645248f24', 'name': 'Aral Tankstelle', 'brand': 'ARAL', 'street': 'Johann-G.-Gutenbergstraße', 'place': 'Olching', 'lat': 48.1993027, 'lng': 11.3348866, 'dist': 5.9, 'diesel': 1.139, 'e5': 1.259, 'e10': 1.229, 'isOpen': True, 'houseNumber': '1', 'postCode': 82140}, {'id': '6efb6909-7a8d-4e5d-ae70-1ce84dba7d7c', 'name': 'ALLGUTH GmbH c/o Sönmez Günan', 'brand': 'ALLGUTH', 'street': 'Geiselbullacher Str.', 'place': 'Olching', 'lat': 48.22589, 'lng': 11.334475, 'dist': 5.9, 'diesel': 1.129, 'e5': 1.249, 'e10': 1.219, 'isOpen': True, 'houseNumber': '7', 'postCode': 82140}, {'id': '51d4b6bd-a095-1aa0-e100-80009459e03a', 'name': 'JET OLCHING GEISELBULLACHER STR. 1', 'brand': 'JET', 'street': 'GEISELBULLACHER STR. 1', 'place': 'OLCHING', 'lat': 48.2233, 'lng': 11.3368, 'dist': 6, 'diesel': 1.129, 'e5': 1.249, 'e10': 1.219, 'isOpen': True, 'houseNumber': '', 'postCode': 82140}, {'id': '689e1f81-7786-41e0-8f2c-cf722ca309f8', 'name': 'MAMMENDORF, AUGSBURGER STR', 'brand': 'Shell', 'street': 'AUGSBURGER STR. 49', 'place': 'MAMMENDORF', 'lat': 48.205613, 'lng': 11.156861, 'dist': 7.5, 'diesel': 1.129, 'e5': 1.279, 'e10': 1.249, 'isOpen': False, 'houseNumber': '', 'postCode': 82291}, {'id': '5e793b3b-c021-4e36-bd2c-55e357a3638e', 'name': 'Bergkirchen Gadastraße 1', 'brand': 'OMV', 'street': 'Gadastraße', 'place': 'Bergkirchen', 'lat': 48.23738, 'lng': 11.35283, 'dist': 7.6, 'diesel': 1.139, 'e5': 1.259, 'e10': 1.229, 'isOpen': True, 'houseNumber': '1', 'postCode': 85232}]}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': '123dd3f2-f551-4ecf-bda6-5b0be1a37005', 'name': 'BK-Tankstelle Uwe Möderl', 'brand': '', 'street': 'Hauptstraße', 'place': 'Maisach', 'lat': 48.2176, 'lng': 11.26055, 'dist': 0.7, 'diesel': 1.119, 'e5': 1.249, 'e10': 1.209, 'isOpen': True, 'houseNumber': '9', 'postCode': 82216}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': '51d4b6b2-a095-1aa0-e100-80009459e03a', 'name': 'JET MAISACH GERTRAUD-KOELBL-STR. 2', 'brand': 'JET', 'street': 'GERTRAUD-KOELBL-STR. 2', 'place': 'MAISACH', 'lat': 48.217339, 'lng': 11.265664, 'dist': 0.9, 'diesel': 1.119, 'e5': 1.249, 'e10': 1.219, 'isOpen': True, 'houseNumber': '', 'postCode': 82216}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': '00060293-0001-4444-8888-acdc00000001', 'name': 'Erich Walter OHG', 'brand': 'BFT', 'street': 'Rosen Str.', 'place': 'Maisach', 'lat': 48.221450805664, 'lng': 11.265246391296, 'dist': 1.2, 'diesel': 1.129, 'e5': 1.259, 'e10': None, 'isOpen': True, 'houseNumber': '2', 'postCode': 82216}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': 'aa2f7830-2c0a-4a37-803e-8824a8eef426', 'name': 'FUERSTENFELDBRUCK, AUGSBURGER STR.', 'brand': 'Shell', 'street': 'AUGSBURGER STR. 42', 'place': 'FUERSTENFELDBRUCK', 'lat': 48.186668, 'lng': 11.246658, 'dist': 2.9, 'diesel': 1.129, 'e5': 1.289, 'e10': 1.259, 'isOpen': True, 'houseNumber': '', 'postCode': 82256}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': '19275bf1-8186-47d8-b5eb-261431afaced', 'name': 'Esso Tankstelle', 'brand': 'ESSO', 'street': 'SCHLOSSSTR. 161 A', 'place': 'OLCHING', 'lat': 48.198251, 'lng': 11.301376, 'dist': 3.5, 'diesel': 1.139, 'e5': 1.259, 'e10': None, 'isOpen': True, 'houseNumber': '', 'postCode': 82140}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': '80ce1182-e40d-4765-bbb7-f48060768a23', 'name': 'FUERSTENFELDBRUCK - MUENCHNER STRAS', 'brand': 'Agip', 'street': 'Muenchner Strasse', 'place': 'Fuerstenfeldbruck', 'lat': 48.17665, 'lng': 11.26006, 'dist': 3.9, 'diesel': 1.139, 'e5': 1.299, 'e10': 1.269, 'isOpen': True, 'houseNumber': '24/26', 'postCode': 82256}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': '42ddd4e2-9c2e-41d5-b441-eb9f54259535', 'name': 'Fürstenfeldbruck Münchner Strasse 30', 'brand': 'avanti', 'street': 'Münchner Str.', 'place': 'Fürstenfeldbruck', 'lat': 48.17659, 'lng': 11.25996, 'dist': 3.9, 'diesel': 1.119, 'e5': 1.279, 'e10': 1.249, 'isOpen': True, 'houseNumber': '30', 'postCode': 82256}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': '983529d6-7912-43c6-9748-933d49159ca6', 'name': 'BayWa Tankstelle Fürstenfeldbrück', 'brand': 'BayWa', 'street': 'Hubertusstr.', 'place': 'Fürstenfeldbrück', 'lat': 48.17844, 'lng': 11.23107, 'dist': 4.2, 'diesel': 1.119, 'e5': None, 'e10': None, 'isOpen': True, 'houseNumber': '1', 'postCode': 82256}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': '00060039-0001-4444-8888-acdc00000001', 'name': 'Mattern GmbH', 'brand': 'Freie Tankstelle', 'street': 'Heimstettättenstr.', 'place': 'Fürstenfeldbruck', 'lat': 48.177364349365, 'lng': 11.234202384949, 'dist': 4.2, 'diesel': 1.177, 'e5': 1.297, 'e10': None, 'isOpen': True, 'houseNumber': '8', 'postCode': 82256}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': '8fec9d65-531f-447f-b2ef-4fafa4c094a4', 'name': 'Aral Tankstelle', 'brand': 'ARAL', 'street': 'Zadarstrasse', 'place': 'Fürstenfeldbruck', 'lat': 48.1775322, 'lng': 11.2272863, 'dist': 4.4, 'diesel': 1.169, 'e5': 1.319, 'e10': 1.289, 'isOpen': True, 'houseNumber': '11', 'postCode': 82256}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': '5f7e4b7d-482f-4707-a016-00c104984937', 'name': 'AEZ Tankstelle', 'brand': 'Freie', 'street': 'Heimstättenstr.', 'place': 'Fürstenfeldbruck', 'lat': 48.17409, 'lng': 11.2326, 'dist': 4.6, 'diesel': 1.198, 'e5': 1.318, 'e10': None, 'isOpen': False, 'houseNumber': '44', 'postCode': 82256}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': 'c7ef3329-82d0-4cd7-9106-781ddf0164ec', 'name': 'REWE Tankstelle', 'brand': 'REWE', 'street': 'Hermann-Böcker-Straße', 'place': 'Olching Geiselbullach', 'lat': 48.2215, 'lng': 11.33199, 'dist': 5.6, 'diesel': 1.119, 'e5': 1.239, 'e10': 1.219, 'isOpen': False, 'houseNumber': '13', 'postCode': 82140}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': 'd70e98c9-f54b-4131-b02f-e0bf25bcbe7c', 'name': 'Rewe Tankstelle', 'brand': 'Rewe Tankstelle Olching', 'street': 'Hermann Böcker Str.', 'place': 'Olching', 'lat': 48.221498, 'lng': 11.332438, 'dist': 5.6, 'diesel': 1.119, 'e5': 1.239, 'e10': 1.219, 'isOpen': True, 'houseNumber': '13', 'postCode': 82140}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': 'a34a8781-33c1-40b4-85a1-5e2645248f24', 'name': 'Aral Tankstelle', 'brand': 'ARAL', 'street': 'Johann-G.-Gutenbergstraße', 'place': 'Olching', 'lat': 48.1993027, 'lng': 11.3348866, 'dist': 5.9, 'diesel': 1.139, 'e5': 1.259, 'e10': 1.229, 'isOpen': True, 'houseNumber': '1', postCode': 82140}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': '6efb6909-7a8d-4e5d-ae70-1ce84dba7d7c', 'name': 'ALLGUTH GmbH c/o Sönmez Günan', 'brand': 'ALLGUTH', 'street': 'Geiselbullacher Str.', 'place': 'Olching', 'lat': 48.22589, 'lng': 11.334475, 'dist': 5.9, 'diesel': 1.129, 'e5': 1.249, 'e10': 1.219, 'isOpen': True, 'houseNumber': '7', 'postCode': 82140}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': '51d4b6bd-a095-1aa0-e100-80009459e03a', 'name': 'JET OLCHING GEISELBULLACHER STR. 1', 'brand': 'JET', 'street': 'GEISELBULLACHER STR. 1', 'place': 'OLCHING', 'lat': 48.2233, 'lng': 11.3368, 'dist': 6, 'diesel': 1.129, 'e5': 1.249, 'e10': 1.219, 'isOpen': True, 'houseNumber': '', 'postCode': 82140}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': '689e1f81-7786-41e0-8f2c-cf722ca309f8', 'name': 'MAMMENDORF, AUGSBURGER STR', 'brand': 'Shell', 'street': 'AUGSBURGER STR. 49', 'place': 'MAMMENDORF', 'lat': 48.205613, 'lng': 11.156861, 'dist': 7.5, 'diesel': 1.129, 'e5': 1.279, 'e10': 1.249, 'isOpen': False, 'houseNumber': '', 'postCode': 82291}
Mar 21 21:56:27 homeassistant.home.pfh pipenv[65491]: 2020-03-21 21:56:27 DEBUG (SyncWorker_0) [homeassistant.components.tankerkoenig] add_station called for station: {'id': '5e793b3b-c021-4e36-bd2c-55e357a3638e', 'name': 'Bergkirchen Gadastraße 1', 'brand': 'OMV', 'street': 'Gadastraße', 'place': 'Bergkirchen', 'lat': 48.23738, 'lng': 11.35283, 'dist': 7.6, 'diesel': 1.139, 'e5': 1.259, 'e10': 1.229, 'isOpen': True, 'houseNumber': '1', 'postCode': 85232}

This was quite surprising because within this former log entries ALL data of all stations which should be there is definitely available. This makes me pretty sure, that this is an error within home-assistant because Tankerkoenig definitely delivers the data.

Additional information

I added some debugging lines right before line 112 of the sensor.py and got this:

Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] data: {'status': 'open', 'e5': 1.249, 'e10': 1.209, 'diesel': 1.119}
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] station_id: 51d4b6b2-a095-1aa0-e100-80009459e03a
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] fuel_type state: e5
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] data: {'status': 'open', 'e5': 1.249, 'e10': 1.219, 'diesel': 1.119}
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] station_id: 42ddd4e2-9c2e-41d5-b441-eb9f54259535
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] fuel_type state: e10
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] data: {'status': 'open', 'e5': 1.279, 'e10': 1.249, 'diesel': 1.119}
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] station_id: c7ef3329-82d0-4cd7-9106-781ddf0164ec
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] fuel_type state: diesel
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] station_id: 689e1f81-7786-41e0-8f2c-cf722ca309f8
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] fuel_type state: diesel
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] station_id: 00060293-0001-4444-8888-acdc00000001
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] fuel_type state: e5
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] data: {'status': 'open', 'e5': 1.259, 'e10': False, 'diesel': 1.129}
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] station_id: 42ddd4e2-9c2e-41d5-b441-eb9f54259535
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] fuel_type state: diesel
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] data: {'status': 'open', 'e5': 1.279, 'e10': 1.249, 'diesel': 1.119}
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] station_id: d70e98c9-f54b-4131-b02f-e0bf25bcbe7c
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] fuel_type state: e5
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] station_id: 5e793b3b-c021-4e36-bd2c-55e357a3638e
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] fuel_type state: e5
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] station_id: 00060293-0001-4444-8888-acdc00000001
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] fuel_type state: e10
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] data: {'status': 'open', 'e5': 1.259, 'e10': False, 'diesel': 1.129}
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] station_id: 983529d6-7912-43c6-9748-933d49159ca6
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] fuel_type state: e5
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] data: {'status': 'open', 'e5': False, 'e10': False, 'diesel': 1.119}
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] station_id: d70e98c9-f54b-4131-b02f-e0bf25bcbe7c
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] fuel_type state: e10
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] station_id: 5e793b3b-c021-4e36-bd2c-55e357a3638e
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] fuel_type state: e10
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] station_id: 00060293-0001-4444-8888-acdc00000001
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] fuel_type state: diesel
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] data: {'status': 'open', 'e5': 1.259, 'e10': False, 'diesel': 1.129}
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] station_id: 983529d6-7912-43c6-9748-933d49159ca6
Mar 21 21:48:41 homeassistant.home.pfh pipenv[65364]: 2020-03-21 21:48:41 DEBUG (MainThread) [homeassistant.components.tankerkoenig.sensor] fuel_type state: e10

Normally there should be a debug logging for each fuel type of a station containing the station_id, fuel_type and the station data. But as you can see the data sometimes simply is missing as if it really is not there.

guillempages commented 4 years ago

Thanks for the detailed analysis!

This looks like a duplicate of #33061 (or at least seems to share the root cause), the fix should be available in 0.107.5. Can you try again when that is available and see if it can still be reproduced?

Armadill0 commented 4 years ago

Yes works with 0.107.5, thank you! 😄