-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add Hunter BTT (BLE) as plugin #5158
Comments
Well it is just like a switch, so it would fit perfectly well in the ESPEasy architecture... However (there is always one of those ;) ) we currently have not any Bluetooth related code integrated in ESPEasy so far. This is one of the reasons I have not yet looked into Bluetooth myself to integrate it into ESPEasy. I am currently doing a complete rewrite of the WiFi/network related code, so I can keep this in mind. N.B. not all ESP32's support the same Bluetooth. So that's another caveat for adding Bluetooth support. Does your test setup use both WiFi and Bluetooth? |
Im currently testing/developing with the ESP32 connected with USB cable, so not via WiFi yet, I was not aware of this challenge. For this project it would be mandatory to use WiFi in combination with Bluetooth. I started this project to extend the very short Bluetooth range of this value over WiFi and off course add automation via ESPEasy. These are my board details:
I will include WiFi in my test to see what happens. |
I did some testing. I enabled Wifi and Webserver and created a simple page that triggers some BLE commands. When BLE is connected, the webpage is very unstable, not usable. When BLE is disconnected, the page works fine. After some researching I got it working stable with these code parts:
From what I understand it puts Webserver on core 0 where also wifi is serviced from. BLE is serviced from core 1. This works for me on a 250 lines sketch. Ping to ESP32 is fluctuating a lot, between 6 and 500ms. |
I expect the only way to get this stable is to let the WiFi negotiate a longer DTIM with the AP and keeping track of when a beacon interval is about to happen. But I think the only real stable option is to use Ethernet when using Bluetooth. |
And what about using an HM10 Bluetooth module? It has support for BLE. You can't use an BLE library, but I can create the AT commands to reach the same goal. Do you see any problems with using that module? |
It feels a bit backward to use an external BLE module on a unit that has BLE on-board (at least the ESP32 series), but it will probably be the simplest solution to communicate with Bluetooth devices. You'd probably have to use the Serial Proxy (P087) or Serial Server (P020) plugins to control that module and receive/process the response in rules. Not sure what the response speed would be though, but they seem to communicate at 115200 baud, so that should be fast enough for most types of sensors, once they are connected. |
With BLE speed is not very essential. Just ordered some HM10's and will do some testing. |
@BasvanH do you have list of AT commands for this module? |
@uzi18 I found this page quite helpful: https://www.martyncurrey.com/hm-10-bluetooth-4ble-modules/#HM-10%20-%20AT%20commands |
@tonhuisman but BLE module is not a problem here. Note.: The HM-10 is Bluetooth version 4.0 only. This means it cannot connect to Bluetooth 2/2.1 modules such as the HC-06 and HC-05. |
@uzi18 I already have reversed engineered part of the Hunter BTT BLE protocol. Im able to manually control the valve by giving x minutes to run. And I can manually close it. Open, run for 5 minutes: Service ID fcc0 / Characteristic fcd9
69 Manual control Close: Service ID fcc0 / Characteristic fcd9
69 Manual control Im busy gatchering the data for switching between Disabled / Manual and Schedule. If you want to do reverse engineering yourself, grab an android phone. Enable developer tools and enable HCI snooping. Reboot your phone. Then open Hunter BTT app and perform your actions, note down the time you execute those actions. Then pull the debug logs and drop them in Wireshark. There you can see the BLE packets and their service ID's and Characteristics. //Edit |
Nice, will compare these data with what have found on my own. |
If you found any, please share it with the community. |
@BasvanH did you find any kind of ACK from BTT about new state? |
No ACK, but it advertises the active state in service fcc0. When you WRITE for example ON with 5 minutes |
I see there is a Write response. This is the sequence:
Then you receive a Handle Value Notification:
And when it's written, you receive a Write Response
|
Hi,
I'm reverse engineering the BLE protocol for controlling my Hunter BTT irrigation valve. As Im already using ESPEasy within my home ecosystem, I was thinking about writing a plugin for it.
Im using the NimBLE library to communicate with the Valve. I want to readout the battery status (done). I wish control open and close of the valve (done). And I wish to change it operating mode, schema / manual / disabled (WIP).
Plugin features:
I currently own the single valve version, there's also a double valve version. I can add support but I then need to BLE traffic dumps.
My questions:
Regards,
Bastiaan
The text was updated successfully, but these errors were encountered: