JurajNyiri / HomeAssistant-Tapo-Control

Control for Tapo cameras as a Home Assistant component
Apache License 2.0
1.08k stars 85 forks source link

Move_to_preset not working #340

Closed nightfever77 closed 1 year ago

nightfever77 commented 1 year ago

Description

I set up two presets in the Tapo app: Preset 1 and Preset 2:

image

Selecting each of the presets produces an error.

No matter how the presets are named in the app, options will update, but the error keeps saying "Preset 1" or "Preset 2"

Reproduction Steps

  1. Save a preset in the Tapo app, name it to whatever
  2. Create card for the select.camera_move_to_preset entity
  3. Select a preset

Expected behavior

Camera is paning/tilting to the selected preset.

If applicable, add error logs.

File "/usr/local/lib/python3.10/site-packages/pytapo/init.py", line 836, in setPreset raise Exception("Preset {} is not set in the app".format(str(presetID))) Exception: Preset 1 is not set in the app

Device Firmware

1.3.0 Build 220830 Rel.69909n(4555)

Using stream component

No

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

Hyper-V appliance

Search for similar issues

Yes

Additional information

No response

karsonPL commented 1 year ago

I have the same problem- Tapo Cameras Control - ver 5.2.2

Log details:

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/tapo_control/select.py:718 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 8 maja 2023 20:45:14 (14 occurrences) Last logged: 08:32:12

[139707856419664] Preset 4 is not set in the app [139707836489424] Preset 4 is not set in the app [139707853689696] Preset 1 is not set in the app [139707751805616] Preset 2 is not set in the app [139707751805616] Preset 3 is not set in the app Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1849, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1889, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 226, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 798, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 981, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 838, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/select/init.py", line 106, in async_select_option await entity.async_select_option(option) File "/config/custom_components/tapo_control/select.py", line 718, in async_select_option await self.hass.async_add_executor_job(self._controller.setPreset, foundKey) File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.10/site-packages/pytapo/init.py", line 836, in setPreset raise Exception("Preset {} is not set in the app".format(str(presetID))) Exception: Preset 1 is not set in the app

BaerHub commented 1 year ago

its working for me with this settings:

      - type: custom:button-card
        show_name: false
        icon: mdi:door
        tap_action:
          action: call-service
          service: select.select_option
          service_data:
            option: Eingang
            entity_id: select.tapoc200_hoehle_move_to_preset

also make sure your presets are int he Tapo App, after that, reload the integration. At least that worked for me

jocke92 commented 1 year ago

I do also have the same issue. I don't know how to solve it. It does move the camera to the preset but I do receive an error message each time. Which is not a big deal for a button, but it breaks my automation as they does not continue on error

sd65 commented 1 year ago

I had the same problem. I fixed it completely (no runtime errors) like this:

  1. Go to http://homeassistant.local:8123/config/integrations/integration/tapo_control
  2. For each Integration entry, click on the three dots
  3. Reload

Maybe restart HA at the end.

JurajNyiri commented 1 year ago

@nightfever77 could you please try the steps above and confirm if the error is resolved?

athos9204 commented 1 year ago

I had the same problem. I fixed it completely (no runtime errors) like this:

  1. Go to http://homeassistant.local:8123/config/integrations/integration/tapo_control
  2. For each Integration entry, click on the three dots
  3. Reload

Maybe restart HA at the end.

In my case, it solved the issue. Thanks!

JurajNyiri commented 1 year ago

This keeps coming up, I am going to take a deeper look for a bug.

JurajNyiri commented 1 year ago

I was able to replicate this and this is now fixed in 5.3.2.

jocke92 commented 1 year ago

I did have the same or similar problem and it was not resolved by the latest 5.3.4 update. Or so I thought. Because I figured it might be something on my end. And I guess it was. I had the target set to the "device_id" instead of "entity_id: select.camera2_move_to_preset". That change did solve the issue. But it was working before and broke by some update I guess.

Just putting this here if someone else has done the same error