MQTT Sensor - Connection Refused

Hej everyone,

i am dealing around with the mqtt setup since a view days. Target is to control different relais and get data by sensors.

Well now, currently i’ve following Setup:
Raspberry Pi 3,
OS: hass.io
NodeMCU by Amica (ESP12E) Flash ESP Easy

Config file MQTT:

mqtt:
  broker: core-mosquitto
  username: mqttuser
  password: mqttpw

Config File Sensors

sensor:
  - platform: yr
  - platform: mqtt
    state_topic: 'home/esp01/room/temperature'
    name: "ESP Temperatur"
    unit_of_measurement: "°C"
  - platform: mqtt
    state_topic: 'home/esp01/room/humidity'
    name: "ESP Feuchtigkeit"
    unit_of_measurement: "%"
  - platform: mqtt
    name: "Fabian's Mood"
    state_topic: "home-assistant/fabian/mood"

Config MQTT Mosquitto

{
  "plain": true,
  "plain_websockets": false,
  "ssl": false,
  "ssl_websockets": false,
  "anonymous": true,
  "logins": [
    {
      "username": "mqttuser",
      "password": "mqttpw"
    }
  ],
  "customize": {
    "active": false,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

This is not working. The result: I See 2 Sensors in homeassistant, but i do not see any values:

17

As you can see, i also tried it with the given fabian’s bad mood example from:

But here i do get the Error :

core-ssh:~# mosquitto_pub  -h 127.0.0.1 -t "home-assistant/fabian/mood" -u mqttuser -P mqttpw -m "bad"
Error: Connection refused

Please could you help me?

Following i could find in mosquitto log’s in HA:

1534579753: mosquitto version 1.4.15 (build date 2018-03-04 15:36:00+0000) starting
1534579753: Config loaded from /etc/mosquitto.conf.
1534579753: Opening ipv4 listen socket on port 1883.
1534579753: Opening ipv6 listen socket on port 1883.
1534579753: Warning: Mosquitto should not be run as root/administrator.
1534579754: New connection from 172.30.32.1 on port 1883.
1534579755: Socket error on client <unknown>, disconnecting.
1534579755: New connection from 172.30.32.1 on port 1883.
1534579755: New client connected from 172.30.32.1 as 6c3f8348-f6c2-4f8d-aa49-780f906bf745 (c1, k60, u'mqttuser').

How can i check if the mqtt add on is working properly?
How can i be sure, that everything is allright with the ESP i flashed with Esp Easy?
on ESP Easy Mega i do see values Temperature and Humidity but i do not get them into HA

Update: Just tried this:

Result: Still not working.

1 Like