Skip to content
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

DPG1C Linak controller not supported #369

Closed
datbilling opened this issue Nov 20, 2023 · 10 comments
Closed

DPG1C Linak controller not supported #369

datbilling opened this issue Nov 20, 2023 · 10 comments
Labels
enhancement New feature or request

Comments

@datbilling
Copy link
Contributor

datbilling commented Nov 20, 2023

Many people including myself have replaced the original Idasen Desk controller with the upgraded Linak DPG1C controller.

There is an issue when using it with the Home Assistant idasen_desk integration which uses this library though. After a number of hours, moving the desk no longer works, only the current height continues to show. Usually this can be fixed temporarily by disconnecting the controller from HA bluetooth, connecting it to the phone app, moving the desk using the official app to "wake it up again" and then disconnecting and reconnecting to HA.

This has recently been fixed in version 2.1.0 of the project that this one was forked from, rhyst/linak-controller project in rhyst/linak-controller#32

Could the same fix be added here so that it also supports the DPG1C controller please?

@newAM
Copy link
Owner

newAM commented Nov 20, 2023

I made a PR here with the wakeup command: https://github.com/newAM/idasen/pull/370/files

It looks like the fix is to send a wakeup command before moving: rhyst/linak-controller#32 (comment)

It is easy to reproduce this? Are you able to test that inserting a wakeup before moving solves the problem?

@datbilling
Copy link
Contributor Author

Brilliant, thank you very much!

I've only used the HA idasen_desk integration which uses this, so can't test it that way yet.

I will install this directly and see if I can reproduce the issue, it should just require leaving it connected for a number of hours and then attempting to move the desk, but only seeing the current height is still showing but it doesn't move.

I could then try the same after installing it from the add-wakeup branch to see if it no longer happens. Please let me know if you see anything wrong with this method.

@datbilling
Copy link
Contributor Author

I tested this out and unfortunately it doesn't seem to work.

To install the new version, I ran these commands:

git clone https://github.com/newAM/idasen.git
cd idasen
git fetch origin pull/370/head:pr-370
git checkout pr-370
python3 -m pip install -e ./
idasen init
idasen pair
idasen height
idasen stand

I believe that is the correct way to run the new code.

While the controller was already "sleeping", I could get the current height but when attempting to move it to the "stand" position, the command just hangs with no output.

Moving it with the linak-controller tool with the version that has the fix did work however. The idasen stand command then did work because the linak-controller had already awoken it.

Is there anything else I can test?

@newAM
Copy link
Owner

newAM commented Dec 14, 2023

Sorry for the slow reply, work got crazy for a bit and I forgot about this. The next few months are going to keep being crazy for me, I won't have as much time as I would like for this. I'll be happy to review PRs if someone fixes this before then!

@datbilling
Copy link
Contributor Author

No problem, thanks for following up on this. I'm not sure what else I can do at this point, I believe I tested the new code correctly but it still doesn't wake the controller.

I hope you don't mind me asking you @kaml123 and @rhyst as I know this is a fork of the linak-controller project, but would you be willing to offer any help on applying the fix for the DPG1C controller here please?

@kaml123
Copy link

kaml123 commented Dec 17, 2023

Hi @datbilling and @newAM
In pull request I found 2 issues.
I put some comments there.

@datbilling
Copy link
Contributor Author

Hi @kaml123, thank you very much for taking a look at this!
I created PR #381 with the UUID_DPG & _COMMAND_WAKEUP corrections you commented on. Unfortunately it still doesn't wake the controller though.

I wasn't sure how exactly to implement the 3rd comment though?

I also propose to add self.wakeup() inside async def connect(self):

I tried simply adding self.wakeup() on line 132 under line async def connect(self): but it resulted in an error:
idasen\__init__.py:132: RuntimeWarning: coroutine 'IdasenDesk.wakeup' was never awaited self.wakeup() RuntimeWarning: Enable tracemalloc to get the object allocation traceback

@kaml123
Copy link

kaml123 commented Dec 19, 2023

Hi @datbilling,

I tried simply adding self.wakeup() on line 132 under line async def connect(self): but it resulted in an error:
idasen_init_.py:132: RuntimeWarning: coroutine 'IdasenDesk.wakeup' was never awaited self.wakeup() RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Please try changing to:

        while True:
            try:
                await self._client.connect()
                await self.wakeup()
                return

@datbilling
Copy link
Contributor Author

@kaml123 I added that but received SyntaxError: expected 'except' or 'finally' block. So I instead added await self.wakeup() to the already existing while True: on line 146. I hope there's no issue with that?

I tested it and it works! The desk moved to the stand position when the controller was sleeping. Thank you so much for your help with this.

@newAM could you please approve PR #381 if everything is fine with it and then #370 ?

@newAM
Copy link
Owner

newAM commented Dec 25, 2023

Added in v0.11.0 see this comment for more context on propagating to home-assistant.

@newAM newAM closed this as completed Dec 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants