Custom sensor for dutch license plate checks (APK check)

I have one more problem. I have 2 cars and with restarting home assistant sometimes on of the 2 cars fills with the initialization.

2020-05-15 18:02:58 WARNING (MainThread) [custom_components.rdw] Unable to update data from endpoint m9d7-ebf2 for XXXXXX: HTTPSConnectionPool(host=‘opendata.rdw.nl’, port=443): Max retries exceeded with url: /resource/m9d7-ebf2.json?kenteken=ZP051X (Caused by NewConnectionError(‘<urllib3.connection.HTTPSConnection object at 0x7fc0f01b8e50>: Failed to establish a new connection: [Errno -2] Name does not resolve’))
2020-05-15 18:02:58 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Auto Giel (configuration.yaml) for rdw
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 216, in async_setup
hass, self
File “/config/custom_components/rdw/init.py”, line 106, in async_setup_entry
raise PlatformNotReady
homeassistant.exceptions.PlatformNotReady
2020-05-15 18:03:00 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.rdw

Its not a problem that it fails, but once it failed it will not retry to re-initialize the sensors. I have to restart home assistant again to make it work.

[edit]
hmmz restarting will not fix this. Do you know what this error means?

This means that Home Assistant can’t resolve the hostname opendata.rdw.nl. Your DNS server isn’t working and/or reachable. This is not a specific RDW-component problem, and you’ll probably see have this problem with other Cloud-components in Home Assistant as well.

That should not happen. The RDW component should re-initialize the sensors automatically like any other component in HA when the internet connection is up again/when the DNS server is up again.

I have setup rdw but it don’t work.

My conf:
rdw:

  • plate: 0xxx00
    name: “BMW”
    binary_sensors:
    • insured
      sensors:
    • expdate
    • recall
  • plate: 00xxxx
    name: “C1”
    binary_sensors:
    • insured
      sensors:
    • expdate
    • recall

Error:
Logboekdetails (ERROR)

Logger: homeassistant.config_entries
Source: custom_components/rdw/init.py:275
First occurred: 19:31:29 (2 occurrences)
Last logged: 19:31:29

Error setting up entry C1 (configuration.yaml) for rdw
Error setting up entry BMW (configuration.yaml) for rdw

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 217, in async_setup
hass, self
File “/config/custom_components/rdw/init.py”, line 107, in async_setup_entry
if not await rdw.async_update():
File “/config/custom_components/rdw/init.py”, line 275, in async_update
raise RDWEntity.NotRegistered
custom_components.rdw.RDWEntity.NotRegistered

There is an error in line 16 of nl.json.

It says:
“name”: “name of the car”,

but this should be:
“name”: “name of the car”

The comma is not right there.

Looks like the license plate ID isn’t correct. Please check that you’ve entered the correct license plate ID.

Unrelated to your specific problem: looks like the error handling for unregistered license plates isn’t that user friendly. I’ll look into that and try and fix it in a future release.

Thank you for pointing that out. It should be fixed in v2.9.8.

I used lowercase letters, that was wrong. Now adjusted to uppercase and it works.

tried to add some plates using the GUI, but i’ll get this error:
image

already tried to : delete the old setting from the config.yaml , removed everything that’s RDW, reboot the HAS installation several times

the log tells me
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 256, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/config/custom_components/rdw/config_flow.py", line 101, in async_step_user config_entry = {'data', user_input} TypeError: unhashable type: 'dict'

1 Like

RDW has been build into HA version: 2021.12

Beta release notes: Home Assistant

(THANKS Frenck!!)

what can be the problem, the error still exists

@frenck WOW! thanks for integrating the component into the official Home Assistant repo! Mucho kudos!

How do you show the plate in Lovelace when added via the integration? There is no sensor for that

As it is fairly static: can’t you just add it to the card title or use a markdown card?
Although it could be useful for Automations perhaps to have a sensor (or sensor attribute) that holds the licenseplate as value.

Exactly. As it is not stored now, although I can’t find it, I can’t make an automation notification with the license plate as a value.

Perhaps you could open a topic on the featurerequests board here? I’d support your request :wink:

:wink:

I gave it my up vote, as promised!

1 Like

Same here…did you find a solution?

there seems to be oneother issue with this integration. Getting the error that the date isn’t okay. and the log file tells me :

Blockquote Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py”, line 433, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py”, line 504, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py”, line 117, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/security_filter.py”, line 85, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/forwarded.py”, line 100, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/request_context.py”, line 28, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/ban.py”, line 80, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/auth.py”, line 236, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/view.py”, line 148, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/config/config_entries.py”, line 181, in post
return await super().post(request, flow_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/data_validator.py”, line 72, in wrapper
result = await method(view, request, data, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py”, line 110, in post
result = await self._flow_mgr.async_configure(flow_id, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 271, in async_configure
result = await self._async_handle_step(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 367, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/config/custom_components/rdw/config_flow.py”, line 101, in async_step_user
config_entry = {‘data’, user_input}
^^^^^^^^^^^^^^^^^^^^
TypeError: unhashable type: ‘dict’

Someone who can help me ?