cafy
cafy copied to clipboard
endpoint request
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"
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)
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.
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 ?
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.
I guess you could not find the time to check this. is everything OK ?
hi,
do you have any progress ? I lost comm. with you...
Hi,
I lost communication with you. Are you OK ?
@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 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 ?