Betatest - Renault ZE Services Binding

Here we go:

items:

Number               RenaultZOEBatterylevel             "Battery level"                                         <battery>          {channel="renault:car:car1:batterylevel"}
Number:Energy        RenaultZOEBatteryavailableenergy   "Battery energy available"                              <energy>           {channel="renault:car:car1:batteryavailableenergy"}
String               RenaultZOEPlugstatus               "Plug status"                                                              {channel="renault:car:car1:plugstatus"}
String               RenaultZOEChargingstatus           "Charging status"                                                          {channel="renault:car:car1:chargingstatus"}
String               RenaultZOEChargingmode             "Charging mode"                                         <energy>           {channel="renault:car:car1:chargingmode"}
DateTime             RenaultZOEChargingremainingtime    "Charging time remaining [%1$tI:%1$tM %1$Tp]"           <time>             {channel="renault:car:car1:chargingremainingtime"}
Number:Length        RenaultZOEEstimatedrange           "Estimated range"                                       <qualityofservice> {channel="renault:car:car1:estimatedrange"}
Number:Length        RenaultZOEOdometer                 "Odometer"                                              <text>             {channel="renault:car:car1:odometer"}
Switch               RenaultZOEHvacstatus               "Hvac status"                                                              {channel="renault:car:car1:hvacstatus"}
Number:Temperature   RenaultZOEHvactargettemperature    "Hvac target temperature"                               <temperature>      {channel="renault:car:car1:hvactargettemperature"}
Number:Temperature   RenaultZOEExternaltemperature      "External temperature"                                  <temperature>      {channel="renault:car:car1:externaltemperature"}
String               RenaultZOEImage                    "Image url"                                                                {channel="renault:car:car1:image"}
Location             RenaultZOELocation                 "Location"                                                                 {channel="renault:car:car1:location"}
DateTime             RenaultZOELocationupdated          "Location update [%1$tm-%1$td-%1$ty %1$tI:%1$tM %1$Tp]" <time>             {channel="renault:car:car1:locationupdated"}

sitemap:

sitemap renault label="Renault Binding"    {
    Frame   {
        Image item=RenaultZOEImage
        Default item=RenaultZOEBatterylevel
        Default item=RenaultZOEBatteryavailableenergy
        Default item=RenaultZOEPlugstatus
        Default item=RenaultZOEChargingstatus
        Selection item=RenaultZOEChargingmode mappings=["schedule_mode"="Schedule mode","always_charging"="Always charging"]
        Default item=RenaultZOEChargingremainingtime
        Default item=RenaultZOEEstimatedrange
        Default item=RenaultZOEOdometer
        Default item=RenaultZOEHvacstatus
        Setpoint item=RenaultZOEHvactargettemperature minValue=19 maxValue=21 step=1
        Default item=RenaultZOEExternaltemperature
        Default item=RenaultZOELocationupdated
        Default item=RenaultZOELocation
    }
}

screenshot:

(External temperature is faked as my car does not report it)

I had to change the channel chargingremainingtime from a Number itemtype to a DateTime itemtype to get useful values.

Thanks @sihui I will add that into the documentation and test it. I will also add a BatterylevelLimit item and use this in a BatterylevelLimit Rule using the charge mode trick.

I have been testing the PRE-heat HVAC. The HVAC=ON command goes to the MyRenaultServer then I query the new state. I do this too quickly because the server waits for the car to confirm the HVAC state. The binding polls 10 min later and gets the ON state. This is confusing and frustrating for users. I need to change this to set state then wait query loop with timeout for the hvacUpdateStatus to be after the command and set the status from that… This means the ON command takes some time but not 10 mins. I also have to block repeated ON commands… I guess…

@sihui We have a problem Regarding your sitemap I could not get it to work.:

" Keep in mind that the main UI is not currently able to display them "

I guess this is why. Thank you so much for your work but I am not sure how to use it. Are you able to use this in openhab 3.2?

The behaviour of sitemaps did not change from openHAB2 to openHAB3. They do work just great and for me are the best choice if using openHAB 90% via smartphone.

Quick guide:
install BasicUI through MainUI.
copy the contents of my sitemap in a file called renault.sitemap (mandatory) in your sitemaps folder.
Call the sitemap via http://<ip>:<port>/basicui/app?sitemap=renault

You could also call the sitemap directly from MainUI in the top right corner:

grafik

1 Like

That is awesome thanks.

I have changed the HVAC to do a 30 second delayed update and it is now a string (ON | OFF | PENDING ) this will hopefully be easier to use…

I will modify your Sitemap to update to the state and might make it more generic. I will also add the batteryLimit item and rule…

Thanks again for your help @sihui

1 Like

If coding around this is getting too complicated I would not even bother to read the ON state: if the car has received the hvac command the timestamp is updated. That is a clear indication that the car is preconditioning (this of course is the view of a non programmer :slight_smile: )
In this case the hvac switch would be just a command switch, not a status switch.

Hi @sihui I think I have a solution. It just needs testing… :wink:

1 Like

New version for testing here:
https://drive.google.com/file/d/10uKgAoGlN1JMWjp0yRtFWumwBJnaysRW/view?usp=sharing

I have updated the documentation README.md here:

@sihui I Updated the site map to work with auto-created Items. I can not get the timestamp to format like yours. Is there a trick?

I changed the HVAC switch to have a PENDING stage. I am not sure if this is good but it seams to work correctly.

I will test this a bit more and use it. Unless I get some bug reports I will submit this version for a pull request.

Thanks in advance

Great, I will start testing tomorrow.

Not that I am aware of. The format depends on the regional settings of openHAB and maybe even on the locale of your operating system.
I thought you would be interested in the English version of timestamps as those are different from my German version (12h/24h and mm-dd-yyyy instead dd.mm.yyyy).
If you want it in a different format I can try to change that, otherwise you will find the different format options here:
https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html

:+1:

I won’t be availabe today as I have a working day …

Thanks again @sihui

To fix the timestamp display I have added a state pattern to the item.
“%1$tH:%1$tM %1$td.%1$tm.%1$tY” For example this outputs: “15:47 21.01.2022” which is hopefully a good international default. This can be overridden in the Item metadata.

I am testing the binding and it looks good so far. I added a trigger to the limit rule and have fixed the update display. Other than that there are no changes. It will be tested next week by the wife so it has to work! I will start the pull request because this will probably also produces some changes…

Any testing and problems / feedback you have time for would be great. Also if the documentation covers is OK. It is always hard to explain stuff that you understand to people that have not spent hours on the problems… so any improvements to the README.md would be great.

Quick reply from todays first testing:

  • all values are properly populated
  • hvac works
2022-01-24 12:51:08.047 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RenaultZOEHvacstatus' received command ON
2022-01-24 12:51:08.050 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RenaultZOEHvacstatus' predicted to become ON
2022-01-24 12:51:08.073 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RenaultZOEHvacstatus' changed from NULL to ON
2022-01-24 12:51:08.080 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RenaultZOEHvacstatus' changed from ON to PENDING
2022-01-24 12:51:39.722 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RenaultZOEHvacstatus' changed from PENDING to ON
  • charge limit cutoff works
2022-01-24 09:41:51.504 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RenaultZOEChargingmode' received command schedule_mode
2022-01-24 09:41:51.510 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RenaultZOEChargingmode' predicted to become schedule_mode
2022-01-24 09:41:51.515 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RenaultZOEChargingmode' changed from always_charging to schedule_mode
2022-01-24 09:44:13.046 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RenaultZOEChargingmode' received command always_charging
2022-01-24 09:44:13.054 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RenaultZOEChargingmode' predicted to become always_charging
2022-01-24 09:44:13.060 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RenaultZOEChargingmode' changed from schedule_mode to always_charging

(first part via rule, then switched manually back to always_charging)

Successfull so far :+1:

1 Like

I think everything is fine and clear to understand:

Some channels may not work depending on your car and MyRenault account. The “Advanced” channels are especially likely to cause confusion and problems.

That statement is important.

This binding can only retrieve information that is available in the the MyRenault App.

Should be changed to:

This binding can only retrieve information that is available in the MyRenault App.

1 Like

@sihui Thanks for the testing and read me correction. I will add then to the pull request

BTW: I have added more triggers to the charge limit rule so it works better…

1 Like

No new post here means no errors so far.
Awesome programming job, thank you very much :+1:

1 Like

@sihui Unfortunately the version I have is buggy… The Pull request feedback has improved the code but means I have broken the latest version. I have to fix it again and improve the code standard and then it should get merged into the main branch for the SNAPSHOT openhab. Not sure when I will have time for this but hopefully the next couple of weeks.

When this happens you will have to delete the test versions and re set up your Car “thing”.

Thanks again for the testing.

hey Doug while using the binding I discovered a little bug.
the channel odometer sends a km value to a number:length item.
The number length item would expect a meter value.
The state of the item does look correct in the first place, but in my case the analysis screen for the item odometer shows a value of 2238910 km instead of 2238,91 km:

This all came to my mind because I have created another number:length item to compare the allowed leasing kilometers to the current kilometers.

Maybe you can update this in the binding for the next release?

1 Like

Created my first oh3 widget. After some quality assurance I will provide the code,
Screenshot Preview:


1 Like

Thanks for the bug report. I am not sure if this is an openHAB or binding bug.

I do update the channel in KM

updateState(CHANNEL_ODOMETER, new QuantityType<Length>(odometer.doubleValue(), KILO(METRE)));

I have an open pull request for the next version I will ask if this is an issue with the binding or openHAB

Great. I would like to have an openHAB 3 UI component for the README as an example. We have a sitemap code thanks to @sihui which will be hopefully added with the open pull request. An openHAB 3 UI page would be great to do in addition as I suspect more an more users will be migrating to UI 3.

You can send me your code (post it here and tag me) when you are happy with it or submit it directly to openhab as a README pull request change.

Have I understood this correctly? The value is correctly displayed but the “analysis screen” shows the value in meters but displays the km unit?

Looking at my data the data is stored in meters correctly. The unit is KM and displayed correctly.

odo

But the “analysis screen” has a bug and does not convert the y axis to km despite showing the unit “km”.

So unless I have misunderstood this I think it is an “analysis screen” bug?