eelcohn / home-assistant-rdw Goto Github PK
View Code? Open in Web Editor NEWRDW sensor module for Home Assistant
RDW sensor module for Home Assistant
Quick fix: restart Home Assistant
Entities (binary_sensor(s) and sensor(s)) are probably not removed correctly.
rdw: the '.translations' directory has been moved, the new name is 'translations', starting with Home Assistant 0.111 your translations will no longer load if you do not move/rename this
Currently, the Insured state is a sensor
and not a binary_sensor
. For automations etc. it would be preferable to create the sensor as a type binary_sensor
, so it can be used for logical comparisions. Using this, will also allow it to be displayed in our local language Dutch, since the True/False or On/Off etc. get translated. We can even use the device class type for sensors:
https://www.home-assistant.io/docs/configuration/customizing-devices/#device_class
My current workaround is to create an extra template binary sensor:
binary_sensor:
- platform: template
sensors:
niro_insured:
friendly_name: "Niro Insured"
entity_id: sensor.niro_insured
value_template: "{{ is_state('sensor.niro_insured', 'True') }}"
When the RDW API goes into maintenance mode, it will return HTTP status code 503 (service unavailable). Make a warning and return last known values, or 'None' values.
Site Currently Unavailable
warning icon This Socrata-powered site is currently unavailable.
You can always check the status of Socrata at http://status.socrata.com or check our twitter account at @socrata.
socrata
Replace _LOGGER.error with _LOGGER.warning.
2021-03-04 07:56:28 WARNING (MainThread) [homeassistant.loader] No 'version' key in the manifest file for custom integration 'rdw'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'rdw'
see the Breaking Changes
@callback
def configured_instances(hass):
"""Return a set of configured RDW instances."""
if DATA_KEY in hass.data:
result = set(entry._plate for entry in hass.data[DATA_KEY])
_LOGGER.debug("config_flow::configured_instances called - returned configured instances %s", result)
return result
else:
_LOGGER.debug("config_flow::configured_instances called - no instances found")
return {}
Hi,
After setting up the custom component and the config, I'm not getting any sensors and after a while I see issues in the log:
Log Details (ERROR)
Tue Feb 25 2020 17:20:18 GMT+0100 (Midden-Europese standaardtijd)
'entity_id'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
connection.context(msg),
File "/usr/src/homeassistant/homeassistant/core.py", line 1226, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1251, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/components/homeassistant/__init__.py", line 123, in async_handle_update_service
for entity in call.data[ATTR_ENTITY_ID]
KeyError: 'entity_id'
and
Log Details (ERROR)
Tue Feb 25 2020 17:18:46 GMT+0100 (Midden-Europese standaardtijd)
http://HASS/frontend_latest/chunk.a43c77da5c1bf5fdcb4f.js:518:874 Uncaught TypeError: Cannot read property 'state' of undefined
I've verified with my plate number that it returns details from the url: https://opendata.rdw.nl/resource/m9d7-ebf2.json?kenteken=
Bedankt!
_RDW component version: 2.9.7
_Home Assistant version: 2021.6.0
_Home Assistant platform: supervisor-2021.05.4
| Home Assistant OS 5.13
Tell us what should happen
Integration should load normal.
Tell us what happens instead
Getting erros when starting Integration.
Error 1:
The system cannot restart because the configuration is not valid: Component error: rdw - Integration 'rdw' not found.
Error 2:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/components/hassio/__init__.py", line 518, in async_handle_core_service
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: The system cannot restart because the configuration is not valid: Component error: rdw - Integration 'rdw' not found.
Before opening a new issue, please make sure you're running the latest Home Assistant version and the latest RDW component version!
_RDW component version: latest version.
_Home Assistant version: 2021.4.3
_Home Assistant platform: Core
I reinstalled with latest version and existing configuration. I expected that it starts after restarting HA.
During startup of HA the following error was shown in logging. And component does not start.
“The rdw platform for the sensor integration does not support platform setup. Please remove it from your config.”
1.
2.
3.
Add the following lines to your configuration.yaml
to enable detailed debug logging:
logger:
logs:
custom_components.rdw: debug
Please report the debug logging below:
Insert RDW debug logging here
Currently getting the next error with using the latest version:
I don't see yet how to get a token that should probably come from:
https://opendata.rdw.nl/
But there is currently also not an option in the configuration to insert this token. Or is this supported in the dashboard of HA?
Log Details (WARNING)
Logger: root
Source: custom_components/rdw/__init__.py:185
First occurred: 11:30:51 PM (2 occurrences)
Last logged: 11:30:52 PM
Requests made without an app_token will be subject to strict throttling limits.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 450, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/rdw/sensor.py", line 129, in update
self._state = datetime.strptime(self._data.expdate, '%Y%m%d')
TypeError: strptime() argument 1 must be str, not None
After upgrading to Python 3.8.0 I am seeing the following warning:
Nov 20 17:25:27 hass hass[24433]: /home/hass/.homeassistant/custom_components/rdw/sensor.py:255: SyntaxWarning: "is not" with a literal. Did you mean "!="?
Nov 20 17:25:27 hass hass[24433]: if recall['code_status'] is not 'P':
Hi, this is one of the few integrations that misses an icon on the integrations page, I was adding icons for another integration and decided to also add for this one :-)
(feel free to close this after reading)
Could you please add support for HACS? That would make installing / upgrading a lot easier.
After updating to the latest version of the sensor and HASS I keep on getting notifications that "new devices have been discovered". The integrations page now shows 3 RDW instances, even though I have only one car configured.
Not sure if I can leave this question here, but let me try.
I've installed RDW and now I want to add it. So, I go to Integrations, search for RDW and click it.
A pop-up appears, but without explanation what to fill in.
So, can you help? What to fill in? It is an empty popup, but I have to fill something in before I can submit...
Since Home Assistant 0.109.0:
The expired
sensor is a formatted string. It would be better/best if it is an actual datetime type sensor. It can then be formatted according to the user's preferences and can be used more easily in calculations.
Compare with the time_date
sensor:
The component should separate api access and home assistant logic. Move api access code to a library. Like the one you've started.
From the community.home-assistant.io site:
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
Hi, can you please add HACS support. This well be the new custom updater.
Hi,
Since a while I'm getting error messages like this:
Log Details (ERROR)
Logger: homeassistant.components.binary_sensor
Source: helpers/entity_platform.py:435
Integration: Binary sensor (documentation, issues)
First occurred: 12:09:02 PM (1 occurrences)
Last logged: 12:09:02 PM
Entity id already exists - ignoring: binary_sensor.golf_7_insured. Platform rdw does not generate unique IDs
On the configuration - integration page I had a lot of records for RDW, I deleted all beside the one with 3 entities and restarted (which game the above log) and the following UI:
Config:
❯ cat hass-config/packages/rdw.yaml
rdw:
- plate: 82ZXJ2
name: "Golf 7"
binary_sensors:
- insured
sensors:
- expdate
- recall
homeassistant:
customize:
sensor.golf_7_expdate:
friendly_name: "APK Vervaldatum"
binary_sensor.golf_7_insured:
friendly_name: "Verzekeringsstatus"
sensor.golf_7_recall:
friendly_name: "Terugroepstatus"
group:
AutoGolf7:
name: Golf 7
entities:
- sensor.golf_7_expdate
- binary_sensor.golf_7_insured
- sensor.golf_7_recall
2020-11-22 10:08:30 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template("{{ ((as_timestamp(strptime(states('sen
sor.car_expdate'), '%d %b %Y')) / 86400) | int) == ((as_timestamp(strptime(states('sensor.date'), '%Y-%m-%d')) / 86400) | int) + 14 }}")
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 351, in async_render
render_result = compiled.render(kwargs)
File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/usr/local/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "<template>", line 1, in top-level template code
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 448, in async_render_to_info
render_info._result = self.async_render(variables, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 353, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
RDW component version: Latest v2.9.8
Home Assistant version: 0.114.4
Home Assistant platform: Home Assistant Supervised (Docker)
Adding a new license plate entity and the sensors
Tell us what happens instead
When adding a new license plate a unknows error occured:
1. Add a new license plate
Home Assistant Logs:
Log Details (ERROR)
Logger: aiohttp.server
Source: custom_components/rdw/config_flow.py:101
First occurred: 8:07:30 AM (3 occurrences)
Last logged: 8:10:47 AM
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 418, in start
resp = await task
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 458, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 73, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 145, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 60, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 106, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 153, in async_configure
result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 201, in _async_handle_step
result: Dict = 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'
Running latest version of everything ...
The recalls sensor give back a string value without unit of measurement. It should give back an integer with a unit of measurement like recalls
.
The values True
and False
do not work properly with device classes. Instead on
or off
could be used (lowercase), or constants.
home-assistant-rdw/binary_sensor.py
Line 148 in 8a44d29
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.