Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Warning message done by HA 0.109.x #30

Closed
oncleben31 opened this issue May 1, 2020 · 24 comments
Closed

Warning message done by HA 0.109.x #30

oncleben31 opened this issue May 1, 2020 · 24 comments
Labels
enhancement New feature or request

Comments

@oncleben31
Copy link
Member

Since the new release of HA we have this warning message:


Logger: homeassistant.util.async_
Source: util/async_.py:120
First occurred: 8:17:24 (2 occurrences)
Last logged: 8:17:25

Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for renaultze doing I/O at custom_components/renaultze/sensor.py, line 83: config.get(CONF_PASSWORD)):
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for renaultze doing I/O at custom_components/renaultze/sensor.py, line 85: g.account_info()

It seems we need to optimize the code to reduce I/O when not expected.

@epenet
Copy link
Collaborator

epenet commented May 13, 2020

The underlying Pyze module is fully synchronous, so we'll need to wait until my Asynchronous PR is merged and published before we can implement this inside the hass custom component.

@epenet epenet added the enhancement New feature or request label May 13, 2020
@epenet
Copy link
Collaborator

epenet commented May 13, 2020

Ref jamesremuscat/pyze#60

@DavidMStraub
Copy link

Hi @epenet, thanks a lot for your integration, it makes me happy every day :)

Concerning this issue: it's not a problem using synchronous libraries with Home Assistant, but you have to call the I/O functions by adding an executor job, please see here: https://developers.home-assistant.io/docs/asyncio_working_with_async/#calling-sync-functions-from-async

Keep up the good work!

@epenet
Copy link
Collaborator

epenet commented Oct 2, 2020

Hi @DavidMStraub / @oncleben31,

Can you update to v3.0.0 and see if that is still an issue?

@DavidMStraub
Copy link

Thanks, the config flow works, quite cool!

FYI some entries from my log (not sure if there is an actual problem):

2020-10-03 16:19:57 ERROR (MainThread) [custom_components.renault.pyzevehicleproxy] Error requesting VF1AG*** hvac_status data: 502 Server Error: Bad Gateway for url: https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/****/kamereon/kca/car-adapter/v1/cars/VF1AG***/hvac-status?country=DE
2020-10-03 16:20:00 WARNING (MainThread) [homeassistant.components.climate] Setup of climate platform renault is taking over 10 seconds.
2020-10-03 16:20:00 WARNING (MainThread) [homeassistant.components.binary_sensor] Setup of binary_sensor platform renault is taking over 10 seconds.
2020-10-03 16:20:18 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.renault
2020-10-03 16:20:27 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.renault
2020-10-03 16:20:32 WARNING (MainThread) [custom_components.renault.device_tracker] gpsLatitude not available in coordinator data {}
...
2020-10-03 17:22:55 ERROR (MainThread) [custom_components.renault.pyzevehicleproxy] Error requesting VF1AG*** battery data: 500 Server Error: Internal Server Error for url: https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/21ff9c64-bafc-4dd4-ac2d-aed0ba027af4/kamereon/kca/car-adapter/v2/cars/VF1AG***/battery-status?country=DE
...
2020-10-03 17:23:56 INFO (MainThread) [custom_components.renault.pyzevehicleproxy] Fetching VF1AG*** battery data recovered

@epenet
Copy link
Collaborator

epenet commented Oct 4, 2020

How does it look after a couple of days?

@DavidMStraub
Copy link

  • I get the gpsLatitude not available every minute
  • Battery data gives occasional errors:
Error requesting *** battery data: 500 Server Error: Internal Server Error for url: https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/21ff9c64-bafc-4dd4-ac2d-aed0ba027af4/kamereon/kca/car-adapter/v2/cars/***/battery-status?country=DE
2020-10-06 20:02:06 INFO (MainThread) [custom_components.renault.pyzevehicleproxy] Fetching *** battery data recovered
2020-10-06 20:07:09 ERROR (MainThread) [custom_components.renault.pyzevehicleproxy] Error requesting *** location data: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
2020-10-06 20:08:09 INFO (MainThread) [custom_components.renault.pyzevehicleproxy] Fetching *** location data recovered

(but the state of charge sensor etc. do work)

@epenet
Copy link
Collaborator

epenet commented Oct 7, 2020

Can you get more precise logs regarding the location/gpsLatitude issue?
It looks like your location query succeeds, but some data is missing from it!

For example with these settings:

logger:
  default: info
  logs:
    pyze: debug
    custom_components.renault: debug

@DavidMStraub
Copy link

DavidMStraub commented Oct 12, 2020

Not sure what info exactly you need, but a typical API response in the debug log looks like this:

Received Kamereon vehicle response: {"data":{"type":"Car","id":"VF...","attributes":{"timestamp":"2020-10-12T16:15:58Z","batteryLevel":51,"batteryTemperature":20,"batteryAutonomy":120,"batteryCapacity":0,"batteryAvailableEnergy":19,"plugStatus":0,"chargingStatus":0.0,"chargingRemainingTime":15,"chargingInstantaneousPower":1.1}}}

@epenet
Copy link
Collaborator

epenet commented Oct 12, 2020

There are five different methods to get car information. You have provided a "battery" API response, but there should also be "mileage", "charge_mode", "hvac_status" and "location" API responses. It's the "location" API response that would be required here.

Having reviewed the code, it seems that this error occurs when "location" request succeed but doesn't return any information.
Do you get GPS information back with the PyZE client?

@DavidMStraub
Copy link

Using pyze

  • mileage, charge_mode & battery_status work - these are also the sensors that work in HA
  • location returns an empty dict (does my car even have GPS? 🤔)
  • hvac_status raises HTTPError: 502 Server Error: Bad Gateway for url

@epenet
Copy link
Collaborator

epenet commented Oct 15, 2020

If your vehicle doesn't support location and hvac status, then I suggest that you simply deactivate the "Zoe Location" and "Zoe HVAC" entities via "Configuration > Integrations >Renault >Entities" menu of home assistant.

@oncleben31
Copy link
Member Author

Is it possible to detect what sensors is available when user is installing the integration ?

@epenet
Copy link
Collaborator

epenet commented Oct 15, 2020

In part, yes: for now, it distinguishes between ZE50 and ZE40, but it doesn't distinguish between ZE50 with GPS, and ZE50 without GPS.

@oncleben31
Copy link
Member Author

I'm just starting to try the 3.0.0-rc3. I don't why I'm doing wrong but I don't find the renault integration in the list when I click the + button.

@oncleben31
Copy link
Member Author

OK It's it's now in integration list. Need to refresh the browser to have the integration visible in the list. Now I have added the integration but there is no device or entities associated to the added integration. Strange.

@oncleben31
Copy link
Member Author

OK during the config flow, I have to serial number at the last step. The first one didn't work and the second correspond to my Zoé. I'm playing with it and update my HA configuration.
I notice that battery temperature is missing. Is it normal ?

@oncleben31
Copy link
Member Author

oncleben31 commented Oct 17, 2020

I have this error:

2020-10-18 00:28:26 ERROR (MainThread) [custom_components.renault.pyzevehicleproxy] Error requesting VF1AG_REDACTED charge_mode data: 403 Client Error: Forbidden for url: https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/REDACTED/kamereon/kca/car-adapter/v1/cars/VF1AG_REDACTED /charge-mode?country=FR

Is it related to 'direct charge' or using schedule ? If yes this is normal. I 've the Life version and I think the option is not compatible with this Zoé version

@oncleben31
Copy link
Member Author

oncleben31 commented Oct 17, 2020

Idea for improvement. You can add the following value in the string file to allow translation of the entity charge_state and plug_state:

_CHARGE_STATES = {
    0.0: ['Not charging', 'NOT_IN_CHARGE'],
    0.1: ['Waiting for planned charge', 'WAITING_FOR_PLANNED_CHARGE'],
    0.2: ['Charge ended', 'CHARGE_ENDED'],
    0.3: ['Waiting for current charge', 'WAITING_FOR_CURRENT_CHARGE'],
    0.4: ['Energy flap opened', 'ENERGY_FLAP_OPENED'],
    1.0: ['Charging', 'CHARGE_IN_PROGRESS'],
    # This next is more accurately "not charging" (<= ZE40) or "error" (ZE50).
    # But I don't want to include 'error' in the output text because people will
    # think that it's an error in Pyze when their ZE40 isn't plugged in...
    -1.0: ['Not charging or plugged in', 'CHARGE_ERROR'],
    -1.1: ['Not available', 'NOT_AVAILABLE']

_PLUG_STATES = {
    0: ['Unplugged', 'UNPLUGGED'],
    1: ['Plugged in', 'PLUGGED'],
    -1: ['Plug error', 'PLUG_ERROR'],
    -2147483648: ['Not available', 'NOT_AVAILABLE']

@epenet
Copy link
Collaborator

epenet commented Oct 23, 2020

_CHARGE_STATE is already implemented in the "Charge State" sensor: https://github.com/epenet/hassRenaultZE/blob/develop/custom_components/renault/sensor.py#L213

_PLUG_STATES is already implemented in the "Plug State" sensor: https://github.com/epenet/hassRenaultZE/blob/develop/custom_components/renault/sensor.py#L190

The binary sensors (Charging and Plugged In) are purposefully "simplified" versions of this.

@oncleben31
Copy link
Member Author

Thank you very much for your work on this integration. You are welcomed on HACF network if you want to share the energy, get support and discuss in French ;-)

@oncleben31
Copy link
Member Author

_CHARGE_STATE is already implemented in the "Charge State" sensor: https://github.com/epenet/hassRenaultZE/blob/develop/custom_components/renault/sensor.py#L213

_PLUG_STATES is already implemented in the "Plug State" sensor: https://github.com/epenet/hassRenaultZE/blob/develop/custom_components/renault/sensor.py#L190

The binary sensors (Charging and Plugged In) are purposefully "simplified" versions of this.

I'm not sure to understand you comment. I've seen that you have already implemented sensor to reuse the value. My previous comment was about adding the strings in the translation file to ensure having translated states in the future.

@epenet
Copy link
Collaborator

epenet commented Oct 24, 2020

I see better what you mean - I've opened a separate issue for that.

I think we can close this one now...

@oncleben31
Copy link
Member Author

OK to close.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants