This is a custom component for Home Assistant supporting the openWB wallbox for charging electric vehicles. The integration subscribes to MQTT topics which are used by openWB to broadcast information and displays this informations as entities. You can also change, for example, the charge mode of a charge point.
Note: I provide this custom integration without any warranty. It lies in the responsability of each user to validate the functionality with his/her own openWB!
This integration assumes that you run the openWB using software version 2.x. If your wallbox still uses the version 1.9x, please use the older version of this integration (https://github.com/a529987659852/openwbmqtt).
If you need help, also have a look here. Although created for the previous version of this integration, you should still find useful information if you're not familiar to MQTT and/or custom integrations in Home Assistant.
My integration provides the following device types:
Wallbox: This device type represents the openWB itself and provides the following sensors:
Charge Point: This device represents a charge point of the openWB and provides, for example, the following entities:
Counter: This device represents a counter, for example, the counter that measures your inbound and outbound energy from the supplier. This device provides, for example, the following sensors:
Battery: This device represents a battery, for example, a house battery and provides, for example, the following sensors:
PV Generator: This device represents a PV generator and provides, for example, the following sensors:
Make sure you have HACS installed. Under HACS, choose Integrations. Add this repository as a user-defined repository.
Clone the custom component to your custom_components folder.
Restart your HA instance.
In HA, choose Settings -> Integrations -> Add Integration to add the integration. HA will display a configuration window. For details, refer to the Example Configuration section
When setting up this integration, you must choose the device type to be created and provide additional details (MQTT root and device ID).
How to find out the device ID and MQTT root?
This image shows an example of the MQTT topics published by openWB2 and how to identify the MQTT root topic
This image shows the openWB2 status page (http://your-ip/openWB/web/settings/#/Status) and the device IDs:
TLDR: Use the file mosquittoExampleConfiguration.conf contained in this repository to configure your eclipse MQTT server to import data from the openWB MQTT server and to send data to it. Don't forget to change IP address and device ID(s).
From a technical perspective, this integration uses an MQTT server to obtain the data from the wallbox. The wallbox itself has its own MQTT server. Depending on your network setup, you have two options:
Let's disuss the second option in more detail.
To establish a bridge, you can either start on the openWB-MQTT and export values to the HA-MQTT. This can be set up in the webinterface of openWB. Go to section Einstellungen -> System -> MQTT-Brücken and make the necessary settings. Since I'm not using this approach, I cannot give you additional hints.
Alternatively, you can start on the HA-MQTT and subscribe to topics on the openWB-MQTT. To do this, you have to change the configuration file of the MQTT server. I'm using the Mosquitto MQTT server. This is also the server you run if you're using the Home Assistant MQTT addon. To subscribe to other MQTT servers in Mosquitto, navigate to the config folder of Mosquitto, create a sub-directory conf.d (if it does not already exist), and create a file openWB.conf. In the file, you configure your bridge. See the following example:
#
# bridge to openWB Wallbox
#
connection openwb2
local_clientid openwb2.mosquitto
#TODO: Replace IP address
address 192.168.0.68:1883
#Sensors Controller
topic openWB/system/ip_address in
topic openWB/system/version in
topic openWB/system/lastlivevaluesJson in
#Sensors per Chargepoint
#TODO: Replace 4 by your chargepoint ID
topic openWB/chargepoint/4/get/# in
topic openWB/chargepoint/4/config in
You must change the following:
Then save the file and restart Mosquitto. You should now see MQTT topics with values coming from the openWB-MQTT server.
Note: The example configuration is not complete. Please refer to the file mosquittoExampleConfiguration.conf in this repository which contains a fully running example. Just don't forget to adapt the device IDs!
The configuration option in in each topic line takes care that data from the openWB-MQTT server is only imported to the HA-MQTT. Therefore, entities you can change in Home Assistant (for example number entity for manual SoC, selector for change mode, and selector for connected vehicle) don't not work, yet. Let's look into the following section of the example configuration:
#Selects per Chargepoint
#TODO: Replace 4 by your chargepoint ID
topic openWB/chargepoint/4/get/connected_vehicle/config in
topic openWB/set/vehicle/template/charge_template/+/chargemode/selected out
The last line exports a topic FROM the HA-MQTT server TO the openWB-MQTT server by specifiying the out option. This topic is populated by Home Assistant when you change the Chargemode on the UI, for example from PV Charging (PV-Laden) to Instant Charging (Sofortladen).
Note: The example configuration is not complete. Please refer to the file mosquittoExampleConfiguration.conf in this repository which contains a fully running example. Just don't forget to adapt the device IDs!
Check the file MQTT-Topics.txt in this repository for more information.
How ro read this file?
Let's investigate the following example entry:
SENSORS_PER_CHARGEPOINT
mqttTopicCurrentValue = {mqttRoot}/chargepoint/{deviceID}/{key}
key="get/power",
For the device chargepoint, there is a sensor that subscribes to the MQTT topic
{mqttRoot}/chargepoint/{deviceID}/get/power
# For example: openWB /chargepoint/0 /get/power
If you want to know to which sensor entity this MQTT topic is mapped, have a look into the file const.py.
Check the list SENSORS_PER_CHARGEPOINT
and locate the entry with key="get/power"
.
The property name corresponds to the entity name in Home Assistant. In our example, the topic above is mapped to the sensor Ladeleistung of the device chargepoint.