manekinekko / cafy

An experimental node package to interact with the Delonghi Primadonna Elite (and probably other ECAM models)
MIT License
53 stars 8 forks source link

endpoint request #8

Open ilker-aktuna opened 3 years ago

ilker-aktuna commented 3 years ago

I'm not sure if this is the correct place to post because this is not really an "issue" with the code. But since you asked me to open an issue on Smartthings community, let me try to describe.

I have a similar implementation that use on my Raspberry PI server. It uses the Noble nodejs library from here: https://github.com/noble/noble

and provides http endpoints to be used with smart home hubs. So far I utilised it with Smartthings and Hubitat hubs.

Endpoints are easily created using nodejs "express" library. it listens on a tcp socket for http post/get requests and then gets parameters like "poweron" , "espresso", "cappuccino", "americano", "cappuccino mix"

accrording to the received order, it creates the BLE request and sends to the Coffee Machine. but I am not sure of my Noble use , I guess I'm having a loop somewhere or creating unnecessary threads. as a result it starts to fail after some time.

maybe we can have a look at my nodejs code, or implement similar endpoints on "Cafy"

ilker-aktuna commented 3 years ago

shall we work on this ? please let me know if posting my nodejs code will help.

btw, endpoint structure may be different. I just need some endpoints to "power on" and "order types of coffee" also periodically query the status of the machine (on or off)

manekinekko commented 3 years ago

Hey, I started working on this feature. But I have issues with Noble as well. So it's not easy to get it working all the time. I will keep investigating and try other options.

But here is a simple working scenario: https://user-images.githubusercontent.com/1699357/114368557-d0216980-9b7d-11eb-974f-b3c6a22dff91.mp4

In order to run this example, update your code to latest code from main branch (https://github.com/manekinekko/cafy/commit/0fd024896722ebe64a819bfe567328c9e6eb7b7d) and run:

git rebase origin/main
npm install
npm run server

Then access the sample web page at http://0.0.0.0:8080/

Please note that this example is using Websocket (using socket.io) for real time interaction.

ilker-aktuna commented 3 years ago

Hi,

actually , I have a fully working scenario on which I can power on the machine and make 4 different drinks. as I wrote before, my problem is that the PI (or noble) loses the connection after some time. I guess this might be about the code logic (loops ?) that I used incorrectly. Or it might be a generic problem with Noble.

if you also have issues with Noble, we should focus on why we lose the connection. Or maybe use another library for bluetooth connection ? Why did you move on to Noble ? (I'm not sure if you were already using Noble from the first day)

How can I help you ?

ilker-aktuna commented 3 years ago

I catched a problem with my nodejs code. It sometimes outputs this error: MaxListenersExceededWarning: Possible EventEmitter memory leak detected

and after that it lose the connection. I don't know what causes this error and could not find a clue on Stackoverflow yet.

ilker-aktuna commented 3 years ago

I guess you could not find the time to check this. is everything OK ?

ilker-aktuna commented 3 years ago

hi,

do you have any progress ? I lost comm. with you...

ilker-aktuna commented 2 years ago

Hi,

I lost communication with you. Are you OK ?

Nikostito commented 8 months ago

@ilker-aktuna Do you happen to still have the working example where you power on the machine? I am interested in this scenario to power it on through rpi. I can connect with the machine but turn on command is not working for me..

ilker-aktuna commented 8 months ago

@ilker-aktuna Do you happen to still have the working example where you power on the machine? I am interested in this scenario to power it on through rpi. I can connect with the machine but turn on command is not working for me..

I have changed my coffee machine to a Siemens one with Home Connect. It is definitely better to have a wifi interface. I can build apps easily on that. So I don't have any interest at this project anymore. But I will check my archive for you. If I can find the code, I will post here. As far as I remember, "power on" is also available in this Github project. No ?