GithubHelp home page GithubHelp logo

home-assistant-rdw's People

Contributors

eelcohn avatar golles avatar klumper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

home-assistant-rdw's Issues

Insured as a binary sensor

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') }}"

Handle HTTP statuscode 503

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

Version Requirement in future HA builds

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
image

Simplify code in config_flow.py

@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 {}

Can't set up

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!

Intergration doesn't work anymore after update 2021.6.0

Intergration doesn't work anymore after update 2021.6.0

Versions

_RDW component version: 2.9.7
_Home Assistant version: 2021.6.0
_Home Assistant platform: supervisor-2021.05.4 | Home Assistant OS 5.13

Expected behavior

Tell us what should happen
Integration should load normal.

Actual behavior

Tell us what happens instead
Getting erros when starting Integration.

Error log

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.

Error after reinstall

Before opening a new issue, please make sure you're running the latest Home Assistant version and the latest RDW component version!

Versions

_RDW component version: latest version.

_Home Assistant version: 2021.4.3

_Home Assistant platform: Core

Expected behavior

I reinstalled with latest version and existing configuration. I expected that it starts after restarting HA.

Actual behavior

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.”

Steps to reproduce

1.

2.

3.

Component log

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

Requests made without an app_token will be subject to strict throttling limits.

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. 

Prevent exception when RDW API is unavailable (503 service unavailable)

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

SyntaxWarning: "is not" with a literal. Did you mean "!="?

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':

FYI: I added icons

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 :-)

home-assistant/brands#2786

(feel free to close this after reading)

HACS support

Could you please add support for HACS? That would make installing / upgrading a lot easier.

Installation issue

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...

Thanks a lot for your quick reponse!
rdw

Detected I/O inside the event loop

Since Home Assistant 0.109.0:

  • Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for rdw doing I/O at custom_components/rdw/init.py, line 211: kenteken=self._plate
  • Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for rdw doing I/O at custom_components/rdw/init.py, line 225: kenteken=self._plate

Recalls is a string and not an integer

See #7 and #8.

Update:
This is an issue, for example, when you want to use the number of recalls as a trigger in an automation (greather than 0) or in an entity-filter case. I use the latter to hide the entity unless there actually is a recall.

Error handling on unregistered license plate IDs

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

Entity id already exists - ignoring: binary_sensor.golf_7_insured. Platform rdw does not generate unique IDs

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:
Screenshot 2020-04-30 at 12 12 20

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

Automation gives error on startup because expdate isn't initialized yet

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'                                            

Unknown error occurred when adding a license plate

Versions

RDW component version: Latest v2.9.8

Home Assistant version: 0.114.4

Home Assistant platform: Home Assistant Supervised (Docker)

Expected behavior

Adding a new license plate entity and the sensors

Actual behavior

Tell us what happens instead
When adding a new license plate a unknows error occured:
image

Steps to reproduce

1. Add a new license plate

Component log

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'


Recalls numeric with unit of measurement

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.