Kia and Hyundai plugin

Python and python framework

Moderator: leecollings

User avatar
psubiaco
Posts: 194
Joined: Monday 20 August 2018 9:38
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Italy
Contact:

Kia and Hyundai plugin

Post 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 1457 times
Paolo
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Kia and Hyundai plugin

Post 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.
Quality outlives Quantity!
jannl
Posts: 625
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: Kia and Hyundai plugin

Post by jannl »

Indeed, thanks, the plugin does great work.

One question, some of the 'doors' seem to be inverted or is it me?
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Kia and Hyundai plugin

Post by gizmocuz »

You can see the status in 'doorLock' (true should be locked) and then call

vm.lock(vehicleId)

or

vm.unlock(vehicleId)
Quality outlives Quantity!
User avatar
mvveelen
Posts: 678
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Kia and Hyundai plugin

Post 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 :-)
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Kia and Hyundai plugin

Post 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....
User avatar
mvveelen
Posts: 678
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Kia and Hyundai plugin

Post 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
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Kia and Hyundai plugin

Post 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
User avatar
mvveelen
Posts: 678
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Kia and Hyundai plugin

Post 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'
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Kia and Hyundai plugin

Post 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.
User avatar
mvveelen
Posts: 678
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Kia and Hyundai plugin

Post by mvveelen »

Tried sudo and everything else is abracadabra for me unfortunately.
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Kia and Hyundai plugin

Post by willemd »

If you use the bullseye version you don't have that problem. You can install it with the raspberry pi imager.
DiaDomo
Posts: 37
Joined: Saturday 28 March 2020 13:55
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Kia and Hyundai plugin

Post 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!?
Attachments
power-kia.png
power-kia.png (55.43 KiB) Viewed 1191 times
Raspberry PI 2 & 3 & 4 | RFlink | MySensors | ESP32 | Homebridge | Tasmota Sonoff | Zigbee2Mqtt | ADS-B
User avatar
mvveelen
Posts: 678
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Kia and Hyundai plugin

Post 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. 🥹
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Kia and Hyundai plugin

Post 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.
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Kia and Hyundai plugin

Post 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.
User avatar
mvveelen
Posts: 678
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Kia and Hyundai plugin

Post 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?
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Kia and Hyundai plugin

Post 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
User avatar
mvveelen
Posts: 678
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Kia and Hyundai plugin

Post 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.
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
Alain
Posts: 164
Joined: Sunday 26 April 2020 5:27
Target OS: Linux
Domoticz version: 2022.1
Location: Netherlands
Contact:

Re: Kia and Hyundai plugin

Post 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?
Hue | Zigbee2Mqtt | MQTT | P1 | Xiaomi | RFXCom | Modbus | Qlima | Solaredge
TP-Link | Plugwise | Thermosmart | Node-Red | Grafana | Master and 5 remote servers
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest