MQTT with Retained Flag no Data update

Hello,
I’m new to HA and using the latest version. I try to bring my PV Inverterdata via MQTT to the energydashboard. I’m using my own broker which is working properly (checked with MQtt explorer and another client, where the data is working properly) The Topics were detected by HA. Problem is, that the Inverterdata YealdTotal are only coming once to HA. After that they never get updated anymore.
image
The Power Data is changeing constantly. I’ve seen that the YieldTotal Values are marked as retained in MQTT Explorer. I think it has something to do with that that HA is not updateing values. Is this a Bug? Can somebody help me please.

Going to need some more info.

Config for the sensors, or the discovery topics would be a good start.

1 Like

image
image
image
image
When manually listen to the topic I get what I want.
When I manually send Data to this topic, then the data appears as expected.
You can see this in the screenshot. The peak you can see there is manually sent data. The manual Data is with retain flag not set. The Inverter Data is with retain flag set. I’m not able to decativate retain in the client.

Is the YieldTotal updating in MQTT Explorer? If not, it’s not an HA problem.

Please post code as formatted text not screenshots where possible. Paste in the YAML config for YieldTotal: you’ve only given us a screenshot of YieldDay.

2 Likes

In MQTT Explorer the Values get updated constantly. Other clients are working properly. Only in HA I’m facing these problems. We are talking about Yield Total Day, so the screenshot is what we are talking about.

Nevertheless, please paste the full YAML config as formatted text for all the MQTT sensors.

1 Like
mqtt:
  sensor:
    - name: "PV Ertrag Tag"
      state_topic: "Wechselrichter/total/YieldDay"
      unit_of_measurement: Wh
      state_class: total_increasing
      device_class: energy
      unique_id: PV_Ertrag_Tag

At the moment this is the only sensor.
After not working, I decided to generate a sesor manually into the yaml, but as you can see it is also not working.

So the first sensor was auto-discovered but not working; and now you’ve created this manual one?

If this is your first mqtt: entry in your YAML, have you restarted HA? Are the screenshots above for this manual one or for the auto-discovered one?

1 Like

Exactly, first auto discovery, now manually into the yaml (Same bahvior). HA was restarted several times. A restart is causing that the Data gets transmitted once, but then never again, until the next restart. Screenshots are manual yaml.

And you have MQTT configured in HA? Here’s what mine looks like under the Integrations screen, with my broker being Mosquitto running in a separate Docker container from HA (i.e. not the HA add-on, same as you):


I’m not using mosquitto in HA. I’m using my own broker.

I’m quite sure that HA is not handling topics with retain flag set properly…

What broker is that ?

Its the Broker which my Homematic is using to bring MQTT to it. It’s called CCU Jack.
But nervertheless, when everything is working with MQTT Explorer, then it also has to in HA. Or not?

By the way, I’ve also subscribed to the topic with my Homematic and the the values are refreshing as they should.

It does in my installation.

Go to settings → Devices & Services → MQTT
Click configure
Under ‘Listen to a topic’, enter

Wechselrichter/total/YieldDay

and hit ‘Start listening’

As you can see in screenshot in start post, I’ve already done that and it is working.
But its working only once. The data appears one time and then never again. Mere less like a manual trigger.

CCU Jack called out a couple of times here. One person swapped it for Mosquitto and the problem went away.

I also used ccu-jack. The solution for me was to switch to another MQTT Broker, which is now running on my NAS instead of the Homematic CCU. With the new broker everything works again.

Integrations like Zigbee2Mqtt use retained configuration messages, this means that they survive a reboot, and popup when reconnecting. If there is a config error in these messages, thnx this will prevent MQTT from becoming available.

Maybe, but I need CCU Jack to bring the data to my Homematic, there is no other way. So I have this Broker anyway. I don’t want to have 2 different brokers in my system.

I would like to know the reason why this is not working. As I said, in MQTT Broker everything is fine, so there must be something in HA which is preventing it from refresing the values.

Here you can see that in MQTT Explorer Values are coming properly
image

Check your logs thoroughly: are there any relevant entries?

This topic describes a similar problem solved with an MQTT bridge:

1 Like

Already seen theese “Workarounds”, but try to find a soultion for it, not a workaround. It seems that HA have problems with Brokers which are not named Mosquitto…