Integrate MG into Smart Home

title Integrate MG into Smart Home

Introduction

For my MG electric car, the manufacturer offers an interface that can be used to retrieve data. For this purpose, there is a bridge that allows you to write the retrieved data to an MQTT broker so that it can be displayed in a smart home display.

MQTT

A popular standard for the smart homes is MQTT. MQTT Clients send data to a MQTT Broker, which provides them for other MQTT Clients. Often smart home systems support access to MQTT for visualization of data and to send commands to the devices.

iSmart Secondary User

Secondary User Add Family Card Active secondary profile To access the vehicle data, you need a second profile in the MG iSmart app. Otherwise, it will always log in to the device that was last used and log you out of the other one. First, log out of the iSmart app under Profile ▸ Settings ▸ Log out. Then register a new account on the login screen. Once the second user has been created, log out again and log in with the main user in the iSmart app. Then click on Profile ▸ Secondary account ▸ + and create a permanent Family Card with the previously used mobile phone number. Under Code, select the area code for Germany and enter the mobile phone number without the leading zero.

Connection

Enter the Docker image path and double-click on the Python version to download Click on the image and select run to create a new container Select container name Fill in advanced settings You can check the connection in the logTo connect the MG electric vehicle with MQTT, there is a project on GitHub called >SAIC Python MQTT Gateway. I installed this as a >Docker Image on my Synology NAS. The installation is described in the images, and the values for the advanced settings are described again below.

ENV Variables

Variable Example Value Description
MQTT_URItcp://192.168.1.21:1883URL of MQTT Server with port number
MQTT_TOPICcybersterTopic under which the values appear
SAIC_USER1721234567Login of secondary user (phone number without area code)
SAIC_PASSWORDtotallySecretPassword of secondary user
SAIC_PHONE_COUNTRY_CODE49Country code
BATTERY_CAPACITY_MAPPINGABCDE00SN000123=77.0VIN of Cyberster with battery capacity
HA_DISCOVERY_ENABLEDFALSEHome Assistant discovery disabled if unused

Traccar

Variable Example Value Description
OSMAND_SERVER_URIhttp://192.168.1.21:5055IP-Address with port, where Traccar runs locally

If you want to track the position of the MG car live, you can transmit it to a GPS tracking software, such as Traccar. When setting up the saic2mqtt bridge and Traccar in both containers, it is important to set the network to host and not to bridge. This is required for both to communicate with each other and for the data to arrive in Traccar. If Traccar is used on a server accessible via the Internet, this does not matter.

Available Data

Display of the data available via MQTT in the MQTT ExplorerThe data available via MQTT can be viewed in >MQTT Explorer.

MQTT Broker

This page describes how to set up an MG electric car as an MQTT client via bridge. It requires a running MQTT broker. This is a server that receives data from MQTT clients and stores the status until it changes. Mosquitto is a suitable MQTT broker for Synology.

Overview

Back to main pageBack to main page