NodeMCU MQTT DHT22

Hi, need some help:
I´ve changed from hasbian to hass.io. I´ve set up a Mosquito broker addon. My sonoff switches work well but my NodeNCUs with the DHT22 don´t.
In hass.io I´ve used the same code in the configauration.yaml as in the old hassbian.

mqtt:
  broker: localhost
  port: 1883
  client_id: home-assistant-1
  username: pi
  password: raspberry

sensor:
  - platform: mqtt
    name: "Keller"
    state_topic: "keller/sensor/humidity"
    unit_of_measurement: "%"
switch:
  - platform: mqtt
    name: "Licht Schiffsamaturen"
    command_topic: "cmnd/sonoff1/power"
    state_topic: "stat/sonoff1/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

I´ve changed nothing on the NodeMCU and the hass.io has the same IP Adress as the old hassbian.
Does anyone have an idea what´s the probelm?

Thanks
Ingo

Do you see something in the mosquitto logs?
I would setup a mosquitto client and look if the ModeMCU publishes to the topic.
If not the MCU is the problem.

I have this in the log:
1535214078: New client connected from 192.168.2.130 as ESPClient0 (c1, k15, u’pi’).
1535214086: New connection from 192.168.2.136 on port 1883.
1535214086: Client ESPClient0 already connected, closing old connection.
1535214086: Client ESPClient0 disconnected.

I think it´s OK because the broker receive new data.

Are there multiple MCU’s?
There are two different IP’s.

I have five of them. Just for testing I have just one in the cinfiguration.yaml.

Looks like they have the same MQTT Client ID?
Should be different on every Client.

Können wir nicht auch deutsch sprechen, oder besser englisch, damit alle mitlesen können?

Ich bin so oft hier, ich denke schon in Englisch, also weiter damit alle mitlesen können. :slightly_smiling_face:

How can I solve the problem with the ID? My setup of NodeMCU´s and DHT22 sensors worked fine on hassbian?

Which sketch runs on the MCU’s?

I´ve flashed the NodeMCU´s withe ESP easy. Do you need some screenshots?

Have one with Easy.
Under Config -> Unit Number maybe?
Try it different on every MCU.

EDIT: The topics will change then so you need to look with a mqtt client.

Did you use the embedded MQTT Broker in hassbian or mosquitto too?

Sorry, have to go now. Thank you for your help so far. I´m back tomorrow morning.

I´ve used mosquitto too.

There’s an issue with espeasy and ClientID’s.

I’m not sure if this is your problem as it worked in hassbian, but i’m 100% sure that MQTT ClientID’s should be different.
Maybe the ESPEasy forum can help.

And here’s something to read. Good luck!

Hello again,
I solved the problem in an different way. I´ve replaced all my NodeMCU´s with Sonoff´s an connect a DHT22 on gpio14 and everything worked fine.
I have no idea why the NodeMCU´s didn´t work.

1 Like

Please show some photos with your solution!? Tks