Page 1 of 2

Kia and Hyundai plugin

Posted: Friday 05 July 2024 23:28
by psubiaco
Hi,
I've developed with @willemd a plugin for Kia and Hyundai connected vehicles: more info in the GitHub page https://github.com/CreasolTech/domoticz-hyundai-kia
Today I've updated the plugin to use the "new" DomoticzEx framework: please check the "Update" section in the README file (in GitHub) before updating.
For any trouble, feel free to write here or open an issue in the GitHub.
Any feedback and suggestion is welcome.
kia_domoticz2.png
kia_domoticz2.png (299.37 KiB) Viewed 1455 times

Re: Kia and Hyundai plugin

Posted: Sunday 07 July 2024 8:09
by gizmocuz
Thank you both for this plugin! Looks great!!

I developed one myself with python and MQTT Auto Discovery.

Instead of using 'dimmers' to configure stuff, you could use SetPoints for this. You can configure the Unit/Step size for setpoints these days.

One thing I seem to miss in this plugin is the ability to lock/unlock the doors here.
This is my #1 frustration from my Kia, when it's parked home/office, it tells me I forgot to lock the doors.
My previous car was so smart to just lock the %^# door... how hard can that be....
Having this, one could just 'lock' these days after, lets say, 5 minutes.

Re: Kia and Hyundai plugin

Posted: Monday 08 July 2024 19:59
by jannl
Indeed, thanks, the plugin does great work.

One question, some of the 'doors' seem to be inverted or is it me?

Re: Kia and Hyundai plugin

Posted: Tuesday 09 July 2024 8:41
by gizmocuz
You can see the status in 'doorLock' (true should be locked) and then call

vm.lock(vehicleId)

or

vm.unlock(vehicleId)

Re: Kia and Hyundai plugin

Posted: Friday 09 August 2024 9:09
by mvveelen
I just stumbled upon this one and am curious if this will work with my Hyundai Tucson plugin hybrid Premium of 2023?

Want to make sure before I start the whole procedure of installing the plugin :-)

Re: Kia and Hyundai plugin

Posted: Friday 09 August 2024 13:40
by willemd
mvveelen wrote: Friday 09 August 2024 9:09 I just stumbled upon this one and am curious if this will work with my Hyundai Tucson plugin hybrid Premium of 2023?

Want to make sure before I start the whole procedure of installing the plugin :-)
If you use the KIA Connect app (or the equivalent for Hyundai) for this vehicle then it probably will work. One way to find out....

Re: Kia and Hyundai plugin

Posted: Friday 09 August 2024 17:09
by mvveelen
I use the BlueLink app.

Running the latest Bookworm on a Raspberry Pi 3B+

Tried with the python plugin manager in domoticz and selected the plugin after I deleted all manual steps I did earlier.
I see (debug = on) only this and no devices or anything I can use to enter credentials or so:

Code: Select all

2024-08-10 13:22:21.033 Hyundai: Pushing 'onHeartbeatCallback' on to queue
2024-08-10 13:22:21.084 Hyundai: Processing 'onHeartbeatCallback' message
2024-08-10 13:22:21.084 Hyundai: Acquiring GIL for 'onHeartbeatCallback'
2024-08-10 13:22:21.084 Hyundai: Calling message handler 'onHeartbeat' on 'module' type object.
2024-08-10 13:22:21.084 Hyundai: onHeartbeat called
2024-08-10 13:22:21.084 Hyundai: Current time:13:22
2024-08-10 13:22:21.084 Hyundai: Acquiring GIL for 'onHeartbeatCallback'
2024-08-10 13:23:21.041 Hyundai: Pushing 'onHeartbeatCallback' on to queue
2024-08-10 13:23:21.094 Hyundai: Processing 'onHeartbeatCallback' message
2024-08-10 13:23:21.094 Hyundai: Acquiring GIL for 'onHeartbeatCallback'
2024-08-10 13:23:21.098 Hyundai: Calling message handler 'onHeartbeat' on 'module' type object.
2024-08-10 13:23:21.098 Hyundai: onHeartbeat called
2024-08-10 13:23:21.098 Hyundai: Current time:13:23
2024-08-10 13:23:21.098 Hyundai: Acquiring GIL for 'onHeartbeatCallback'
Am I forgetting something?

These errors occur:

Code: Select all

2024-08-10 13:18:25.231 Error: Hyundai: Git ErrorNo:2
2024-08-10 13:18:25.231 Error: Hyundai: Git StrError:No such file or directory
2024-08-10 13:18:25.235 Error: Hyundai: Git ErrorNo:2
2024-08-10 13:18:25.235 Error: Hyundai: Git StrError:No such file or directory

Re: Kia and Hyundai plugin

Posted: Saturday 10 August 2024 14:22
by willemd
It looks like your installation is incomplete although the error message in not very clear.

Please check whether the api is present in /usr/local/src
and the plugin is present in /home/pi/domoticz/plugins

It is very important to follow the installation instructions exactly as explained here on this page:
https://github.com/CreasolTech/domoticz-hyundai-kia

Re: Kia and Hyundai plugin

Posted: Saturday 10 August 2024 14:27
by mvveelen
This is what I have:

Code: Select all

pi@raspberrypi:~ $ cd /usr/local/src
pi@raspberrypi:/usr/local/src $ ls
[b]hyundai_kia_connect_api[/b]
pi@raspberrypi:/usr/local/src $ cd /home/pi/domoticz/plugins
pi@raspberrypi:~/domoticz/plugins $ ls
AwoxSMP  Domoticz-AtagOne  Domoticz-SMA-SunnyBoy  examples  HomeWizard-Wifi-Watermeter-main  [b]HyundaiKiaConnect[/b]  pp-manager  SVT  Tasmoticz  watermeter
Do I have to follow all steps described there? Because I got an error with "pip3 install pytz bs4" :

Code: Select all

root@raspberrypi:/home/pi/domoticz/plugins# pip3 install pytz bs4
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    For more information visit http://rptl.io/venv

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
All steps work, except for that one.

After restarting Domoticz, I see:

Code: Select all

2024-08-10 14:31:56.638 Status: Hyundai: Entering work loop.
2024-08-10 14:31:56.638 Status: Hyundai: Started.
2024-08-10 14:31:59.844 Status: Hyundai: Initialized version 1.5.41, author 'ycahome'
2024-08-10 14:31:59.848 Hyundai: Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
2024-08-10 14:31:59.848 Hyundai: 'HardwareID':'33'
2024-08-10 14:31:59.848 Hyundai: 'HomeFolder':'/home/pi/domoticz/plugins/pp-manager/'
2024-08-10 14:31:59.849 Hyundai: 'StartupFolder':'/home/pi/domoticz/'
2024-08-10 14:31:59.849 Hyundai: 'UserDataFolder':'/home/pi/domoticz/'
2024-08-10 14:31:59.849 Hyundai: 'Database':'/home/pi/domoticz/domoticz.db'
2024-08-10 14:31:59.849 Hyundai: 'Language':'en'
2024-08-10 14:31:59.849 Hyundai: 'Version':'1.5.41'
2024-08-10 14:31:59.849 Hyundai: 'Author':'ycahome'
2024-08-10 14:31:59.849 Hyundai: 'Name':'Hyundai'
2024-08-10 14:31:59.849 Hyundai: 'Port':'0'
2024-08-10 14:31:59.849 Hyundai: 'Key':'PP-MANAGER'
2024-08-10 14:31:59.849 Hyundai: 'Mode2':'HyundaiKiaConnect'
2024-08-10 14:31:59.849 Hyundai: 'Mode4':'SelectedNotify'
2024-08-10 14:31:59.849 Hyundai: 'Mode5':'False'
2024-08-10 14:31:59.849 Hyundai: 'Mode6':'Debug'
2024-08-10 14:31:59.849 Hyundai: 'DomoticzVersion':'2024.7 (build 16178)'
2024-08-10 14:31:59.849 Hyundai: 'DomoticzHash':'bc750e2df'
2024-08-10 14:31:59.849 Hyundai: 'DomoticzBuildTime':'2024-08-07 15:43:48'
2024-08-10 14:31:59.849 Hyundai: Device count: 0
2024-08-10 14:31:59.849 Hyundai: Domoticz Node Name is:raspberrypi
2024-08-10 14:31:59.849 Hyundai: Domoticz Platform System is:Linux
2024-08-10 14:31:59.849 Hyundai: Domoticz Platform Release is:6.6.31+rpt-rpi-v8
2024-08-10 14:31:59.849 Hyundai: Domoticz Platform Version is:#1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29)
2024-08-10 14:31:59.849 Hyundai: Default Python Version is:3.11.2.
2024-08-10 14:31:59.850 Hyundai: Checking for Exception file on:/home/pi/domoticz/plugins/PP-MANAGER/exceptions.txt
2024-08-10 14:31:59.850 Hyundai: self.ExceptionList:[]
2024-08-10 14:31:59.850 Hyundai: Collecting Updates for Plugin:HyundaiKiaConnect
2024-08-10 14:31:59.850 Hyundai: CheckForUpdatePythonPlugin called
2024-08-10 14:31:59.850 Hyundai: Checking Plugin:HyundaiKiaConnect for updates
2024-08-10 14:32:00.906 Hyundai: Calling:LANG=en_US /usr/bin/git status -uno on folder /home/pi/domoticz/plugins/HyundaiKiaConnect
2024-08-10 14:32:00.937 Hyundai: Git Response:b"On branch master\nYour branch is up to date with 'origin/master'.\n\nnothing to commit (use -u to show untracked files)\n"
2024-08-10 14:32:00.937 Hyundai: Plugin HyundaiKiaConnect already Up-To-Date
2024-08-10 14:32:00.937 Hyundai: find(error):-1
2024-08-10 14:32:00.937 Hyundai: Checking for dir:/home/pi/domoticz/plugins/HyundaiKiaConnect
2024-08-10 14:32:00.938 Hyundai: Folder for Plugin:HyundaiKiaConnect already exists!!!
2024-08-10 14:32:00.938 Hyundai: Pushing 'PollIntervalDirective' on to queue
2024-08-10 14:32:00.938 Hyundai: Acquiring GIL for 'onStartCallback'
2024-08-10 14:32:00.938 Hyundai: Processing 'PollIntervalDirective' message
2024-08-10 14:32:00.938 Hyundai: Acquiring GIL for 'PollIntervalDirective'
2024-08-10 14:32:00.938 Hyundai: Heartbeat interval set to: 60.
2024-08-10 14:32:00.938 Hyundai: Acquiring GIL for 'PollIntervalDirective'

Re: Kia and Hyundai plugin

Posted: Sunday 11 August 2024 11:46
by willemd
I think that error is caused by bookworm. It is a new security measure. In that latest OS version you cannot use pip anymore to install a package system wide as a user.

If I understand well you either have to use a container or you have to use sudo.
Best to do a search or read the bookworm documentation to understand that exactly.
It is the reason I use a previous OS version.

Re: Kia and Hyundai plugin

Posted: Sunday 11 August 2024 15:00
by mvveelen
Tried sudo and everything else is abracadabra for me unfortunately.

Re: Kia and Hyundai plugin

Posted: Monday 12 August 2024 9:33
by willemd
If you use the bullseye version you don't have that problem. You can install it with the raspberry pi imager.

Re: Kia and Hyundai plugin

Posted: Monday 12 August 2024 10:56
by DiaDomo
Is this correct? These devices monitor power (according their names) and report in kWh. I always thought that power is in W and not in Wh!?

Re: Kia and Hyundai plugin

Posted: Monday 12 August 2024 11:22
by mvveelen
willemd wrote: Monday 12 August 2024 9:33 If you use the bullseye version you don't have that problem. You can install it with the raspberry pi imager.
Do you mean I have to do a reinstall? I love to use the plugin, but reinstalling everything is a bit too much. 🥹

Re: Kia and Hyundai plugin

Posted: Monday 12 August 2024 15:40
by willemd
DiaDomo wrote: Monday 12 August 2024 10:56 Is this correct? These devices monitor power (according their names) and report in kWh. I always thought that power is in W and not in Wh!?
You are correct. They measure energy used/regenerated. You can rename them.

Re: Kia and Hyundai plugin

Posted: Monday 12 August 2024 15:41
by willemd
mvveelen wrote: Monday 12 August 2024 11:22
willemd wrote: Monday 12 August 2024 9:33 If you use the bullseye version you don't have that problem. You can install it with the raspberry pi imager.
Do you mean I have to do a reinstall? I love to use the plugin, but reinstalling everything is a bit too much. 🥹
Yes, moving to a different OS would require a reinstallation. Depending on what else you have installed this might be a big task. If it is just domoticz, not so.

According to my search, you could apparently also use pipx instead of pip or add an installation flag "--break-system-packages" to install system wide. I am not sure what the risk is.

Re: Kia and Hyundai plugin

Posted: Monday 12 August 2024 17:47
by mvveelen
willemd wrote: Monday 12 August 2024 15:41
mvveelen wrote: Monday 12 August 2024 11:22
willemd wrote: Monday 12 August 2024 9:33 If you use the bullseye version you don't have that problem. You can install it with the raspberry pi imager.
Do you mean I have to do a reinstall? I love to use the plugin, but reinstalling everything is a bit too much. 🥹
Yes, moving to a different OS would require a reinstallation. Depending on what else you have installed this might be a big task. If it is just domoticz, not so.

According to my search, you could apparently also use pipx instead of pip or add an installation flag "--break-system-packages" to install system wide. I am not sure what the risk is.
Taking a bit of risk is no problem, but where to start as a n00b who wants to try is something else.

If you have any suggestions?

Re: Kia and Hyundai plugin

Posted: Monday 12 August 2024 19:47
by willemd
I would just take a new sd card and reinstall on bullseye. Keep the current installation in tact on current sd card.

Or copy current.installation onto new card and experiment with that one.

So you can always go back by just changing sd card

Re: Kia and Hyundai plugin

Posted: Monday 12 August 2024 20:49
by mvveelen
Thanks but no thanks. I have more than enough dependencies and everything is running fine. This would be a very nice extra if it works, but I'm not going to downgrade on another card and do the whole exercise all over again. Thanks so far, I give up.

Re: Kia and Hyundai plugin

Posted: Sunday 18 August 2024 1:03
by Alain
I'm having trouble getting my plugin running. I am trying to connect an Ioniq 5 (2023 model). During the install everything went fine. I followed all the steps in the instructions and had no issues.

I'm running the latest stable version of Domoticz (2024.7), Python 3.8 on Ubuntu 20.04 LTS.

Code: Select all

 2024-08-18 00:50:55.065 Error: IONIQ 5: (domoticz-hyundai-kia) failed to load 'plugin.py', Python Path used was '/home/alain/domoticz/plugins/HyundaiKiaConnect/:/usr/lib/python38.zip:/usr/lib/python3.8:/usr/lib/python3.8/lib-dynload:/usr/local/lib/python3.8/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.8/dist-packages'.
2024-08-18 00:50:55.066 Error: IONIQ 5: Traceback (most recent call last):
2024-08-18 00:50:55.067 Error: IONIQ 5: File "/home/alain/domoticz/plugins/HyundaiKiaConnect/plugin.py", line 74, in <module>
2024-08-18 00:50:55.067 Error: IONIQ 5: from hyundai_kia_connect_api import *
2024-08-18 00:50:55.067 Error: IONIQ 5: File "/usr/local/lib/python3.8/dist-packages/hyundai_kia_connect_api/__init__.py", line 4, in <module>
2024-08-18 00:50:55.067 Error: IONIQ 5: from .ApiImpl import (
2024-08-18 00:50:55.067 Error: IONIQ 5: File "/usr/local/lib/python3.8/dist-packages/hyundai_kia_connect_api/ApiImpl.py", line 10, in <module>
2024-08-18 00:50:55.067 Error: IONIQ 5: from requests.exceptions import JSONDecodeError
2024-08-18 00:50:55.067 Error: IONIQ 5: ImportError: cannot import name 'JSONDecodeError' from 'requests.exceptions' (/usr/lib/python3/dist-packages/requests/exceptions.py) 



Can someone tell me what is causing this?