Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BT Connection / HA Connectivity Issue #3

Open
MrSiO opened this issue May 14, 2024 · 3 comments
Open

BT Connection / HA Connectivity Issue #3

MrSiO opened this issue May 14, 2024 · 3 comments

Comments

@MrSiO
Copy link

MrSiO commented May 14, 2024

Hi Dirk!
I finally got the time to test this on NodeMCU last night!

I filled out the "config_local.h" file.
Connected to wifi fine (same subnet as HA)
Pixoo was discovered from your Integration (worked like a charm)

But at this point I'm running into issues.

I see the advertise in VS console but no automatic connect....

...
ADVERTISE 11:75:58:XX:XX:XX Pixoo
ADVERTISE 11:75:58:XX:XX:XX Pixoo
ADVERTISE 11:75:58:XX:XX:XX Pixoo
... (non stop)....

While seeing the advertisements, in HA Developpement mode, I call service (eg: timer / see image) and it (somtimes) works once (Pixoo shows timer) and get this in terminal:

ADVERTISE 11:75:58:XX:XX:XX Pixoo
ADVERTISE 11:75:58:XX:XX:XX Pixoo
CONNECT 11:75:58:XX:XX:XX 1
SEND 01 07 00 72 03 01 00 0A 87 00 02
RECV 69

If I try to send again the same timer a second time, I systematically get an Error in HA:

"Failed to call service notify.divoom_pixoo. Unknown error"

But in terminal I do see somthing is Sent..... but noting is displayed....

SEND 01 03 00 46 49 00 02
RECV 01 19 00 04 46 55 00 00 00 01 01 01 64 00 01 01 64 00 0F 13 FF 00 01 01 01 00 A9 02 02
SEND 01 03 00 46 49 00 02
RECV 01 19 00 04 46 55 00 00 00 01 01 01 64 00 01 01 64 00 0F 13 FF 00 01 01 01 00 A9 02 02

The only way I can get it to work one shot again (sometime) is to Reset the NODEMCU and try again in Developpement mode.
Once I see the Advertises comming in, I call the Service from Developpement.... Then I see the Bluetooh logo appear on the Pixoo (but no timer displayed, this seems this initiates the BT connection but dosent display anything)
and NodeMCU logs this to terminal:

CONNECT 11:75:58:xx:xx:xx 1
SEND 01 07 00 72 03 01 00 0A 87 00 02

And at the end, If I push my luck and try a few times in a row to send the timer from HA, I completely loose the NodeMCU (wifi drops / see image).

-=WORKING EXAMPLE THAT DID DISPLAY THE TIMER=-

ADVERTISE 11:75:58:XX:XX:XX  Pixoo
ADVERTISE 11:75:58:XX:XX:XX  Pixoo
ADVERTISE 11:75:58:XX:XX:XX  Pixoo
CONNECT 11:75:58:XX:XX:XX  1
SEND 01 07 00 72 03 01 00 0A 87 00 02
RECV 01 06 00 04 72 55 03 D4 00 02
RECV 01 09 00 04 71 55 03 01 01 00 D8 00 02

-=NON-WORKING EXAMPLE THAT DID NOT DISPLAY THE TIMER=-

SEND 01 03 00 46 49 00 02
RECV 01 19 00 04 46 55 00 00 00 01 01 01 64 00 01 01 64 00 0F 13 FF 00 01 01 01 00 A9 02 02

Thx!!

Divoom-ESP32-Bug1

@d03n3rfr1tz3
Copy link
Owner

d03n3rfr1tz3 commented May 15, 2024

When the HA Integration is correctly set up (for example via auto discovery), it automatically tries to maintain the TCP socket the same way it would do with the Bluetooth socket. Additionally the first thing it does, when connecting via TCP is sending the connection info to the ESP32, so that the ESP32 is able to connect via Bluetooth. It also tries to reconnect, if the TCP and/or the Bluetooth connection gets lost. Therefore in an ideal scenario, you would only see it advertising for a short moment.

Why? Because its only advertising, when it isnt connected via Bluetooth. Which brings me to the first question: Did you make sure to remove/disable any other Divoom integration, that might take the limited Bluetooth connection? Because its possible that the original HA integration and the ESP32 Proxy are battling for the connection. The RECV 69 btw means, that its still trying to connect. RECV 96 would be, that the connection is lost. Both are handled by my HA integration (by waiting a little longer or trying to reconnect). And yes, these numbers were chosen intentionally by me 😉

Regarding the countdown-tool and why it did not show, I can only guess. It looks like you passed in the value 00.10 instead of 00:10. While that wouldnt be a big problem for my code, it might be, that through HA it comes as float into my code (instead of string) and therefore it cannot parse the minutes and seconds out of it.
The SEND code with the 46 in it you copied in here, is just the typical "get view" ping. The HA integration often sends this to make sure, the Bluetooth connection is still working, before sending the actual command. So, if you see these SEND or RECV lines with the 46 at the 4th or 5th position (depending on the direction), thats just the "get view" ping pong and not the actual command. The countdown command is the one with the 72 03 (72 for "set tool" and 03 for the tool "countdown").

@MrSiO
Copy link
Author

MrSiO commented May 16, 2024

Hi. Thx for your reply.
Connection from HA to nodemcu looks ok.
Everytime I call the service, I do see outputs from the terminal. Issue seem to be from the BT side. (I had a Wifi issue once but seems it was a one time glitch)

I did turn off any other devices previously peered with the Pixoo. In fact the discovery message never stops popping in terminal (confirming it's not connected to any other device). So the automatic BT connection initiated from the node MCU does not seem to work... Tried again just now, it only connects after Calling the service from HA. It seems to trigger the connection process and connects.

About the timer, the 00.10 was the actual way that I was using it trough my second HA integration so I did not think using the ESP32 would affect it (specially since it does work once in a while).

What simple test would you recommend using from HA Development? I'll keep it simple.

First thing first: If the NodeMCU should connect to Pixoo at startup, that's not working at this point. What test could help for troubleshooting / gather info?

Note: The only modifications I made to the project is setting my SSID & Password + my MQTT broker credentials. Everything else is by default.

Thx!!

@MrSiO
Copy link
Author

MrSiO commented May 19, 2024

UPDATE: I ordered WEMOS D1 MINI (esp32) to test with that hardware to see if it solves my issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants