tobygray / coffeesp32-link

ESP32 Bridge to Control DeLonghi Coffee Machines
GNU General Public License v3.0
16 stars 3 forks source link

Any Progress? #1

Open Azrael-Masters opened 2 years ago

Azrael-Masters commented 2 years ago

Do you have any success for connecting BLE and send Command? I found your project, and this https://github.com/manekinekko/cafy/blob/main/src/commands.ts . But I wasn't able to find an example how to complete your code, because I'm new in ESP32.

I want to use it with OpenHAB3 via MQTT. As I tested, MQTT connection is established, but the Connect/Send BLE Command is missing in your Project? Maybe you have an idea/example how I can get further?

Thanks a lot and best regards Tobias

tobygray commented 2 years ago

Sorry, life got in the way of me finishing this project. Thanks for the link to the cafy project - that me be just what I needed to finish this off. I'll let you know if I manage to get it working.

dberwig commented 2 years ago

I am also very interested in this project!

I am planning to use it in Home Assistant and Node Red with MQTT to control a Delonghi PrimaDonna Class ECAM 550.85.MS - I am guessing it should work with it as well...

Thanks a lot for your effort into this project!

tobygray commented 2 years ago

I've just pushed changes that make the switch on command work. Let me know if that works for you? Any suggestions on how to expose things like the making drink commands over MQTT would be welcomed.

Azrael-Masters commented 2 years ago

Thanks for the fast update. I have to test a little bit further. Because of the reduced Logging I can see, that it connects to my Wifi, but logging to MQTT Server or lookup of the coffee machine didn't not work like the original version (maybe). I currently get no console output after Wifi Connection. But maybe this just a problem in my local enviroment.

What do you mean with expose items? Do you mean the specific MQTT Topics and Parms for Drinks? My first thought is a separate Mastertopic like "coffeesp32-link/%DeviceId%" instead of "homeassistant/switch/coffeesp32-link/%DeviceId%".

Another idea, is to add a Parameter for the MQTT port, not everyone is using the default one.

Azrael-Masters commented 2 years ago

So after a little more testing, i got a little nearer to success. :-) homeassistant/switch/coffeesp32-link/D1902138/config {"name": "Coffee Machine","command_topic": "homeassistant/switch/coffeesp32-link/D1902138/command","icon": "mdi:coffee-maker"}

For that I readded the console output and changed BLE_SCAN_TIME_S to 15 again. After testing I think, it would be easier to publish a "Online"-MQTT Message to the Broker after connection to Wifi and Broker, before searching for a coffeemachine. It could also publish some Informations like ip, mac, connection strength and last Status (console output) or a list of found BLE Devices / Coffee Machines.

  1. problem was the distance between my officeroom and kitchen, because it scans, found ble devices and scans again => solved.
  2. problem, most time it found the machine of my neighbor (also a ECAM 656.85). But I see that sometimes it connects correctly. So mabye a parameter for correct device MAC Address as a MQTT Command would'nt be bad. I currently try to workaround.
  3. after that i got the "status"-MQTT Message and tried to switch it on (PIN enabled on Machine and added to secret.h). Machine didn't respond. Ok so I disabled the PIN on the Machine and tried again, but no respond. Because it was late yesterday i have to test point 3 again, maybe it was just the wrong machine. :-D

=> Update: It was the wrong machine, it works like a charm (machine turned on) What do you think about my points in the last posts?

bubez81 commented 2 years ago

hello, very interesting project. I did not understand, however, if it works. How can I try it? It is not clear to me how to write the yaml file for esp32, could you give a guide? Update: Sorry, after some research I have now managed to connect the machine.

I did not understand if you can send commands to make coffee or if it is not yet provided

ryborg commented 1 year ago

So after a little more testing, i got a little nearer to success. :-) homeassistant/switch/coffeesp32-link/D1902138/config {"name": "Coffee Machine","command_topic": "homeassistant/switch/coffeesp32-link/D1902138/command","icon": "mdi:coffee-maker"}

For that I readded the console output and changed BLE_SCAN_TIME_S to 15 again. After testing I think, it would be easier to publish a "Online"-MQTT Message to the Broker after connection to Wifi and Broker, before searching for a coffeemachine. It could also publish some Informations like ip, mac, connection strength and last Status (console output) or a list of found BLE Devices / Coffee Machines.

  1. problem was the distance between my officeroom and kitchen, because it scans, found ble devices and scans again => solved.
  2. problem, most time it found the machine of my neighbor (also a ECAM 656.85). But I see that sometimes it connects correctly. So mabye a parameter for correct device MAC Address as a MQTT Command would'nt be bad. I currently try to workaround.
  3. after that i got the "status"-MQTT Message and tried to switch it on (PIN enabled on Machine and added to secret.h). Machine didn't respond. Ok so I disabled the PIN on the Machine and tried again, but no respond. Because it was late yesterday i have to test point 3 again, maybe it was just the wrong machine. :-D

=> Update: It was the wrong machine, it works like a charm (machine turned on) What do you think about my points in the last posts?

Did you make changes adding new features or fix bugs? If so, can you create a pull from your code please?

tobygray commented 1 year ago

I'd be very happy to accept a PR which resolves the multiple machines problem - I'm lucky enough to not have neighbours that have the same coffee machine, but can appreciate that some way to specify which one you want to control would be good!

ryborg commented 1 year ago

I'm going to be testing this in the next few days. There are some bugs in the delonghi home assistant integration code that slow down HA, so this looks like the way to go. I will add some of the new commands as well.