Hi. Long time dev but new to OpenHab, Linux, MQTT and a bunch of other things here. I’m trying to get some IoT experience but can’t seem to get past Step 1.
I have OpenHabian 3.1.0 running on a raspi. I hooked up a Hue light to this and that all works as-expected. I’ve told it to install Mosquito and the MQTT Broker binding.
I have an esp32 with a LED ring - this works great. I’m using VSCode with PlatformIO, and PubSubClient & FastLED.
When the esp32 publishes my Homie topics, I get an inbox notification that there’s a new device but the name is the device id, not what I send in $name, and the only Thing Properties I see in the Thing is “homieversion” with no value.
Also, when it first gets discovered by Homie, it says “java.lang.Exception: Did not receive mandatory topic value: homie/tripod-light/$homie” - I’ve noticed that if I reboot the esp32, that usually (but not 100%) goes away.
I do have the windows “mqtt explorer” program running and connected to openhab, it shows exactly what I’d expect. Homie still hates me, though.
The config I’m sending is:
WiFiClient mWifi;
PubSubClient mMqtt(mWifi);
.
.
.
mMqtt.publish("homie/tripod-light/$homie", "4.0");
mMqtt.publish("homie/tripod-light/$name", "Tripid Light");
mMqtt.publish("homie/tripod-light/$state", "ready");
mMqtt.publish("homie/tripod-light/$nodes", "color");
mMqtt.publish("homie/tripod-light/color/$name", "RGB Color");
mMqtt.publish("homie/tripod-light/color/$properties", "cprops");
mMqtt.publish("homie/tripod-light/color/cprops/$name", "color");
mMqtt.publish("homie/tripod-light/color/cprops/$datatype", "color");
mMqtt.publish("homie/tripod-light/color/cprops/$format", "rgb");
mMqtt.publish("homie/tripod-light/color/cprops/$settable", "true");
mMqtt.subscribe("homie/tripod-light/#");
If I make changes in mqtt explorer, they do show up on the esp32 right away via the .subscribe(), so I think I’m doing proper network and MQTT but have screwed up something with Homie.
At this point I’m sorta going in circles. If somebody has a tip for what I’m doing wrong, I’d really appreciate it. Or if I’m in the wrong place, please point me somewhere better.
TY!!