alex20465 / deskbluez

Connects to a low energy actuator system via bluetooth and allows remote control via command line or internal managed interface.
MIT License
65 stars 12 forks source link

Compatibility with Linak DPG1C #2

Closed darkkatarsis closed 4 years ago

darkkatarsis commented 4 years ago

I was able to connect to my desk, unfortunately only the desk position works fine. Could you help me a little or direct me where to look for the problem?

Screenshot 2020-05-31 at 00 20 04

"move --to " do nothing

darkkatarsis commented 4 years ago

Ok, it started working. I don't know what has changed. I think other paired devices may have interrupted the operation.

I am able to pick up items via mqtt, but I don't quite understand how to construct the topic "control" to be able to control the desk. Something like this ?

topic: control payload: "up" ?

Screenshot 2020-05-31 at 12 50 46

or maybe it should be some kind json ?

adidoes commented 4 years ago

Try the payload without the quotes

darkkatarsis commented 4 years ago

Yes that was it, I found the reason when I started debugging the code. Now everything works. Thank you for your interest and help.

Everything works perfect but i found another problem and it seems I’m not the only one (may only apply to devices DPG1C). After some time of inactivity [or when the BT connection is broken], I can see the current position of the desk, but am unable to control it. The only way to regain control is to reconnect and re-save the “favourite” position via 3rd-party app. (e.g. Desk Assistant). Then I can connect again with deskbluez and suddenly everything goes back to normal operation.

Screenshot 2020-06-03 at 07 42 18

Screen-Recording-2020-06-02-at-0

Do you have any idea?

bradstcroix commented 4 years ago

I'm having the same issue. Did you ever get it resolved?

darkkatarsis commented 4 years ago

No, I think the DPG1C model goes to sleep and needs to be woken up after some time. Unfortunately, I lack the knowledge to solve this problem.

bradstcroix commented 4 years ago

I grabbed a frame dump from the Android Desk Control app and have looked at in Wireshark. It seems there are some other commands being sent to the DPG1C by the official app after it pairs. One of which is a move request, before the actual command is issued. I think that might have something to do with why we can't get the desk moving after connecting to it using Deskbluez on it's own. It's like the official app 'warms it up' so to speak by putting it in a state to accept the move commands. That's just a hunch btw. I will attempt to test some more and see what I can find

darkkatarsis commented 4 years ago

Would be great. I was browsing other projects on git looking for a solution. Unfortunately, very few people use the latest linak module. In the meantime, I made some improvements on my fork. I added more and clean data to MQTT and a systemctl service that starts after each restart.

Screenshot 2020-08-15 at 13 13 01 Screenshot 2020-08-15 at 13 13 14
alex20465 commented 4 years ago

Thank you very much darkkatarsis, I am in vacation right now, I will look into it once i am back

darkkatarsis commented 4 years ago

@bradstcroix did you find something?

bradstcroix commented 4 years ago

@darkkatarsis haven't had time to do another Wireshark session with it yet. As a workaround I've written a flow in Node-Red that keeps the connection alive using MTTQ commands. I've found that you have to send it a move command once every 3 hours or so to keep it from sleeping. The flow I use detects the timestamp of last move command sent then sends an up/down command after 3 hours. Not elegant but has kept the connection alive for a week so far.

As I said earlier I believe there's a move request (not command) that will keep it alive without moving it which will initialise it. Will need to find some time to test.

Cheers

darkkatarsis commented 4 years ago

In fact, I did similar automation. Sending a position change every 3 hours from the last position, actually maintains the connection and does not block the control. Weird

bradstcroix commented 4 years ago

Nice find

On Wed, Aug 26, 2020 at 5:34 PM darkkatarsis notifications@github.com wrote:

https://github.com/anson-vandoren/linak-desk-spec/blob/6c5bd06325612f2c0667d1c6e3ee83d717758701/spec.md

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alex20465/deskbluez/issues/2#issuecomment-680712368, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFMJYVO73FT76HQEAET4X2TSCS3G5ANCNFSM4NO4C2HQ .

darkkatarsis commented 4 years ago

@alex20465 maybe you can help me. After connecting to MQTT broker, the desk changes its position to last value of subscribeTopic. Do you have any idea how to block this behavior? So that the connection does not activate the change of position immediately? Need to clear some cache? Overwriting the subscribeTopic as null right after the connection doesn't help either

Edit: Nevermind, I had to restart the broker :)

alex20465 commented 4 years ago

@darkkatarsis It would be nice if you open a new issue with more details about how you connect and what exactly you subscribe. I will start a new release with improved reliability regarding the connection and miss-behaviors.

darkkatarsis commented 4 years ago

There is new issue related to this topic: Duplicate of #7

darkkatarsis commented 3 years ago

@darkkatarsis It would be nice if you open a new issue with more details about how you connect and what exactly you subscribe. I will start a new release with improved reliability regarding the connection and miss-behaviors.

Still planning on working on a new version?

Kwull commented 3 years ago

@darkkatarsis, can you share the link to Desk Assistant MacOS app? BTW, have you tested deskbluez under Mac?

darkkatarsis commented 3 years ago

Yes, I use my MacBook every day :) Sure https://apps.apple.com/tt/app/desk-remote-control/id1509037746?mt=12

rmervine commented 3 years ago

@darkkatarsis, is there some kind of trick you done to get this to pair with the DPG1C controller? From looking online, it looks like a couple of us use it. I have it and I tried many of the apps out there to try and control this with the ultimate goal of controlling in HA.

I'm getting "Authentication Failed" when trying to pair the controller through this app. Just curious if you had the same issue or not. I'm also using a Raspberry Pi for this experiment.