formatBCE / Airbnk-MQTTOpenGateway

Gateway to use Airbnk locks with HA custom integration https://github.com/rospogrigio/airbnk_mqtt
GNU Affero General Public License v3.0
12 stars 1 forks source link

Running on NodeMCU ESP-32S - Cannot see M531 #12

Closed royco2 closed 1 year ago

royco2 commented 1 year ago

Hi,

As it says in the title. Running this on a NodeMCU ESP-32S (ESP-WROOM-32)

I have installed ESPHOME with the MQTT Open Gateway on it. Have configured the MAC address is Upper case and put the MQTT password in config (can see it on MQTT explorer)

Unfortunately, it seems to be stuck on "[D][airbnk_mqtt:105]: BLE scan heartbeat" as an endless loop. It seems it never does a scan? Never sees my M531, though I see it fine with my phone using the WeHere app.

Any thoughts?

formatBCE commented 1 year ago

Hey.

  1. Check that you have ESP32 close to the lock. I had really bad results with some ESPs...
  2. Heartbeat messages each 5 sec mean, that scanning is working. Check if you see adv messages from lock in your MQTT topic (long hexadecimal string).
  3. Check with nRFConnect app, if you see the lock and receive adv messages there.
  4. If adv is there, that could mean that gateway itself is working, but integration probably can't parse the data.
royco2 commented 1 year ago
  1. Any closer and it will need to be soldered on to the lock:)
  2. Yep every 5 secs [15:17:09][D][airbnk_mqtt:105]: BLE scan heartbeat [15:17:14][D][airbnk_mqtt:105]: BLE scan heartbeat [15:17:19][D][airbnk_mqtt:105]: BLE scan heartbeat

I only see "debug" and "status" on the topic, no adv messages

  1. I installed nRFConnect. I see the lock, not sure where I see adv messages there, but nothing I could find.
  2. Honestly think its the NodeMCU, but I can't see why...
royco2 commented 1 year ago

Any way to debug what the nodemcu see's? mac wise?

formatBCE commented 1 year ago

If it does see adv, it will transmit it to MQTT. It is very simple. But then you'd actually see it in logs.

You may try Tasmota gateway, to check if that one is working for you.

sdimitrov-sms commented 1 year ago

I do see adv data in NRFConnect, however, I do get the BLE message in the ESPHome logs..

image

and here is home assistant:

image

I am using ESP32 Dev Kit V1/V4.

Open to suggestions here

formatBCE commented 1 year ago

Yup, looks like either this chip can't handle active scan simultaneously with WiFi, or something is wrong with Bluetooth stack on it.

I'd suggest trying Tasmota gateway to verify, if it's working. Or trying another ESP32. I used Chinese ESP32-MINI, some generic wroom32 dev boards from Amazon, even ESP32-C3 - all work good.

sdimitrov-sms commented 1 year ago

When you say Tasmota you mean the custom firmware you have?

sdimitrov-sms commented 1 year ago

I have this running now on the same ESP32

This is what the device shows:

image

This is what the logs show:

image

This is what the MQTT integration in HASS shows:

image

And this is what I see when I set up the integration in general:

image

@formatBCE , What is wrong in the setup that it doesn't show me the controls?

Thanks!

formatBCE commented 1 year ago

@sdimitrov-sms well, it looks like adv is empty. Old custom firmware is sending empty string even when adv data can't be read. And of course, HA integration will show everything as unavailable, because there's empty strings from gateway, so no data received.

Check "more" section in nRFConnect, while scanning and meanwhile operate the lock manually - you should see changing payload (see screenshots). If it's there - then the problem is 99% in bad ESP chip.Screenshot_20230722_120908_nRF Connect.jpg

Screenshot_20230722_120827_nRF Connect.jpg

royco2 commented 1 year ago

Okay, so the problem was simple, it was a PEBCAK issue. Used an O instead of a 0 in the MAC address config. sorry for the hassle....

formatBCE commented 1 year ago

Oh geez... I guess we should have some error logs for cases like this.

Glad you found it though.

P.S. wait a sec, but you don't have 0 in your lock MAC!

royco2 commented 1 year ago

"XX:XX:XX:XX:0E:XX". did a O instead of a 0.... Yeah an error log would be great!