OpenWB wallbox MQTT

Hello everyone,

i hope you can help me. I have an OpenWB wallbox and have connected it via MQTT.
My goal is to change the charging status via Home Assistant. I have also managed to do this using an MQTT select command.
Switching between the charging modes also works without any problems. The problem I have is that the status is not read out in advance. And if I change the mode directly via the wallbox, it is not recognized in the HA. I can read out the status via the MQTT Explorer.

For this I use the select command

mqtt:
select:
state_topic: “openWB/vehicle/template/charge_template/0/chargemode/selected”
command_topic: “openWB/set/vehicle/template/charge_template/0/chargemode/selected”
name: “Lademodus”
unique_id: OpenWB_lademodus_select
options:
- “instant_charging”
- “pv_charging”
- “stop”

I have also tried it with the following line:

state_topic: “openWB/vehicle/template/charge_template/0”

But that didn’t work either.

How can I ensure that the status is always up to date?
Many thanks for your help.
Greetings Martin

My first suggestion would be to change the topic title to add “OpenWB wallbox” so that others can more easily understand the subject.

You’ve clearly started well with open hardware, MQTT, and the excellent MQTT Explorer tool.

Many MQTT devices separate control and state, meaning command_topic and state_topic are usually different.
For example, Tasmota can use:

commandTopic: cmnd/tasmota-1234/POWER  # controls the device HA>T
stateTopic: tele/tasmota-1234/STATE    # device status       T>HA

Have you tried logging with MQTT Explorer, then manually changing state, and confirming the device doesn’t send anything at all (as that would be strange)?

  • If there’s not a topic sent by the device when the state is changed manually, that sounds like a bug in the device firmware.
  • Is the issue HA not interpreting stateTopic correctly? (so the entity doesn’t change state - sometimes HA times out and switches state back without confirmation)
  • What happens if you don’t set stateTopic? Does HA change it’s entity state ‘blind’? (no use if there are manual changes to settings on the box, obs.)

If this helps, :heart: this post!

2 Likes

Hi FloatingBoater,

thanks for the help.

The status is changed every time. I can also read this in the MQTT Explorer. See the first image on the right. The red and the green line.

I also tried to create a sensor to read out the status.

I think the problem is that the traffic jam is in the line, not just the status

If I do not set the state_topic, it shows the status that I set in the HA. However, if I now change the status on the wallbox itself, it does not display the changed status in the HA because it does not query the status.

I think the problem is that the status is not read correctly by the HA. It is reliably displayed in the MQTT Explorer.

Greetings Martin

Before diving in to a template function to extract the MQTT payload, I tried a quick web search and found a few custom-components in HACS referencing OpenWB.

Have you tried any of these? (might be a short-cut to a solution)

If nothing else, they share good explanations of the topics:

Hi James

thank you very much for your answer. I am using the first integration for software 2.0. The problem is that it runs halfway. But unfortunately not properly.
I have managed to send a command and it is accepted.

mqtt:         
  select:
    - name: "openWB Lademodus"
      unique_id: openwb_lademodus
      command_topic: "openWB/set/vehicle/template/charge_template/0/chargemode/selected"
      options:
        - "instant_charging"
        - "pv_charging"
        - "stop"

I only change one parameter in the middle of a command line.

What I don’t understand is that if I just want to read the status from the same path, it doesn’t work.

How can I not read the status if I can set it?

If I now only use the path “openWB/vehicle/template/charge_template/0”
then it receives the complete command line.

If I use the same path as for the set command (except for set), this does not work.

openWB/set/vehicle/template/charge_template/0/chargemode/selected

Thank you very much for your help.

Best regards Martin

Hi,

I’m going to go back to…

I think you need to go back to basics:

My expectation is at least one of the example integrations will have a template function to turn the MQTT topic into a state entity in HA that could be used for state_topic. There’s (at least) two to choose from, so read both - the examples might help you understand better.

I don’t have a device to test nor understand the multiple endopints /0, but this is based on many years integration testing experience, and writing my own MQTT devices / integrations.

Staring at partial screen-shots remotely and send guessing is no substitute for a hot beverage and tracing the data through step-by-step.

Good luck!

If this helps, :heart: this post!

Hi James,

thank you very much for your help. I will try to fight through it again. I think I expressed myself a bit clumsily.

The problem I have is that when I want to read out the current charge status, I do this in the MQTT explorer and access HA.

With the path :

openWB/vehicle/template/charge_template/0

The file is then displayed in JSON as follows:

{
  "name": "Standard-Lade-Profil",
  "prio": false,
  "load_default": false,
  "et": {
    "active": false,
    "max_price": 0.0002
  },
  "time_charging": {
    "active": false
  },
  "chargemode": {
    "selected": "pv_charging",
    "pv_charging": {
      "dc_min_current": 145,
      "dc_min_soc_current": 145,
      "min_soc_current": 16,
      "min_current": 0,
      "feed_in_limit": false,
      "min_soc": 0,
      "max_soc": 100
    },
    "scheduled_charging": {},
    "instant_charging": {
      "current": 20,
      "dc_current": 145,
      "limit": {
        "selected": "none",
        "amount": 1000,
        "soc": 50
      }
    }
  }
}

The information I need is behind “selected”: in this case “pv_charging”

And that changes to “stop” or “instand_charging”

The information I need is behind “selected”: in this case “pv_charging”

And that changes to “stop” or “instand_charging”

In the information from the integration, I found the information on how to change the status. That also works. But not how I can reliably read out the status in the HA via a sensor.

Best regards Martin