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

Cover.set_tilt_position gives error #109933

Closed
bkr1969 opened this issue Feb 7, 2024 · 31 comments
Closed

Cover.set_tilt_position gives error #109933

bkr1969 opened this issue Feb 7, 2024 · 31 comments

Comments

@bkr1969
Copy link

bkr1969 commented Feb 7, 2024

The problem

I get an error that just says "position" when calling cover.set_tilt_position

What version of Home Assistant Core has the issue?

2024.2.0

What was the last working version of Home Assistant Core?

2024.1.xx

What type of installation are you running?

Home Assistant OS

Integration causing the issue

SwitchBot

Link to integration documentation on our website

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

Diagnostics information

[281471617779904] Entity cover.sb_master_left does not support this service.
16:36:40 – (ERROR) Home Assistant WebSocket API - message first occurred at 16:31:46 and shows up 2 times

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:240
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 16:31:46 (2 occurrences)
Last logged: 16:36:40

[281471617779904] Entity cover.sb_master_left does not support this service.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 874, in entity_service_call
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Entity cover.sb_master_left does not support this service.

Example YAML snippet

service: cover.set_cover_tilt_position
target:
  entity_id: cover.sb_patio_blinds
data:
  tilt_position: 50

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Feb 7, 2024

Hey there @Danielhiversen, @RenierM26, @murtas, @Eloston, @dsypniewski, mind taking a look at this issue as it has been labeled with an integration (switchbot) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of switchbot 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 switchbot 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)


switchbot documentation
switchbot source
(message by IssueLinks)

@aarnaegg
Copy link

aarnaegg commented Feb 8, 2024

I'm having the same issue. Are your blinds "Unavailable" in the switchbot integrations?

@bkr1969
Copy link
Author

bkr1969 commented Feb 8, 2024

No, but position is Unknown and I can't operate them at all.

@aarnaegg
Copy link

aarnaegg commented Feb 8, 2024

Right, that is what I meant. It has something to do with an old version of pySwitchbot. I can not find clear instructions on how to fix it.

@bkr1969
Copy link
Author

bkr1969 commented Feb 8, 2024

Likely broken for some time post the core update.

@bkr1969
Copy link
Author

bkr1969 commented Feb 8, 2024

OK. Wierdness here. When I run commands in call service or node red I get an error, yet the blinds actually respond as expected,

@aarnaegg
Copy link

aarnaegg commented Feb 8, 2024

I get the tilt error as well but the blinds respond and tilt position reports unavailable.

@lviciedo
Copy link

lviciedo commented Feb 8, 2024

same issue
image

@Ixian
Copy link

Ixian commented Feb 9, 2024

Adding I am having the exact same issue as reported after updating HA Core to 2024.2. Automations tied to the blinds no longer work; I can trigger them manually but get the tilt_position error and the device status is unknown.

@wila91
Copy link

wila91 commented Feb 10, 2024

Adding I am having the exact same issue as reported after updating HA Core to 2024.2. Automations tied to the blinds no longer work; I can trigger them manually but get the tilt_position error and the device status is unknown.

I also have this exact same problem

@admiralham
Copy link

I'm also having this issue. 2024.2.1.

@austwhite
Copy link

there are a few open tickets for similar things where switchbot bluetooth doesn't report state and gives an error. The blinds seem to move, but they are always in unknown state as well as throwing the error.
#109947 and #109734 also seem to refer to this.

I am just watching all of them as I too have same issue, since 2023.1.5 and still present on 2024.2.0 and 2024.2.1

@dominvepf
Copy link

Same issue here since upgrading 2024.2

@austwhite
Copy link

I saw a pull request eariler that seems to indicate this may be fixed in 2024.2.2
#110275

@fsedarkalex
Copy link

Confirmed.

2024-02-12 13:58:36.562 ERROR (MainThread) [homeassistant.components.automation.bad_jalousie] Bad-Jalousie: Error executing script. Unexpected error for call_service at pos 2: 'position'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 723, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/switchbot/cover.py", line 187, in async_set_cover_tilt_position
    self._last_run_success = bool(await self._device.set_position(position))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/switchbot/devices/device.py", line 96, in _async_update_after_operation_wrap
    await self.update()
  File "/usr/local/lib/python3.12/site-packages/switchbot/devices/device.py", line 576, in update
    self._update_parsed_data(info)
  File "/usr/local/lib/python3.12/site-packages/switchbot/devices/device.py", line 611, in _update_parsed_data
    self._set_parsed_data(self._sb_adv_data, merged_data)
  File "/usr/local/lib/python3.12/site-packages/switchbot/devices/curtain.py", line 68, in _set_parsed_data
    new_position = data["position"]
                   ~~~~^^^^^^^^^^^^
KeyError: 'position'
2024-02-12 13:58:36.565 ERROR (MainThread) [homeassistant.components.automation.bad_jalousie] While executing automation automation.bad_jalousie
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 666, in async_trigger
    return await self.action_script.async_run(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1600, in async_run
    return await asyncio.shield(run.async_run())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 435, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 487, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 512, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 723, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/switchbot/cover.py", line 187, in async_set_cover_tilt_position
    self._last_run_success = bool(await self._device.set_position(position))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/switchbot/devices/device.py", line 96, in _async_update_after_operation_wrap
    await self.update()
  File "/usr/local/lib/python3.12/site-packages/switchbot/devices/device.py", line 576, in update
    self._update_parsed_data(info)
  File "/usr/local/lib/python3.12/site-packages/switchbot/devices/device.py", line 611, in _update_parsed_data
    self._set_parsed_data(self._sb_adv_data, merged_data)
  File "/usr/local/lib/python3.12/site-packages/switchbot/devices/curtain.py", line 68, in _set_parsed_data
    new_position = data["position"]
                   ~~~~^^^^^^^^^^^^

@fsedarkalex
Copy link

Weird thing for me is, it actually moves but crashed the automations afterwards.

@austwhite
Copy link

The reason the automations crash is because Home Assistant doesn't know it moved.
A few others have reported that

@bkr1969
Copy link
Author

bkr1969 commented Feb 12, 2024

I guess I had the good fortune of creating input_booleans for all my blinds to keep track of state regardless. My automations don't crash, but looking forward to a fix in the (hopefully) next update.

@fsedarkalex
Copy link

fsedarkalex commented Feb 12, 2024 via email

@bkr1969
Copy link
Author

bkr1969 commented Feb 12, 2024

Nothing in the automation will happen after calling the set_tilt_position, but I'm using Node Red so I just moved the nodes that change the input booleans before the tilt call nodes and had to make a separate path for each blind rather than stringing them all together.

@austwhite
Copy link

austwhite commented Feb 12, 2024

Nothing in the automation will happen after calling the set_tilt_position, but I'm using Node Red so I just moved the nodes that change the input booleans before the tilt call nodes and had to make a separate path for each blind rather than stringing them all together.

This will happen as Home Assistant reports the service call as failing, even though the blind moves.
Hopefully be fixed in 2024.2.2 but temporary work around would be to separate the action for the blind and put it at the end of possible so the rest can run, or temporarily comment the blind action outbid possible

@fsedarkalex
Copy link

fsedarkalex commented Feb 13, 2024 via email

@austwhite
Copy link

Maybe it would be a nice feature for Home Assistant to ignore a service call failure and continue with the rest of the automation. Not valid for this issue, but I might make a feature request :)

@fsedarkalex
Copy link

fsedarkalex commented Feb 13, 2024 via email

@austwhite
Copy link

@fsedarkalex
Copy link

Seems like the update fixed the issue 👍

@Camry2731
Copy link

Seems like the update fixed the issue 👍

What’s your setup? I’ve updated to the version released today and it’s still not working for me. Looking at the Bluetooth logs it’s having a connection failure still.

@fsedarkalex
Copy link

fsedarkalex commented Feb 17, 2024 via email

@BenBlaisdell
Copy link

I'm also having the same issue on 2024.2.2

Tried removing the integration, restarting, and readding, but no luck

@Ixian
Copy link

Ixian commented Feb 19, 2024

I'm also having the same issue on 2024.2.2

Tried removing the integration, restarting, and readding, but no luck

Then you aren't having the same issue. The one reported here was due to a PySwitchbot issue that has been corrected (via a bump in version) in 2.2. This immediately fixed the problem for myself and many others. If you are still having issues with it you have another problem and should open a new issue, provide the required logs, etc. so it can be looked at properly.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@issue-triage-workflows issue-triage-workflows bot closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests