CreasolTech / domoticz-hyundai-kia

9 stars 5 forks source link

Domoticz Hyundai-Kia plugin - Controls and monitors Hyundai and Kia connected vehicles

Authors:

Kia floorplan in Domoticz, simple example made in 10 minutes

Kia car panel, in Domoticz, with some controls to charge the EV car by Creasol DomBusEVSE

Introduction

This plugin is designed for Domoticz home automation system and provide a way to get status from Hyunday and Kia cars.

It's based on the hyundai-kia-connect-api python library, written by Fuat Akgun.

Using this plugin is possible to monitor the battery state of charge (for electric cars), that lead to the ability to enable / disable charging based on the power availability from photovoltaic, for example, improving the own-consumption.

Also it works with non-EV cars from Hyundai and Kia, monitoring the fuel level and range, climate, location, vehicle sensors, ...

It's also possible to control the car, activating for example the climate from the Domoticz panel.

Actually 30 devices will be created, using your language: English, Italian, Dutch, Swedish, Hungarian, Polish and French are supported, now, but if you want to contribute, just fetch the translation.txt file, add for each line the translation in your language, and send by email to linux AT creasol dot it.

This plugin can be installed typing the following commands from a shell: instead of installing the plugin, (penultimate command), it's possible to use Python Plugin Manager or Python Plugins Manager which also permit to update plugin easily or even automatically.

Features

Installation

#become root user
sudo su -

#install git, if not already installed
which git
if [ $? -ne 0 ]; then sudo apt install git; fi

#change to the domoticz directory / plugins
cd /home/pi/domoticz/plugins 

#fetch the Python Plugin Manager (that can be used to install/upgrade other plugins, including domoticz-hyundai-kia)
git clone https://github.com/ycahome/pp-manager

#install python3-dateutil
sudo apt install python3-dateutil

#install original hyundai-kia-connect-api lib 
# pip3 install hyundai-kia-connect-api
pip3 install pytz bs4
cd  /usr/local/src
#git clone https://github.com/jwefers/hyundai_kia_connect_api.git  #lib modified by jWefers
git clone https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api.git
mv /usr/local/lib/python3.9/hyundai_kia_connect_api /var/tmp 2>/dev/null
ln -s /usr/local/src/hyundai_kia_connect_api/hyundai_kia_connect_api /usr/local/lib/python3.9/dist-packages

#return on previous directory
cd -

#remove __pycache__ dir from the lib (it contains the __pycache__ with sources compiled by a different python version or different CPU)
for d in /usr/local/lib/python3*; do find $d -name __pycache__ -exec rm -r {} \; ; done

#fetch Creasol Plugin

git clone https://github.com/CreasolTech/domoticz-hyundai-kia

#restart Domoticz daemon
service domoticz restart

Before activating this plugin, assure that you've set the right name to your car (through the Hyundai/Kia connect app) short and simple: that name is used to identify devices in Domoticz. Also, use a very short name for the hardware plugin.

When plugin is activated, more than 30 devices will be automatically added to domoticz, named as {PLUGIN_NAME} - {VEHICLE_NAME} {device name}

If you want to rename a device, change only the {device name} part, do not change the {PLUGIN_NAME} - {VEHICLE_NAME} part of device name because it's used by the plugin to associate device name to a vehicle_name and vehicle_id provided by the cloud. Also, do not change the name of the ODOMETER device: leave this device name as original!

Make sure that the plugin is also run shortly before midnight (in addition to the polling intervals configured) by adding a timer setting to the switch device that can be use to force a data update. For example add a timer that sets the switch to status "On" every weekday at 23:57.

Then, enter Domoticz panel, go to Setup -> Hardware and enable the Hyundai Kia connect plugin specifying the Hyundai or Kia account credential: up to 4 vehicles associated to this account can be shown automatically on Domoticz.

Please note that there are some restrictions on the number of daily access to the cloud... for example EU customers cannot connect more than 200 times/day Also, the vehicle consumes energy for every access, so do not poll the car too often when it is not moving nor charging.

Updating

Sometimes a new version of this plugin also requires an update of the hyundai_kia_connect_api module.

Assuming you followed the installation instructions as described above, the hyundai_kia_connect_api can be updated to the latest version with the following commands:

 cd /usr/local/src/hyundai_kia_connect_api/hyundai_kia_connect_api
 sudo git pull

To update the plugin itself:

  cd /home/pi/domoticz/plugins/HyundaiKiaConnect
  sudo git pull
  sudo service domoticz restart

In case the plugin has been updated by the Domoticz plugin manager already, the git pull command will complain that the plugin already has been updated. This can be corrected with the following command:

   sudo git checkout ./plugin.py

After this the plugin can be updated with:

  sudo git pull
  sudo service domoticz restart

Note about upgrade from Rev.1 to Rev2.0 or later

Version 2.0 (2024-07-03) has been rewritten to use the DomoticzEx framework: DeviceID for each device is kept as the Rev.1, but the name of each device must be renamed manually:

Rev.1 naming: PLUGIN_NAME - CAR_NAME DEVICE_NAME (for example Kia - eNiro odometer)

Rev.2 naming: CAR_NAME: DEVICE_NAME (for example eNiro: odometer)

After the plugin has been updated, please remember to manually rename all devices following the new naming convention!

Credits

Many thanks to:

Many thanks for the following language translations:


Charging the electric car in a smart way

Creasol has developed a cheap and smart DIY EVSE module that can work stand-alone or connected to Domoticz.

Video showing electric vehicle charging by Domoticz and Creasol DomBusEVSE module Video showing electric car charging by Domoticz and DomBusEVSE module

Features:

More info at https://www.creasol.it/EVSE

Video about Creasol DomBus modules for Domoticz Video about DomBus modules


Creasol DomBus modules

Below a list of modules, produced in Europe by Creasol, designed for Domoticz to be reliable and optimized for very very low power consumption.

Our industrial and home automation modules are designed to be

Modules are available in two version:

  1. with DomBus proprietary protocol, working with Domoticz only
  2. with Modbus standard protocol, working with Home Assistant, OpenHAB, Node-RED

Store website - Information website

Youtube video showing DomBus modules

Creasol DomBus modules video

DomBusEVSE - EVSE module to build a Smart Wallbox / EV charging station

DomBusEVSE smart EVSE module to make a Smart Wallbox EV Charging station Complete solution to make a Smart EVSE, charging the electric vehicle using only energy from renewable source (photovoltaic, wind, ...), or adding 25-50-75-100% of available power from the grid.


DomBusTH - Compact board to be placed on a blank cover, with temperature and humidity sensor and RGW LEDs

DomBusTH domotic board with temperature and humidity sensor, 3 LEDs, 6 I/O Compact board, 32x17mm, to be installed on blank cover with a 4mm hole in the middle, to exchange air for the relative humidity sensor. It can be installed in every room to monitor temperature and humidity, check alarm sensors, control blind motor UP/DOWN, send notifications (using red and green leds) and activate white led in case of power outage.

Includes:

DomBus12 - Compact domotic module with 9 I/Os

DomBus12 domotic module with 9 I/O Very compact, versatile and cost-effective module with 9 ports. Each port can be configured by software as:

DomBus23 - Domotic module with many functions

DomBus23 domotic module with many functions Versatile module designed to control gate or garage door.

DomBus31 - Domotic module with 8 relays

DomBus31 domotic module with 8 relay outputs DIN rail low profile module, with 8 relays and very low power consumption:

DomBus32 - Domotic module with 3 relays

DomBus32 domotic module with 3 relay outputs Versatile module with 230V inputs and outputs, and 5 low voltage I/Os.

DomBus33 - Module to domotize a light system using step relays

DomBus33 domotic module with 3 relay outputs that can control 3 lights Module designed to control 3 lights already existing and actually controlled by 230V pushbuttons and step-by-step relays. In this way each light can be activated by existing pushbuttons, and by the domotic controller.

Each relay can toggle the existing step-relay, switching the light On/Off. The optoisolator monitors the light status. The 5 I/Os can be connected to pushbuttons to activate or deactivate one or all lights.

DomBus36 - Domotic module with 12 relays

DomBus36 domotic module with 12 relay outputs DIN rail module, low profile, with 12 relays outputs and very low power consumption.

DomBus37 - 12 inputs, 3 115/230Vac inputs, 3 relay outputs

DomBus37 domotic module with 12 inputs, 3 AC inputs, 3 relay outputs Module designed to be connected to alarm sensors (magnetc contact sensors, PIRs, tampers): it's able to monitor mains power supply (power outage / blackout) and also have 3 relays outputs.

DomRelay2 - 2x relays board

Relay board with 2 relays, to be used with DomBus domotic modules Simple module with 2 relays, to be used with DomBus modules or other electronic boards with open-collector or open-drain outputs

DomESP1 / DomESP2 - Board with relays and more for ESP8266 NodeMCU WiFi module

Relay board for ESP8266 NodeMCU module IoT board designed for NodeMCU v3 board using ESP8266 WiFi microcontroller