-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[renault] Renault more channels and HVAC ON / toggle charge mode #12095
Conversation
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
…ault-more-channels
Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
…t rule. Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
I will review this PR. |
Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
@lolodomo Thank you for reviewing this update to the binding. The HVAC ON command to the car and wait for a response from the server might not be the most openHAB way to do this. If you know of a better technique please let me know. |
.../org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/api/Car.java
Outdated
Show resolved
Hide resolved
.../org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/api/Car.java
Show resolved
Hide resolved
.../org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/api/Car.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml
Show resolved
Hide resolved
bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml
Show resolved
Hide resolved
bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml
Show resolved
Hide resolved
@lolodomo The binding is working well (again). However there are some strange Renault API behaviours that I do not fully understand. I will do the mvn i18n:generate-default-translations command and get the German and English translations done soon. I am still not sure how to avoid generic Exceptions without a massive catch list or a dead job task... |
The German translation must not be part of this PR. It should be done in Crowdin.
Let me check again, if you are in the case of scheduled task, this may be acceptable. |
…-default-translations Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
This is not code run in a regular scheduled task so I see no reason to not catch so largely. |
Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
@lolodomo I have pushed a list of errors that could be thrown. I am not sure if this is what you wanted me to do. I am concerned that a runtime error (like "SSL cert no long valid", or "Unknown host exception".... ) will throw a nasty error up the openHAB stack to be handled elsewhere. I am not sure I can for-see all the unforeseen situations.... if I try to list them. Maybe I misunderstand this or maybe openHAB handles these situations better. Please let me know what you are after if my push is not it. |
@lolodomo I have a bug report here: https://community.openhab.org/t/betatest-renault-ze-services-binding/72226/176?u=doug_culnane Basically it is suggested that Number:Lengths should be set using meter values and not the KM value. Is this maybe a binding issue I should change or an openHAB bug that some components assume meters? |
You have to check / log the value returned by the API. Is this value in meters or kilometers. Your code assumes it is in kilometers. |
@lolodomo Thanks for your response. I can reproduce the bug I think and I think it is an "analysis screen" issue. https://community.openhab.org/t/betatest-renault-ze-services-binding/72226/180?u=doug_culnane Therefore I will not try to patch the binding at this stage. |
What is important for you is the state value of the linked item. |
This is good I have check the display value and it is correct and the mysql stored value which is also correct (in meters)
|
Why in meters ? Your code assumes that the API value is in kilometers if you provide unit KILO(METER) when building the QuantityType. |
The first step is to check the unit of the value returned by the API. Any other discussion is probably just loss of time ;) |
The API returns KM (totalMileage) and the value we want to display is in KM. This is an example response I just got from the API:
The totalMileage is km. I use this value with the KM unit. But I guess... the value is converted to a standard meters value as a Number:Length type...??? |
There is no standard meters value. |
@lolodomo OK there may be issues but they are outside the scope of this binding and pull request I guess. Did you get a chance to look at the exception handling? Do you want to chat about this? We can do a quick meeting now if that would save time. I am not sure how i can resolve this. |
Just check if KILO(METER( is the proper unit definition. I am almost sure other bindings are using kilometers. I will finish the review probably tomorrow or Saturday, |
Tesla uses MILEs... Lines 604 to 611 in 888cf00
Volvo use KILO(METRE) Line 503 in 888cf00
|
So your code is correct IMHO. Maybe there is a bug in MainUI. |
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/betatest-renault-ze-services-binding/72226/182 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
You are using Jetty HTTP client in your code and you are handling the exceptions that can be thrown by Jetty calls. So I don't understand what exception you could loose. |
…nhab#12095) * [renault] Add more channels to Renault Binding. * [renault] Improve example rule to reduce API use. Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
…nhab#12095) * [renault] Add more channels to Renault Binding. * [renault] Improve example rule to reduce API use. Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at> Signed-off-by: Nick Waterton <n.waterton@outlook.com>
…nhab#12095) * [renault] Add more channels to Renault Binding. * [renault] Improve example rule to reduce API use. Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
…nhab#12095) * [renault] Add more channels to Renault Binding. * [renault] Improve example rule to reduce API use. Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
…nhab#12095) * [renault] Add more channels to Renault Binding. * [renault] Improve example rule to reduce API use. Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at> Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
…nhab#12095) * [renault] Add more channels to Renault Binding. * [renault] Improve example rule to reduce API use. Signed-off-by: Culnane Douglas <douglas.culnane@extern.a1.at>
The initial Renault binding added in openhab 3.2 had a few basic channels. This update adds more channels and the ability to interact with the car.
Turning the HVAC ON allows users to pre-heat their cars.
Switching charge mode allows users to control the charge limit of their cars without a smart charger.
There is much discussion, testing and feedback to these changes in the forum starting here: https://community.openhab.org/t/betatest-renault-ze-services-binding/72226/127
@lolodomo kindly reviewed inital contribution. I have tried to continue the style of his feedback with the additional changes.
The HVAC ON command to the car and wait for a response from the server is a problem i have tried to solve in a not too confusing way. I hope this is OK. The status is only polled every 10 minutes so feedback that the HVAC is really ON needs a delayed response to give the car and MyRenault server time to react....