Please visit github repository for the lastest updates.
My main goal is to integrate my MG4 in Node-red to use car's data with my automation workflow. Moreover, SAIC's ISmart mobile app is limited that why I have developed this dashboard.
- Support of Multi-language supported (default: French)
- Dashboard with car's components status
- Localization of my car on a map (daily, weekly, monthly and custom journeys)
- Compute charge cost and duration using electricity pricing limplementation (EDF in France)
- Override Saic MQTT gateway configuration
- Charts for:
- Tyres pressure
- Battery voltage
- Consumption + cost
- Temperature
- Battery capacity
- Charge calendar
- Remote actions
- set remote temperature, A/C mode, target SOC
- enable A/C, lock, boot ...
- Manage MQTT SAIC Gateway instance.
These features are not includes in theses flows but they have been integrated:
- Alerting (opened windows or doors at night, tyres pressure ...)
- Closing automatically car at night
- Starting automatically A/C
- Integration with Google Home
Ok Google MG4 -> Your car is in the avenue Champs-Elyseés, 7 near Mc Donalds restaurant
...
I use Saic MQTT gateway project to query data from MG's car.
Dashboard integrates:
- MQTT input to query data from local Moquitto
- nodered-dashboard-ui providing ui components
- node-red-contrib-web-worldmap as map provider
- node-red-contrib-ui-svg to integrate MG top view from official MG website
- EDF pricing data file to compute cost
- Persistance in SQLite database (in beta, to remove for production)
No warrantly, No support, No security requirements
- Install Mosquitto
- Install from source the latest python version
# Slow process
https://raw.githubusercontent.com/tvdsluijs/sh-python-installer/main/python.sh | sudo bash -s 3.xx.x
- Install Saic MQTT gateway
# Default folder: /home/dietpi/.node-red/saic/
mkdir /home/dietpi/.node-red/
git clone --depth 1 https://github.com/SAIC-iSmart-API/saic-python-mqtt-gateway.git
mv saic-python-mqtt-gateway saic
cd saic
pip3 install -r requirements.txt
- Launch manually SAIC Gateway for testing
# Launch gateway
python mqtt_gateway.py -m tcp://localhost:1883 -u "${saic email}" -p "${saic password}" --mqtt-user "mosquitto" --mqtt-password "${mqtt password}"
- Use MQTT Explorer to get path of data (ex: saic/xxx/vehicles/yyy)
- xxx: account ID
- yyy: vehicule ID
- Install Nodejs
dietpi-software install 9
# or
dietpi-software reinstall 9
- Install NodeRed
- Enable Saving context data to the file-system
- Create a folder
/data/
formg.db
sqlite database or changeMGDB
node to define database path - Import flow.json:
Dash-MG4
- Import flow_gateway.json:
MG4 Gateway
to manage SAIC Gateway instance in NodeRed - Configuration:
- open SAICMQTTFx/credentialsSAIC node:
server: https://tap-eu.soimt.com (for europe)
gateway: https://gateway-eu.soimt.com (for europe)
email: (email address of your MG ISmart account)
password: (password of your MG ISmart account)
ABRP_TOKEN: (bxxxx-xxx-xxx-xx-xxxx see ABRP integration)
ABRP_API_KEY: (xxx-xx-xx-xxx-xxxxx see ABRP integration)
GATEWAY_FOLDER: (absolute path of your gateway installation folder if you want to use **flow_gateway.json**)
VIN: (vin of your vehicle)
- open SAICMQTTFx/credentialMQTTFx node:
MQTT_URL: (xxxxxx:1883)
MQTT_USER: (mqtt user)
MQTT_PASSWORD: (mqtt password)
MQTT_CLIENTID: (mqtt client id)
- Deploy them
- Watch Saic MQTT gateway outputs & see debug trace in Nodered
- you have to see before MQTT gateway events
- after that MQTT input in NodeRed will integrates data
- Open http://${ip}:1880/ui/
This flow is provided as it.
Feel free:
- to improve it
- to fix some bugs
- to share your work ;)
Disseminating knowledge is the human duty, sharing it about so that all can benefit.
- Edit saicInternationalFx subflow
- Duplicate actionFR and rename actionXX
- Translate everything in XX
- Implement electricity functions
- Edit label node and add XX in global.get("saic").language_supported (ex: XX=ES for spanish)
-
Test, test and test
-
Share with me actionXX && global.get("saic").language_supported contents
-
I will release a new version of this dashboard and you are the official maintainer of this language
-
Well done !
GNU GPLv3
donc préfêres-tu qu'ici on discute en francais? J'utilise la version Francaise du flow.
the gist was reinstalled yesterday and of course the api code versions are hard coded via requirements.txt.
the debug message that your function outputs before auto_publish is
doors_boot true false
However this message is emitted by a node.warn inside a function (aa082cea1bcbc50e) and the flow never reaches the auto_publish node. There is no debug from immediately prior the auto_publish node.
Assuming that the crash interrupts the debugging I inserted a 5s delay before auto_publish. This worked as expected and the message immediately prior to the auto_publish node sets the payload as boolean true and the topic to boot/set as expected.
so I conclude that the error is not within the flow itself but either in mqtt_auto_publish node or the code that it calls.
The code for the mqtt-auto nodes theselves is trivial and unlikely to cause issues. It looks most likely that the issue is caused by the DynMqtt.js wrapper not encapsulating the data correctly before passing to the native mqtt function.
Would it be better to use the standard mqtt nodes?
sure - but this is not the issue. the error is occurring in the JS code, pre-python calls.