How do I set up the SAIC/MQTT gateway correctly? - OpenWB Software 2 + Synology Docker Container
klefreak opened this issue · comments
Hello:
I allready used the Saic-Gateway for over a year with OpenWB Software 1.9 + Synology Docker.
it worked good using the old OPENWB_LP_MAP Command
Since update on Software 2 on my open WB it does not work any more.
I Created the needed charging Station.json -->
"chargeStateTopic": "openWB/lp/1/boolChargeStat", "chargingValue": "1", "socTopic": "openWB/set/vehicle/6/get/soc", "chargerConnectedTopic": "openWB/lp/1/boolPlugStat", "chargerConnectedValue": "1", "vin": "LSJEXXXXXXXXXXXXX"
I'm unsure at "charge state topic", "ChargingValue", "chargerConnectedTopic" because none of these Vales are "suggested in OpenWB Software..
the only Thing i can find is "socTopic" that is adaptet to the needed "6" vehicle...
how can i find out if or how to set the other parameters..
second thing:
i'm not shure if my car is read out correctly by the Gateway ... see Log posted here:
https://forum.openwb.de/viewtopic.php?p=102499#p102499
thanks for clarification :)
ps: im a noob in using these things - sorry
Hi,
What version of the MQTT gateway are you running?
it looks like the car is not communicating properly with the MQTT gateway, here's what i would do:
- Stop the current gateway
- "Wake the car up" by moving a couple of meters
- Re-start the gateway
After you do that feel free to post the log file so we can analyze if it is working properly or not.
@nanomad
Thx for Help..
MQTT gateway is from :Latest -->were can i find actual version number?
moved Car
%SOC Status via App works properly... 2.0.2
restarted Container in "Debug"
saicismartapi-saic-python-mqtt-gateway.txt
looks like connection to SAIC failed ???
There is actually a sample file for openWB in the repository. Have a look at charging-stations.json.sample.
Your file should look like this:
[
{
"chargeStateTopic": "openWB/lp/1/boolChargeStat",
"chargingValue": "1",
"socTopic": "openWB/set/lp/1/%Soc",
"chargerConnectedTopic": "openWB/lp/1/boolPlugStat",
"chargerConnectedValue": "1",
"vin": "vin1"
}
]
Seems like the MQTT topic structure has changed in openWB software version 2.0.
I have found a discussion in German about this topic
Seems like openWB/lp/
became openWB/chargepoint
I don't know about the rest of the topic since it is not visible on the screenshot in the thread. But as they are suggesting in the forum, you could use MQTT Explorer to find it out.
thanks for the hint..
tried to find the topics...
looks like this as far as i can interpret with my little knowledge
"chargeStateTopic": "openWB/internal_chargepoint/0/get/charge_state",
"chargingValue": "true",
"socTopic": "openWB/set/vehicle/6/get/soc",
"chargerConnectedTopic": "openWB/internal_chargepoint/0/get/plug_state",
"chargerConnectedValue": "true",
"vin": "LSJExxxxxxxxxxx"
maybe someone can confirm or "repair" if my findings are broken
Hi @klefreak,
I have updated my openWB charging station to version 2.0 on the weekend.
There is a default car with ID 0 that cannot be modified. Therefore, I have created an additional car that has received the ID 2. This explains why there is the 2 in my MQTT topics:
[
{
"chargeStateTopic": "openWB/chargepoint/2/get/charge_state",
"chargingValue": "true",
"socTopic": "openWB/set/vehicle/2/get/soc",
"rangeTopic": "openWB/set/vehicle/2/get/range"
"chargerConnectedTopic": "openWB/chargepoint/2/get/plug_state",
"chargerConnectedValue": "true",
"vin": "vin1"
}
]
Providing the SoC to the openWB is working.
I am still testing if the charging is recognized by the gateway.
Update:
i'm testing this Charging Station File:
"chargeStateTopic": "openWB/chargepoint/4/get/charge_state", "chargingValue": "true", "socTopic": "openWB/set/vehicle/6/get/soc", "rangeTopic": "openWB/set/vehicle/6/get/range" "chargerConnectedTopic": "openWB/chargepoint/4/get/plug_state", "chargerConnectedValue": "true", "vin": "VIN1"
My Charging Point got ID4 and My Car got ID6 in the Box...
Gateway writes This: (but no SOC UPdate in the Box - What is wrong??
`
<style>body{font-family:"Lucida Console",Consola,Monaco,Monospace,"Courier New",Courier,Serif;}h2{text-align:center;}table{width:95%;border-collapse:collapse;}table,th,td{border:1px solid black;}td{white-space:nowrap;text-align:left;}</style>saicismartapi-saic-python-mqtt-gateway-1
date | stream | content |
---|---|---|
2024/02/22 21:01:03 | stdout | 2024-02-22 20:01:03,762 [ INFO ] Job "Check for new messages (trigger: interval[0:01:00], next run at: 2024-02-22 20:02:03 UTC)" executed successfully - apscheduler.executors.default |
2024/02/22 21:01:03 | stdout | 2024-02-22 20:01:03,761 [ INFO ] MessageResp(alarmNumber=0, commandNumber=0, messages=[], newsNumber=0, recordsNumber=None, totalNumber=0) unread messages - __main__ |
2024/02/22 21:01:03 | stdout | 2024-02-22 20:01:03,571 [ INFO ] Running job "Check for new messages (trigger: interval[0:01:00], next run at: 2024-02-22 20:02:03 UTC)" (scheduled at 2024-02-22 20:01:03.570039+00:00) - apscheduler.executors.default |
2024/02/22 21:00:45 | stdout | 2024-02-22 20:00:45,084 [ INFO ] Refreshing ABRP status succeeded... - __main__ |
2024/02/22 21:00:45 | stdout | 2024-02-22 20:00:45,084 [ INFO ] Refreshing vehicle status succeeded... - __main__ |
2024/02/22 21:00:45 | stdout | 2024-02-22 20:00:45,037 [ INFO ] Updating scheduled battery heating status - __main__ |
2024/02/22 21:00:45 | stdout | 2024-02-22 20:00:45,036 [ INFO ] Setting charging query interval in vehicle handler for VIN to 0:00:00 - vehicle |
2024/02/22 21:00:41 | stdout | 2024-02-22 20:00:41,358 [ INFO ] Updating charging status - __main__ |
2024/02/22 21:00:30 | stdout | 2024-02-22 20:00:30,954 [ INFO ] Updating vehicle status - __main__ |
2024/02/22 21:00:03 | stdout | 2024-02-22 20:00:03,753 [ INFO ] Job "Check for new messages (trigger: interval[0:01:00], next run at: 2024-02-22 20:01:03 UTC)" executed successfully - apscheduler.executors.default |
2024/02/22 21:00:03 | stdout | 2024-02-22 20:00:03,753 [ INFO ] MessageResp(alarmNumber=0, commandNumber=0, messages=[], newsNumber=0, recordsNumber=None, totalNumber=0) unread messages - __main__ |
2024/02/22 21:00:03 | stdout | 2024-02-22 20:00:03,571 [ INFO ] Running job "Check for new messages (trigger: interval[0:01:00], next run at: 2024-02-22 20:01:03 UTC)" (scheduled at 2024-02-22 20:00:03.570039+00:00) - apscheduler.executors.default |
2024/02/22 20:59:03 | stdout | 2024-02-22 19:59:03,785 [ INFO ] Job "Check for new messages (trigger: interval[0:01:00], next run at: 2024-02-22 20:00:03 UTC)" executed successfully - apscheduler.executors.default |
2024/02/22 20:59:03 | stdout | 2024-02-22 19:59:03,785 [ INFO ] MessageResp(alarmNumber=0, commandNumber=0, messages=[], newsNumber=0, recordsNumber=None, totalNumber=0) unread messages - __main__ |
2024/02/22 20:59:03 | stdout | 2024-02-22 19:59:03,572 [ INFO ] Running job "Check for new messages (trigger: interval[0:01:00], next run at: 2024-02-22 20:00:03 UTC)" (scheduled at 2024-02-22 19:59:03.570039+00:00) - apscheduler.executors.default |
2024/02/22 20:58:30 | stdout | 2024-02-22 19:58:30,806 [ INFO ] Refreshing ABRP status succeeded... - __main__ |
2024/02/22 20:58:30 | stdout | 2024-02-22 19:58:30,806 [ INFO ] Refreshing vehicle status succeeded... - __main__ |
2024/02/22 20:58:30 | stdout | 2024-02-22 19:58:30,757 [ INFO ] Updating scheduled battery heating status - __main__ |
2024/02/22 20:58:30 | stdout | 2024-02-22 19:58:30,757 [ INFO ] Setting charging query interval in vehicle handler for VIN to 0:00:00 - vehicle |
2024/02/22 20:58:27 | stdout | 2024-02-22 19:58:27,084 [ INFO ] Updating charging status - __main__ |
2024/02/22 20:58:13 | stdout | 2024-02-22 19:58:13,585 [ INFO ] Updating vehicle status - __main__ |
2024/02/22 20:58:13 | stdout | 2024-02-22 19:58:13,585 [ INFO ] Setting refresh mode to periodic - vehicle |
2024/02/22 20:58:13 | stdout | 2024-02-22 19:58:13,585 [ INFO ] Setting charging query interval in vehicle handler for VIN xxxxxxx to 0:00:00 - vehicle |
2024/02/22 20:58:13 | stdout | 2024-02-22 19:58:13,585 [ INFO ] Setting inactive query interval in vehicle handler for VIN xxxxxxx to 1 day, 0:00:00 - vehicle |
2024/02/22 20:58:13 | stdout | 2024-02-22 19:58:13,585 [ INFO ] Setting after shutdown query interval in vehicle handler for VIN xxxxxxx to 0:02:00 - vehicle |
2024/02/22 20:58:13 | stdout | 2024-02-22 19:58:13,585 [ INFO ] Setting charging query interval in vehicle handler for VIN xxxxxxx to 0:00:00 - vehicle |
2024/02/22 20:58:13 | stdout | 2024-02-22 19:58:13,584 [ INFO ] Setting active query interval in vehicle handler for VIN xxxxxxxxxx to 0:00:30 - vehicle |
2024/02/22 20:58:03 | stdout | 2024-02-22 19:58:03,570 [ INFO ] Added job "Check for new messages" to job store "default" - apscheduler.scheduler |
2024/02/22 20:58:03 | stdout | 2024-02-22 19:58:03,516 [ INFO ] Registering for ['ALARM_TYPE_VEHICLE_FAULT', 'ALARM_TYPE_GEOFENCE', 'ALARM_TYPE_VEHICLE_START'] messages. vin=xxxxxxxxxxx - __main__ |
2024/02/22 20:58:03 | stdout | 2024-02-22 19:58:03,227 [ INFO ] Fetching vehicle list - __main__ |
2024/02/22 20:58:03 | stdout | 2024-02-22 19:58:03,227 [ INFO ] Logged in as 6602599939 - __main__ |
2024/02/22 20:58:02 | stdout | 2024-02-22 19:58:02,777 [ INFO ] [SUBACK] 4 (0,) - gmqtt |
2024/02/22 20:58:02 | stdout | 2024-02-22 19:58:02,777 [ INFO ] [SUBACK] 3 (0,) - gmqtt |
2024/02/22 20:58:02 | stdout | 2024-02-22 19:58:02,777 [ INFO ] [SUBACK] 2 (0,) - gmqtt |
2024/02/22 20:58:02 | stdout | 2024-02-22 19:58:02,776 [ INFO ] [SUBACK] 1 (0,) - gmqtt |
2024/02/22 20:58:02 | stdout | 2024-02-22 19:58:02,767 [ INFO ] Logging in to SAIC API - __main__ |
2024/02/22 20:58:02 | stdout | 2024-02-22 19:58:02,767 [ INFO ] Scheduler started - apscheduler.scheduler |
2024/02/22 20:58:02 | stdout | 2024-02-22 19:58:02,762 [ INFO ] [SEND SUB] 4 [b'saic/6602599939/vehicles/+/refresh/period/+/set'] - gmqtt.mqtt.package |
2024/02/22 20:58:02 | stdout | 2024-02-22 19:58:02,762 [ INFO ] [SEND SUB] 3 [b'saic/6602599939/vehicles/+/refresh/mode/set'] - gmqtt.mqtt.package |
2024/02/22 20:58:02 | stdout | 2024-02-22 19:58:02,762 [ INFO ] [SEND SUB] 2 [b'saic/6602599939/vehicles/+/+/+/+/set'] - gmqtt.mqtt.package |
2024/02/22 20:58:02 | stdout | 2024-02-22 19:58:02,762 [ INFO ] [SEND SUB] 1 [b'saic/6602599939/vehicles/+/+/+/set'] - gmqtt.mqtt.package |
2024/02/22 20:58:02 | stdout | 2024-02-22 19:58:02,762 [ INFO ] Connected to MQTT broker - mqtt_publisher |
2024/02/22 20:58:02 | stdout | 2024-02-22 19:58:02,759 [ INFO ] [CONNECTION MADE] - gmqtt.mqtt.protocol |
Hi @klefreak,
go to configuration > vehicles (Konfiguration > Fahrzeuge) in your openWB.
Select the car you want to modify.
Select SoC-Modul: MQTT
The box shows you the SoC and the range MQTT topic.#
Your charge_state topic contains the ID 4
Your SoC topic contains the ID 6
The topics for the same car should have the same ID.
i reseted my OpenWB and tried a "clean" Start..
Configured the chargepoint (got ID2) and a Car (1)
edited the "charging-stations.json
"chargeStateTopic": "openWB/chargepoint/2/get/charge_state",
"chargingValue": "true",
"socTopic": "openWB/set/vehicle/1/get/soc",
"chargerConnectedTopic": "openWB/chargepoint/2/get/plug_state",
"chargerConnectedValue": "true",
"vin": "VIN1"
Hi @klefreak
so in fact my car has the ID 2 and the charge point has the ID 2.
You are using the standard car with ID 1 and the charge point seems to have ID 2 as in my case.
I am still not able to detect that the car is charging, but providing the SoC and the range (part of #172) to the openWB works.
Hello @tosate
Thx for your Time
i tried to ad a second car.. got ID2 and copied your File-configuration as now i also use car ID2 and charging id2..
MQTT is set up..
under mqtt Explorer i can read SOC status in SAIC-Tree -->
but it is not written into the car.. i dont know what to do else..
feels like i make som stupid mistakes??
@tosate want to jump in via ANYDESK ??
(i'm in Austria, so german would be possible also phone would be possible :)
if possible.. write a PM?
ps: maybe my Synology-Docker-Gateway isnt configured properly..
Hi @klefreak,
first of all, sorry for the late response.
I think the gateway does not pick up your charging-stations.json
file.
By default, the release comes with a file that contains an empty array []
, which has no effect.
If you are running it as a docker container, you need to map your custom file into the running container.
There is an example docker-compose.yml file in the repository. It contains the following mapping:
[...]
volumes:
- ./charging-stations.json:/usr/src/app/charging-stations.json
This maps the charging-stations.json
file from the current directory into the container and replaces the file /usr/src/app/charging-stations.json
.
I am not familiar with the Synology Container Manager. However, I think that the mapping is done under "Volume-Einstellungen".
What you have configured looks like:
[...]
volumes:
- /docker/saic/charging-stations.json:/charging-stations.json
This maps your charging-stations.json
file into the root directory of the container instead of /usr/src/app/
So long story short: Please try with /usr/src/app/charging-stations.json
in your mapping.
I have just noticed that you have also configured the environment variable CHARGING_STATIONS_JSON
. This would allow you to use a different file name than the default one: charging-stations.json
.
I would recommend to remove this environment variable because it is not needed.
A sample scenario for this would be if you would like to use a custom name for the file. The docker compose file would than look like this:
[...]
environment:
- [...]
- CHARGING_STATIONS_JSON=openWB.json
volumes:
- /docker/saic/openWB.json:/usr/src/app/openWB.json
This maps the file into the container and tells the gateway to pick it up.
However, this would complicate things a bit and is not required in your scenario.
@tosate
You are right !
solved it:
- i removed the Environment-Variable
- i adopted the File Mapping in Docker Container like you suggested..
- i recreated the charging-stations.json because in "my" used version i got errors..
- --> start container --> works :)
Thank you for your Help!
i will make a summary for OpenWB-Forum in relating SAIC-Thread... (in a view days...)
greetings Klemens
@klefreak you are welcome