Skip to content

Commit 89c6e77

Browse files
mschmiedeltisoft
authored andcommitted
First documentation proposal
1 parent ffedb64 commit 89c6e77

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

saic-java-mqtt-gateway/README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# SAIC-JAVA-MQTT-GATEWAY
2+
3+
This gateway allows to poll the car state and publish it to
4+
a MQTT broker. It is written in Java and uses the saic-java-api
5+
from the same project.
6+
7+
8+
## Running
9+
10+
### 1. Docker-compose
11+
12+
The easiest way to run the gateway is to use the docker-compose file.
13+
14+
```
15+
version: "3.9"
16+
services:
17+
ismart_mqtt:
18+
image: saicismartapi/saic-java-mqtt-gateway:latest
19+
environment:
20+
SAIC_USER: {your saic user}
21+
SAIC_PASSWORD: {your saic password}
22+
MQTT_URI: {your mqtt broker uri}
23+
MQTT_USER: {your mqtt broker user}
24+
MQTT_PASSWORD: {your mqtt broker password}
25+
ABRP_USER_TOKEN: {your abrp user token}
26+
restart: on-failure
27+
```
28+
The ABRP_USER_TOKEN is optional. If you provide it, the gateway will also publish the car state to the ABRP API.
29+
30+
For the token, add comma-sepparated entries for each vehicle like this: {VIN=token,VIN2=token2,...}
31+
32+
### 2. Run from command line
33+
34+
You can also run the gateway from the command line. For this, you need to build the jar file first.
35+
36+
From the parent project, run:
37+
```
38+
mvn package
39+
```
40+
41+
If everything goes right, you will have a jar file (saic-ismart-mqtt-gateway-0.0.0-SNAPSHOT-full.jar)
42+
in the target folder. You can run it with the following command:
43+
```
44+
java -jar saic-ismart-mqtt-gateway-0.0.0-SNAPSHOT-full.jar \
45+
--saic-user={your saic user} \
46+
--saic-password={your saic password} \
47+
--mqtt-uri={your mqtt broker uri} \
48+
--mqtt-user={your mqtt broker user} \
49+
--mqtt-password={your mqtt broker password} \
50+
--abrp-user-token={your abrp user token}
51+
```
52+
53+
## MQTT Broker
54+
In case you need a MQTT Broker, you could use mosquitto from eclipse. https://mosquitto.org
55+
56+
> mosquitto is not required to run the gateway. You can use any MQTT broker you want.
57+
58+
If you plan on running mosquitto as a docker image, you could use this template
59+
as a starting point: https://github.com/vvatelot/mosquitto-docker-compose
60+
61+
> Note: In case you use mosquitto, prefer tcp over ws protocol for the gateway.
62+
63+
## Commands
64+
65+
The gateway supports the following commands from mqtt topics:
66+
67+
Base topic is always:
68+
saic/{saic-user}/vehicles/{vin}
69+
70+
* drivetrain/hvBatteryActive {true|false}
71+
* climate/remoteClimateState {true|false}
72+
* doors/locked {true|false}
73+
* refresh/mode {periodic|off|force}
74+
* refresh/period/active {seconds} -> Interval in seconds to poll the car state when hvBattery is active (30s default)
75+
* refresh/period/inActive {seconds} -> Interval in seconds to poll the car state when hvBattery is inActive (86400s default)
76+
* refresh/period/inActiveGrace {seconds} -> -> Interval in seconds handle car state as active after hvBattery was disconnected (600s default)
77+
78+
To set these values, just post a message to the corresponding topic plus "/set" with the desired value.
79+
80+
Further commands will be supported in the future.

0 commit comments

Comments
 (0)