home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.11k stars 29.79k forks source link

Motionblinds bluetooth "end positions" missing #124158

Closed Kevin-vdk closed 2 weeks ago

Kevin-vdk commented 3 weeks ago

The problem

After completing the setup of the Motionblinds CMD-03 motor with the IOS app, including the configuration of start and end positions. Motionblinds Bluetooth integration discovers the roller blind and is able to connect. However, I'm not able to control the roller blind from HA. I keep getting the error message:

"Failed to perform the action cover/open_cover. Motionblind D60A's end positions need to be set before usage of this command."

It seems the start and end position are recognised by HA because when the roller blind is at its start or end positions, the "move up" or "move down" option becomes unavailable.

Debug logging enabled and output attached below.

What version of Home Assistant Core has the issue?

core-2024.8.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Motionblinds Bluetooth

Link to integration documentation on our website

https://www.home-assistant.io/integrations/motionblinds_ble/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-08-18 15:52:53.071 DEBUG (MainThread) [homeassistant.components.motionblinds_ble.cover] (D60A) Opening
2024-08-18 15:52:53.071 DEBUG (MainThread) [motionblindsble.device] (49:A3:0F:F3:D6:0A) Updating running: still
2024-08-18 15:52:53.071 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139625630643056] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2763, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2806, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/motionblinds_ble/cover.py", line 151, in async_open_cover
    await self.device.open()
  File "/usr/local/lib/python3.12/site-packages/motionblindsble/device.py", line 79, in wrapper
    return await func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/motionblindsble/device.py", line 138, in wrapper
    raise NoEndPositionsException(
motionblindsble.device.NoEndPositionsException: Motionblind D60A's end positions need to be set before usage of this command.

Additional information

Motionblinds firmware version: 1.1

home-assistant[bot] commented 3 weeks ago

Hey there @lennp, @jerrybboy, mind taking a look at this issue as it has been labeled with an integration (motionblinds_ble) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `motionblinds_ble` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign motionblinds_ble` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


motionblinds_ble documentation motionblinds_ble source (message by IssueLinks)

LennP commented 3 weeks ago

Hi,

So if I understand correctly you set up your blind using the mobile app, including end positions, and you can control it using the app?

How long have you been using the integration for? Could you include more debug logs, for example when you connect so I can have a look at the exact messages that are being received?

Kevin-vdk commented 3 weeks ago

That is correct. I have setup both blinds in the IOS app. Both are working correctly in the IOS app. Both blinds are connected through the MotionBlinds Bluetooth integration but both show the same error messages.

I am new to this integration. Attached are more debug logs when i connect both blinds and when I try to move the blinds up.

home-assistant_motionblinds_ble_2024-08-18T15-05-20.598Z.log

LennP commented 3 weeks ago

Interesting. Both motors are CMD-03 with firmware version 1.1? Have you tried resetting the motor? Also, what happens if you move the motor after it has been reset in Home Assistant, and it has no end positions? Could you send me debug logs of that so I can see the difference?

Kevin-vdk commented 3 weeks ago

I haven't had the chance to reset the motors but I have found out I actually have two motors of the type CM-09 with firmware version 1.1 instead of CMD-03. Are these motors supported by the integration?

LennP commented 3 weeks ago

I have tested with CM-09 motors previously which worked fine, so the motors should be supported. I am wondering whether this issue is just a rare occurrence that can be fixed by resetting the motor, a state that is not yet accounted for, or a change introduced with a new firmware update of the motor.

If you could reset one of the motors to see if that fixes it, then I will see if something has changed in a firmware update to cause this.

For your information, the only states that I thought were possible are:

Kevin-vdk commented 3 weeks ago

Only the end positions are set at this moment. The favourite position is not set. I will set the favourite position this afternoon before resetting the motor to see if that fixes it.

Kevin-vdk commented 3 weeks ago

No luck unfortunately. I first tried setting up the favourite position but HA still gave an error when moving the blind. After that I removed the device from HA, performed a reset of the CM-09 motor and setup the motor in de IOS app. I could not add the device in HA before the setup in the app was complete. After the setup in the app, I did not configure the start-, end- or favourite position. After adding the device to HA, I still got the same error message in HA when I tried moving the blind. finally I setup the positions in the IOS app but HA keeps giving the same error.

The debug logs are attached. home-assistant_motionblinds_ble_2024-08-20T14-55-42.604Z.log

LennP commented 3 weeks ago

Thanks! #124322 should fix the issue!

When the fix has been accepted feel free to share your experience with the integration, considering you have wired motors which means you could enable the permanent connection option to the motor!

Kevin-vdk commented 2 weeks ago

@LennP Unfortunately it seems your fix does not solve my issue since I still get the same error message. How do I know I use the latest version of de Motionsblinds integration?

LennP commented 2 weeks ago

@Kevin-vdk did you update to the latest version of home assistant?

Kevin-vdk commented 2 weeks ago

Yes, I performed the update to 2024.8.3 this evening.

LennP commented 2 weeks ago

Could you send me new debug logs? The Motionblinds library should have been updated to the new version which should fix this issue, have you tried restarting home assistant?

Kevin-vdk commented 2 weeks ago

I have restarted Home Assistant but this did not fix the issue. Attached are the new debug logs. home-assistant_motionblinds_ble_2024-08-25T20-22-04.362Z.log

LennP commented 2 weeks ago

Oh I see the new version of the library was not included with the latest 2024.8.3 release, I'm not sure why

https://github.com/home-assistant/core/releases/tag/2024.8.3 https://github.com/home-assistant/core/blob/516f3295bf68cdb1af09ea9fc43171216f3910cf/requirements_all.txt#L1369

Are you able to get access to the python instance to manually install libraries (python -m pip install ...)? If so, I could create a version 0.1.0 of the library for you with the fix in it

Kevin-vdk commented 2 weeks ago

I have no experience with python but if you can provide me with the steps I need to follow, I could give it a try.

LennP commented 2 weeks ago

How do you run home assistant?

Kevin-vdk commented 2 weeks ago

I run Home Assistant OS on an X86-64 machine.

LennP commented 2 weeks ago

Give this a try:

  1. Install the Advanced SSH & Web Terminal add-on (not the other SSH add-on, delete that one if you have it first) image
  2. Go to the add-on and enable "show in sidebar" and disable "protection mode" (I think this needs to be disabled to access python but I haven't tested it leaving it enabled)
  3. Go to the add-on configuration tab, fill in a sufficiently secure password and then click save
  4. Start the add-on
  5. Go to the "Terminal" that is now showing in the sidebar
  6. Type the following command to install the version of the library with the fix in it:
docker exec homeassistant python -m pip install --force-reinstall --no-cache-dir --no-deps git+https://github.com/LennP/PyPi-MotionBlinds_BLE@test_endpositions_fix2
  1. Restart Home Assistant
  2. Let me know if that fixes the issue!
Kevin-vdk commented 2 weeks ago

I followed your steps and it worked. Thank you!

LennP commented 2 weeks ago

Great! Feel free to let me know if you encounter any additional issues or have feature ideas that you would like to see implemented in the integration!