Renault ZOE, My Renault and My ZE Online

@blaine you said something strange. I don’t think you can use both app Renault ZE Services and My renault. The custom_component by epenet si for My Renault app. If you can’t login in this app and get your Zoé data. You won’t be able to use this custom component.
If this is the case you have a dedicated branch ‘oldApi’ that could work but not maintain any more I think.

Sorry guys, I need to bother you again… In the meantime, I was able to get my ZOE migrated into the new myrenault app. The app works, I can see all data. The integration into homeassistant however still won’t work, even though I re-installed pyze version 4.0 today. I have also updated the custom component files so that I can be sure to be on the latest version. Above that, I manually created the directory in the virtual environment /home/hass/.credentials. Despite all effort, I still get the same error:

Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py”, line 150, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File “/usr/local/lib/python3.7/asyncio/tasks.py”, line 442, in wait_for
return fut.result()
File “/home/hass/homeassistant/custom_components/renaultze/sensor.py”, line 58, in async_setup_platform
cred.clear()
File “/srv/homeassistant/lib/python3.7/site-packages/pyze/api/credentials.py”, line 94, in clear
self._write()
File “/srv/homeassistant/lib/python3.7/site-packages/pyze/api/credentials.py”, line 80, in _write
os.makedirs(dirname)
File “/srv/homeassistant/lib/python3.7/os.py”, line 221, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/.

Would it make sens to clear the cache, de-install pyze, or do whatever (since I apparently tried to make the custom component work WITHOUT the car being migrated into the new app)? If there’s a way to re-install, how would I do it? Thanks for your advice…

Hello,

I restarted Hass and after that it renaultze will not work anymore. It has worked for several weeks without a problem. Can anyone point me in the right direction?

Could it have to do with the API change mentioned in this fix?

This is the error in the logs:

2020-07-02 08:35:49 WARNING (SyncWorker_8) [custom_components.renaultze.sensor] Charge mode update failed: Traceback (most recent call last):
  File "/config/custom_components/renaultze/sensor.py", line 263, in update
    jsonresult =  self._vehicle.charge_mode()
  File "/usr/local/lib/python3.7/site-packages/pyze/api/kamereon.py", line 235, in charge_mode
    raw_mode = self._get('charge-mode')['chargeMode']
  File "/usr/local/lib/python3.7/site-packages/pyze/api/kamereon.py", line 196, in _get
    endpoint
  File "/usr/local/lib/python3.7/site-packages/pyze/api/credentials.py", line 26, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pyze/api/kamereon.py", line 180, in _request
    'x-kamereon-authorization': 'Bearer {}'.format(self._kamereon.get_token())
  File "/usr/local/lib/python3.7/site-packages/pyze/api/credentials.py", line 26, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pyze/api/kamereon.py", line 125, in get_token
    response.raise_for_status()
  File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/********MYVIN*******/kamereon/token?country=GB

Got it working again, Renault changed the API. Pyze fixed it in v 0.5.0
I edited manifest.json and changed:

{
  "domain": "renaultze",
  "name": "Renault ZE",
  "documentation": "https://github.com/epenet/hassRenaultZE",
  "dependencies": [],
  "codeowners": ["@epenet"],
  "requirements": ["pyze==0.4.0"]
}

into

{
  "domain": "renaultze",
  "name": "Renault ZE",
  "documentation": "https://github.com/epenet/hassRenaultZE",
  "dependencies": [],
  "codeowners": ["@epenet"],
  "requirements": ["pyze==0.5.0"]
}

After this, reboot the system so it can get the new version

Did you open an issue on Github ?

Hello @epenet

Here is the issue I got. Any clue on how to solve it?

Howerver the sensor is displaying all relevant data! Thank you so much for that!

On another topic, I see many attributes on the sensor. And it looks greeeeeeaaaat!
But do we have a documentation about it? I mean what is for instance the charge_mode or the battery_available_energy (which has a different value from my battery) attributes?

And does anyone know how to display the car on a map card? I thought by selecting the sensor directly it would work but it does not. Maybe it is because the attributes are not named simply latitude and longitude. Is it?

I’m trying to get the Renault component added to the Home Assistant Core: PR#39605

The issue with the I/O loop is fixed in that PR, and hopefully once all the PR’s I’ve got in the pipeline are added to the core you’ll see them all as sensors instead of attributes.

Regarding the meaning of the attributes, then maybe take a look at the PyZE repository for information. It has a wiki but the Renault API is undocumented so we’ve all had to chip in with our findings.

Great thank you and good job to you!!

ANy clue on the map feature ? And I can’t get to display the date and time nicely, is it because it uses a specific format? I am trying to use the format option in the entities card.

Anyway, overall it is looking neat! Thanks!
image

Hey one question for you guys, is it possible to add one car linked to multiple My Renault account ? We are three using the same car.

Let us know when it will be released!

By the way, @epenet, I wanted to thank you so much! Thanks to you, I was able to retrieve my car after it was stolen from me. In it, all our computers and tablets the thieves took from our house. So, THANK YOU!!!

It looks like the PR review process for new integrations is quite slow, so I’ve added a v3 on the hassRenaultZE repository

That should get you all sensors without the need to use templates. Also, it is much closer to what the final PR will be.

1 Like

for those driving a Renault with a thermal engine, the component is working well for mileage and fuel autonomy.

Car tested:
Renault Captur 2 from 2020 with EasyLink installed

to get the fuel autonomy working, a small change is needed:

class RenaultRangeSensor(RenaultBatteryDataEntity):
    """Range sensor."""

    @property
    def state(self):
        """Return the state of this entity."""
        data = self.coordinator.data
        if "batteryAutonomy" in data:
            autonomy = data["batteryAutonomy"]
            if not self.hass.config.units.is_metric:
                autonomy = IMPERIAL_SYSTEM.length(autonomy, METRIC_SYSTEM.length_unit)
            return autonomy
        LOGGER.debug("batteryAutonomy not available in coordinator data %s", data)

    @property
    def unit_of_measurement(self):
        """Return the unit of measurement of this entity."""
        if not self.hass.config.units.is_metric:
            return LENGTH_MILES
        return LENGTH_KILOMETERS

needs to be replaced by

class RenaultRangeSensor(RenaultMileageDataEntity):
    """Fuel Autonomy sensor."""

    @property
    def state(self):
        """Return the state of this entity."""
        data = self.coordinator.data
        if "fuelAutonomy" in data:
            mileage_fuel = data["fuelAutonomy"]
            if not self.hass.config.units.is_metric:
                mileage_fuel = IMPERIAL_SYSTEM.length(mileage_fuel, METRIC_SYSTEM.length_unit)
            return round(mileage_fuel)
        LOGGER.debug("fuelAutonomy not available in coordinator data %s", data)

    @property
    def unit_of_measurement(self):
        """Return the unit of measurement of this entity."""
        if not self.hass.config.units.is_metric:
            return LENGTH_MILES
        return LENGTH_KILOMETERS

I don’t have the location yet working, but pyze is giving it’s location back, so this should also be possible to get up and running

@chino-lu can you open an Issue or push your modification for that please ?

done, I think what should also be done is

  1. if the vehicle is not EV, those requests should not be done to the renault cloud
  2. maybe the script should be prepared in a way that sensors are available if a vehicle is
    pure EV or hybrid or pure thermal.

This will also remove some errors from the log you will get since the api is not giving back any informaton if it is a thermal engine and not en EV

My sensors are very often unavailable and do not retain last value received. Does it happen to you too?
As you can see, it does not happen with the former custom component


@mgim is it maybe linked to https://github.com/hacf-fr/hassRenaultZE/pull/75?

I suggest you open an issue on https://github.com/hacf-fr/hassRenaultZE, and provide some logs/traces.

I have just published Release v3.0.2 of the custom component, with added support for non-electric vehicles (thanks @chino-lu)
That will be the basis for merging into HA-core, so all feedback welcome.

V3.0.2 is not showing range on my ZE40 . downgraded to V3.0.1 all OK . Sensor is unavailable in 3.0.2

The range entity have been rename. you should look at the integration in the configuration menu to see all the new entities.