core icon indicating copy to clipboard operation
core copied to clipboard

Cover.set_tilt_position gives error

Open bkr1969 opened this issue 2 years ago • 27 comments

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

bkr1969 avatar Feb 07 '24 23:02 bkr1969

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)

home-assistant[bot] avatar Feb 07 '24 23:02 home-assistant[bot]

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

aarnaegg avatar Feb 08 '24 00:02 aarnaegg

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

bkr1969 avatar Feb 08 '24 00:02 bkr1969

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.

aarnaegg avatar Feb 08 '24 00:02 aarnaegg

Likely broken for some time post the core update.

bkr1969 avatar Feb 08 '24 00:02 bkr1969

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

bkr1969 avatar Feb 08 '24 00:02 bkr1969

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

aarnaegg avatar Feb 08 '24 01:02 aarnaegg

same issue image

lviciedo avatar Feb 08 '24 13:02 lviciedo

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.

Ixian avatar Feb 09 '24 13:02 Ixian

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

wila91 avatar Feb 10 '24 04:02 wila91

I'm also having this issue. 2024.2.1.

admiralham avatar Feb 10 '24 19:02 admiralham

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

austwhite avatar Feb 10 '24 22:02 austwhite

Same issue here since upgrading 2024.2

dominvepf avatar Feb 11 '24 23:02 dominvepf

I saw a pull request eariler that seems to indicate this may be fixed in 2024.2.2
https://github.com/home-assistant/core/pull/110275

austwhite avatar Feb 11 '24 23:02 austwhite

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 avatar Feb 12 '24 15:02 fsedarkalex

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

fsedarkalex avatar Feb 12 '24 15:02 fsedarkalex

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

austwhite avatar Feb 12 '24 18:02 austwhite

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.

bkr1969 avatar Feb 12 '24 21:02 bkr1969

My automation does not proceed after setting the tilt angle. The trace shows the error outlined before.Sent from NineVon: Brian @.***>Gesendet: Montag, 12. Februar 2024 22:56An: home-assistant/coreCc: fsedarkalex; CommentBetreff: Re: [home-assistant/core] Cover.set_tilt_position gives error (Issue #109933) 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.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/home-assistant/core/issues/109933#issuecomment-1939658129", "url": "https://github.com/home-assistant/core/issues/109933#issuecomment-1939658129", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

fsedarkalex avatar Feb 12 '24 22:02 fsedarkalex

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.

bkr1969 avatar Feb 12 '24 23:02 bkr1969

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

austwhite avatar Feb 12 '24 23:02 austwhite

Unfortunately for me this workaround would not work.I'd be required to redesign the automation in a much more complex way.Will just wait for the fix.Sent from NineVon: Brian @.***>Gesendet: Dienstag, 13. Februar 2024 00:08An: home-assistant/coreCc: fsedarkalex; CommentBetreff: Re: [home-assistant/core] Cover.set_tilt_position gives error (Issue #109933) 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.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/home-assistant/core/issues/109933#issuecomment-1939758967", "url": "https://github.com/home-assistant/core/issues/109933#issuecomment-1939758967", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

fsedarkalex avatar Feb 13 '24 07:02 fsedarkalex

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 :)

austwhite avatar Feb 13 '24 08:02 austwhite

This is a great idea. Maybe configurable as an option per step "continue on error" just as it is with timeouts in wait steps.

------ Originalnachricht ------ Von "Brendan White" @.> An "home-assistant/core" @.> Cc "fsedarkalex" @.>; "Comment" @.> Datum 13.02.2024 09:13:23 Betreff Re: [home-assistant/core] Cover.set_tilt_position gives error (Issue #109933)

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 😀

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/109933#issuecomment-1940689660, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD5P54XKDMMCIJEJLIUZZWTYTMOCHAVCNFSM6AAAAABC6WNXQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBQGY4DSNRWGA. You are receiving this because you commented.Message ID: @.***>

fsedarkalex avatar Feb 13 '24 08:02 fsedarkalex

Not part of this issue, but created a feature request https://community.home-assistant.io/t/feature-request-allow-automations-to-continue-after-service-failure/689312

austwhite avatar Feb 13 '24 08:02 austwhite

Seems like the update fixed the issue 👍

fsedarkalex avatar Feb 17 '24 00:02 fsedarkalex

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.

Camry2731 avatar Feb 17 '24 02:02 Camry2731

What do you mean?I am using a switchbot blind, calling cover.set_tilt_position in an automation. Since the last update 2024.2 it is working as expected again.IDK if this is relevant, but my Switchbot is connected through an ESPHome BT ProxySent from NineVon: Camry2731 @.***>Gesendet: Samstag, 17. Februar 2024 03:58An: home-assistant/coreCc: fsedarkalex; CommentBetreff: Re: [home-assistant/core] Cover.set_tilt_position gives error (Issue #109933)

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.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/home-assistant/core/issues/109933#issuecomment-1949618942", "url": "https://github.com/home-assistant/core/issues/109933#issuecomment-1949618942", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

fsedarkalex avatar Feb 17 '24 09:02 fsedarkalex

I'm also having the same issue on 2024.2.2

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

BenBlaisdell avatar Feb 19 '24 15:02 BenBlaisdell

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.

Ixian avatar Feb 19 '24 15:02 Ixian