BRUH MQTT Multi Sensor states Unknown

Hello - I’ve been using Bruh’s multi sensor perfectly OK for several months. After leaving the sensor unplugged for several week (was renovating a room), I decided to plug it back in, with no results in HA.

After weeks of not caring much about it, I decided to redo my HA config. Installed a fresh instance of Hass.IO and everything seems to be working quite well, except for this multi sensor.

I have re-done the setup at least 5 times, reloading the code to the NODEMCU. I’ve also tried 2 different boards, with no luck.

The state values in HA come up as unknown. The strange thing is, I can “somewhat” control the LED. The physical LED turns on BLUE when I plug in the sensor. HA shows the LED as off. When I click it ON, the light changes to WHITE and HA shows it is off however HA allows me to adjust the brightness of the WHITE light.

PIR, Temp/Humidity all show as UNKNOWN.

My SETUP is HASS.IO

  • using the MQTT Add On, I have a cloud.conf file in the share/mosquitto folder for CloudMQTT/Owntracks

config.yaml:
mqtt:
broker: 172.17.0.1

MQTT Add On shows the following in the logs:
1507831655: New client connected from 192.168.1.137 as sensor1 (c1, k15…

I named my sensor sensor1

I’ve tried connecting it to CLOUDMQTT with no luck, and I read online on some forum that the OTA setup could be causing an issue. Someone commented it out, and got it working.

I’ve, triple checked the max packet size 512 setting in pubsubclient.h file.

I feel as though this could be something very simple or very complicated. Either way, I’m out of idea but continuing to fiddle around with settings.

Any help would be greatly appreciated.

Weird… check a couple things. Check to see that the board is getting adequate power, use a different plug and/or cable. I’ve had that make a world of difference for some things that were acting very strange.

Have you checked all the connections on the nodemcu itself, maybe something came loose?

Restart the nodemcu and connect to it via the Arduino IDE and check the Serial Monitor under Tools, you should see it connect to wifi, mqtt then begin broadcasting data. You should see your motion/temp/etc. updating in real time. If it isn’t doing what it should here. Then you can eliminate HA as the trouble spot.

Good point about trying another cable and checking serial monitor. I’ll give that a go tomorrow.

I was going on the assumption that it worked before so the cable and power supple shouldn’t be at fault.

Yeah I just figured I’d suggest everything I could think off haha definitely check the serial monitor though.

Ok so I checked serial monitor. I see output, but in the form of gibberish. So it’s outputting something, just not sure what I suppose. A bunch of upside down question marks etc.

I replaced the cable with a known good one and a known good power supply. Still no output to home assistant.

I’m now under the impression it is MQTT related but everything in HA looks good.

I thinking to do a fresh install of Arduino IDE and do the config all over again.

The more I read about this, the more it points to the packet size setting at 512.

Yeah looks like the culprit is something arduino related. You should see a long line like JSON almost (I can’t recall exactly) like,

{“PIR”:“standby”} with other stuff then when you move your hand another line will pop up under it
{“PIR”:“motion detected”}

Once you see that you should be good to go!

1 Like

Bingo - was Arduino related.

I had to completely remove Arduino IDE, settings, folders in APPDATA etc.

Did a fresh install, reloaded boards and libraries, I’m back on track!

Thanks itchaboy for the moral support!

Awesome! No problem! Glad you got it working again. I’d be nothing without my motion sensors :sweat_smile:

Hello, Mr.Nimesh
I know that is along time since your post about the sensor “unknown” state
i’m new in home assistant and i tried to flash tasmota to nodemcu and install dht22 temp sensor and all things went good in serial monitor bust inside home assistant no reading state and giving me “unknown”.

could you help me?