MQTT Switches stopped publishing

Hi guys,

I use a lot MQTT to establish connection between a Beckhoff PLC and HASSIO.
All my MQTT Switches worked fine for a long time, but recently they stopped Publishing.
I’m using core-2021.3.4.

I see that HASSIO is publishing the status, so the connection to the broker is ok , and the Switches are Subscribing topics.

Anyone with the same issue?
Thanks

If you go to
configurations, integrations, mqtt, configure

and listen to your topics, do you see them pass by ?

I assume the PLC is publishing, and HA is subscribed, right?
If so, you should check on the PLC side.
If not, you might need to clarify your setup.

Hi Francis,
I’ve got the Broker configured by yaml and it’s listening perfectly all topics.

My problem is that it stopped Publishing the Switches.
It was working just fine, and I don’t remember when it started to fail, maybe with some Core update.

I’ve got configured a Birth and Will messages for the MQTT service and these are published, and this is what I don’t understand why switches are not publishing anymore.

mqtt:
  broker: 192.168.1.201
  client_id: Hassio
  username: !secret mqtt_user
  password: !secret mqtt_pass
  birth_message:
    topic: "hass/status"
    payload: "online"
  will_message:
    topic: "hass/status"
    payload: "offline"

Hi Koying,
HA is Subscribing and Publishing topics to the PLC.
It was working fine, and that’s why I don’t understand why Switches stopped publishing.

Here is the yaml exemple of one of the project switches.
The state_topic is the one Subscribed, and it keeps working fine.
command_topic is the one Published, worked in the past but not anymore.

- platform: mqtt #Home Presence
  unique_id: HomePresence
  name: "Presença em Casa"
  state_topic: "home/config/presence"
  command_topic: "home/config/presence/set"
  payload_on: "TRUE"
  payload_off: "FALSE"
  state_on: "TRUE"
  state_off: "FALSE"
  optimistic: false
  qos: 0
  retain: true

Ok. You confirmed with, e.g., MQTT Explorer that HA doesn’t publish, right?
And you don’t have anything in the logs?

Problem solved!
There was a problem with the Broker itself.
Just restarted it and now I’m getting again all HA Published topics.

Thanks for all support.

1 Like