MQTT multiple loglines

Hi guys,

I’m sending data from some sensors to HASS with MQTT.

In the logfile of HASS I get 4 lines for each message I have sent. Does this mean that HASS is receiving AND/OR processing the message 4 times? In the database it looks like only 1 state record is made.

2018-04-17 10:14:25 DEBUG (MainThread) [hbmqtt.broker] broadcasting {'topic': 'homeassistant/david/temperature', 'data': bytearray(b'20.37'), 'session': Session(clientId=david, state=connected)}
2018-04-17 10:14:25 DEBUG (MainThread) [hbmqtt.broker] broadcasting application message from (client id=david) on topic 'homeassistant/david/temperature' to (client id=home-assistant)
2018-04-17 10:14:25 DEBUG (MainThread) [hbmqtt.broker] broadcasting application message from (client id=david) on topic 'homeassistant/david/temperature' to (client id=home-assistant)
2018-04-17 10:14:25 DEBUG (MainThread) [hbmqtt.mqtt.protocol.handler] 0 message(s) available for delivery
2018-04-17 10:14:25 DEBUG (MainThread) [hbmqtt.broker.plugins.packet_logger_plugin] home-assistant -out-> PublishPacket(ts=2018-04-17 10:14:25.766601, fixed=MQTTFixedHeader(length=38, flags=0x0), variable=PublishVariableHeader(topic=homeassistant/david/temperature, packet_id=None), payload=PublishPayload(data="bytearray(b'20.37')"))
2018-04-17 10:14:25 DEBUG (MainThread) [hbmqtt.broker.plugins.packet_logger_plugin] home-assistant -out-> PublishPacket(ts=2018-04-17 10:14:25.770238, fixed=MQTTFixedHeader(length=38, flags=0x0), variable=PublishVariableHeader(topic=homeassistant/david/temperature, packet_id=None), payload=PublishPayload(data="bytearray(b'20.37')"))
2018-04-17 10:14:25 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/david/temperature: 20.37
2018-04-17 10:14:25 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/david/temperature: 20.37
2018-04-17 10:14:25 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/david/temperature: 20.37
2018-04-17 10:14:25 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/david/temperature: 20.37

I’m using the inbuilt broker on HASS v0.63.3.

Kind regards,
David

As long as you are only getting 1 event, I wouldn’t worry.

Also when subscribing with MQTT-Spy, I get 2 messages for single every message sent from a temp sensor.

is your temp sensor updating twice? What does your automation look like?

My config looks like this:

sensor:
  - platform: mqtt
    name: "David MQTT"
    icon: mdi:thermometer
    state_topic: "homeassistant/david/temperature"
    qos: 0
    unit_of_measurement: "ºC"

It’s a DS18B20 sensor connected to a Wemos D1 mini board. I did serial monitoring of the ESP8266 and the mqtt message is just sent once every minute.

I’m not sure then. It could just be multiple log statements to trace a stack when debugging.

Okay, found it. I had mqtt discovery enabled with the same prefix. After disabling discovery the log shows one line for each message.

discovery_prefix: homeassistant

Nice, good to know.