kia_uvo icon indicating copy to clipboard operation
kia_uvo copied to clipboard

Double car on account Hyundai

Open Anticir opened this issue 3 years ago • 32 comments

Hello, Small question, would it be possible to add the integration of two cars? Because I only see one, Thank you

Anticir avatar Oct 23 '21 16:10 Anticir

Currently it is hard coded to the first car. If we add this feature do you think it should be possible to be one kia and one hyundai? Or just support two of the same make?

cdnninja avatar Oct 23 '21 16:10 cdnninja

Any thoughts or feedback if this should be multiple brands? I would think it is easier to support within a brand vs between.

cdnninja avatar Nov 05 '21 23:11 cdnninja

For sure multiple brand would be nice (we have one Hyundai and one Kia, though only the Hyundai has connected services).

Also it may be possible that the two cars are not using the same account (but instead be shared). If both our car were using connected services, both would use different accountd for sure.

I don't know it this is possible but maybe the simple way to handle multiple cars would be to allow the integration to be setup multiple times (if Home Assistant allows it). This way you could during the setup of the integration select the car and use another account.

StephaneM60 avatar Nov 15 '21 14:11 StephaneM60

yes, it is doable as you have pointed out setup multiple times and add one car per each setup we are still fighting basic login issues, we are not able to reach this point of maturity :)

fuatakgun avatar Nov 15 '21 14:11 fuatakgun

Another option would be to have the integration perform a query of # of vehicles with a selection to pick the specified vehicle to pull the data from.

MwC-Trexx avatar Nov 19 '21 03:11 MwC-Trexx

This would work within a brand but would need something more if multiple brands are desired.

On Nov 18, 2021, at 8:27 PM, MwC-Trexx @.***> wrote:

 Another option would be to have the integration perform a query of # of vehicles with a selection to pick the specified vehicle to pull the data from.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

cdnninja avatar Nov 19 '21 03:11 cdnninja

From a development point of view I am interested to see thoughts from @dahlb and @fuatakgun on this. Should we be:

  • Looking to add "Car number" to the region APIs init that references which car to pull. This would assume with instantiate one API instance per car.
  • Returning all multiple car data as an array and dealing with this in vehicle or elsewhere
  • Some other approach?

cdnninja avatar Nov 25 '21 19:11 cdnninja

I would think a nice user experience would be to do a two step config flow with the second step being a multi-select of all available cars. (assuming config flow can have multiple steps but I think I've seen that in another integration) This would depend on your second bullet point of a new method on the apis to return an array of cars with their names/models/vin.

Internally I think this is a little more complex but maybe as simple as changing DATA_VEHICLE_INSTANCE from a single value to a dict of keys being vehicle_vin (this should be easier to ID cars with then a car number) and values being vehicle objects init with those vin numbers. that might work as a low effort first pass but not ideal at least for KIA USA as that api only allows one active session per user so each vehicle object would continuously be having to recreate while invalidating the other instances sessions (but the implementation handles that gracefully it just is not ideal)

That could be.a reasonable initial hit for multicar support, second PR could move to improve performances.

just my initial thoughts, I think once it starts being implemented a number of platform setups and other things might need updating but those three changes above would allow it to just be a matter of refactoring issues. Should handle the user experience and the data modeling.

dahlb avatar Nov 26 '21 00:11 dahlb

For multiple brands would want handle that in a single "install" or would we allow multiple install of the integration one per brand? I would think the second is easier if HA supports it.

Other angle would be import all cars no matter config. This is how even the xbox integration works. You simple disable what you don't want. I would think most people would want all cars available.

As for the car int reason I referenced that was most are arrays so easy to pass to get car 0, 1, 2 etc. That can be mapped though.

cdnninja avatar Nov 26 '21 01:11 cdnninja

For multiple brands would want handle that in a single "install" or would we allow multiple install of the integration one per brand? I would think the second is easier if HA supports it.

I don't think HA supports this because the integration is keyed to the DOMAIN constant that would have to be modified per install, maybe the user could make multiple copies and change each directories copy of the const.py file but that seems a more complex use case then I'd expect most users to bother with

Other angle would be import all cars no matter config. This is how even the xbox integration works. You simple disable what you don't want. I would think most people would want all cars available.

this might seem simple, but would like to potential issues like #181, and I'm pretty sure we could make a second step in the config flow to select which cars pretty easily

As for the car int reason I referenced that was most are arrays so easy to pass to get car 0, 1, 2 etc. That can be mapped though.

after some more coding earlier I think we could use the current vehicle.id intead of the vin, I think we should avoid array indices because they would definitely be hosed when somebody adds a new car and that would seem a common use case for anybody with multiple cars.

dahlb avatar Nov 26 '21 01:11 dahlb

Good read on that touches on this with the unique ids and config flow.

https://developers.home-assistant.io/docs/config_entries_config_flow_handler/

cdnninja avatar Nov 26 '21 02:11 cdnninja

I'm primarily focused on stability improvements still. I think multiple vehicles will be a very large refactor that the code base probably isn't ready for. If you want to take a nice small step in that direction though updating the config flow to pick a vehicle instead of just defaulting to the first result would add a lot of functionality without much complexity changes.

dahlb avatar Nov 27 '21 00:11 dahlb

Yes agreed stability and basics are key right now. I am just poking around and learning on approach. I think it will be awhile before this happens.

cdnninja avatar Nov 27 '21 01:11 cdnninja

Second this request. On a long-term loan car now due to my car waiting for a battery replacement :(

Think many people will be in the same boat the coming months when they are doing the recalls.

If I can easily switch the car from one to the other in the integration configuration that would already help. Thus it still supports one car "live" but at least you can pick which one, as suggested earlier.

Flight777 avatar Nov 30 '21 19:11 Flight777

I am thinking we need to handle two key situations here:

  1. Multiple cars on one account. Either display all cars and people can disable what they don't want in HA, or let people select cars on setup.
  2. Allow the integration to be used with multiple accounts, either different brands or same brand.

cdnninja avatar Nov 30 '21 22:11 cdnninja

Anyone have more than one account that could test a new feature for me?

This would work for two cars on one account, would require separate logins per car.

cdnninja avatar Dec 13 '21 03:12 cdnninja

I have two Hyundai's on the same account... One login can access both vehicle's on the Bluelink website and in the Bluelink app. Ironically, my wife's car is first, so I am very interested in trying to get the two car thing working. The Website's HTML uses the VIN number as a unique ID for its "MyVehicalList" variables. Let me know how I can help

bob-gorman avatar Dec 22 '21 17:12 bob-gorman

I have it working in a branch with separate accounts. Currently doesn't support multiple cars on one account though. If you can use separate accounts could test it today though. We have some cleanup and architectural changes coming that may slow this down though.

cdnninja avatar Dec 22 '21 23:12 cdnninja

Check out #219. It is early stages of where this will be supported. If you are willing to invest some time testing for us it would be greatly appreciated. Please read the warnings though.

cdnninja avatar Jan 10 '22 03:01 cdnninja

Thanks to @rappazzo the basics of the new version are now working for Hyundai USA. Would be great if someone with two cars would test this out.

cdnninja avatar Jan 22 '22 16:01 cdnninja

I have a hyundai kona ev and a kia niro ev, living in eu. If any testing is needed I'll be happy to do it. I also struggle with car hibernation when using smart charging (I have one pr car)

dlysnes avatar Jan 26 '22 14:01 dlysnes

I have tow Kias in my EU account. Don't know if you manage to do two cars in one account?

fredriksimon avatar Jan 27 '22 16:01 fredriksimon

Yes it should support both multiple accounts and multiple cars on the account. Unfortunately we haven't been able to test this yet as no one with two cars has come forward to test. This has slowed progress on it.

cdnninja avatar Jan 27 '22 18:01 cdnninja

I can test. I have two cars on one account.

/Per

27 jan. 2022 kl. 19:25 skrev cdnninja @.***>:

 Yes it should support both multiple accounts and multiple cars on the account. Unfortunately we haven't been able to test this yet as no one with two cars has come forward to test. This has slowed progress on it.

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you are subscribed to this thread.

MrDadoo avatar Jan 27 '22 18:01 MrDadoo

Please give it a try over here: https://github.com/fuatakgun/kia_uvo/issues/219.

cdnninja avatar Jan 27 '22 22:01 cdnninja

Is this .py used in latest commit of ha-integration or do I need to test .py separayely?

/Per

27 jan. 2022 kl. 23:50 skrev cdnninja @.***>:

 Please give it a try over here: #219.

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.

MrDadoo avatar Jan 28 '22 05:01 MrDadoo

Are you able to explain what you mean? Copy the entire contents of this replacing your current files: https://github.com/fuatakgun/kia_uvo/tree/externalAPI

cdnninja avatar Jan 28 '22 15:01 cdnninja

I have experience testing. Here is the simplest way to setup testing:

  • Install the samba Add-on
    • go to Configuration
    • add-ons, backup, system
    • In Add-ons, click "Add on store"
    • search for "Samba share"
    • install and configure.
    • Here is my config
 allow_hosts:
  - 10.0.0.0/8
  - 172.16.0.0/12
  - 192.168.0.0/16
  - fe80::/10
compatibility_mode: false
password: ********
username: homeassistant
veto_files:
  - ._*
  - .DS_Store
  - Thumbs.db
  - icon?
  - .Trashes
workgroup: WORKGROUP
interface: ''
  • With Samba installed, from your computer with this branch of the code checked out, browse to $HOMEASSISTANT\config\custom_components\kia_uvo
  • separately browse to code with this branch checked out
  • copy the code from the source to the HA (home assistant) dirs
  • restart HA

rappazzo avatar Jan 28 '22 15:01 rappazzo

Sorry, my fault. Misunderstood and after testing without success I realized I haven't taken correct branch.

This branch shows my two cars and it looks - at first glance - that things are working.

2022-01-28 16:09 skrev cdnninja:

Are you able to explain what you mean? Copy the entire contents of this replacing your current files: https://github.com/fuatakgun/kia_uvo/tree/externalAPI [1]

-- Reply to this email directly, view it on GitHub [2], or unsubscribe [3]. Triage notifications on the go with GitHub Mobile for iOS [4] or Android [5]. You are receiving this because you commented.Message ID: @.***>

Links:

[1] https://github.com/fuatakgun/kia_uvo/tree/externalAPI [2] https://github.com/fuatakgun/kia_uvo/issues/93#issuecomment-1024311187 [3] https://github.com/notifications/unsubscribe-auth/AEMN7LGYVVU3PGU677M442TUYKWRVANCNFSM5GSNZANQ [4] https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 [5] https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub

MrDadoo avatar Jan 28 '22 18:01 MrDadoo

Thank you! That is really great to hear. If you see sensors missing that you would like please let us know. Location is one that we are still working on. After that I will move on to the other actions such as remote start.

cdnninja avatar Jan 28 '22 20:01 cdnninja