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

light.turn_off all results in TypeError: bool object not subscriptable in tapo_control #693

Closed
rct opened this issue Oct 23, 2024 · 2 comments

Comments

@rct
Copy link

rct commented Oct 23, 2024

Description

If light.turn_off is called with entity_id: all, it will generate TypeError: 'bool' object is not subscriptable` in tapo_control

Reproduction Steps

To reproduce, need a tapo camera that has a light entity. Then call light.turn_off from developer tools -> actions

# YAML snippet for Developer Tools -> Actions
action: light.turn_off
data: {}
target:
  entity_id: all

Expected behavior

Tapo controls should not be able to make light.turn_off for all entities fail.

If applicable, add error logs.

Logger: homeassistant.helpers.script.websocket_api_script
Source: helpers/script.py:525
First occurred: 11:31:47 AM (2 occurrences)
Last logged: 11:31:54 AM

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 'bool' object is not subscriptable
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 525, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1021, in entity_service_call
    raise result from None
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1610, in async_request_call
    return await coro
           ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 639, in async_handle_light_off_service
    await light.async_turn_off(**filter_turn_off_params(light, params))
  File "/config/custom_components/tapo_control/light.py", line 95, in async_turn_off
    if str(camData["whitelampStatus"]) == "1":
           ~~~~~~~^^^^^^^^^^^^^^^^^^^
TypeError: 'bool' object is not subscriptable

Device Firmware

1.2.2 Build 240905 Rel.41780n

Integration Version

5.6.3

Using stream component

No

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

Home Assistant OS in VM on x86_64 (KVM)

Search for similar issues

Yes

Additional information

Only cameras connected right now are two C120's with the same firmware version.

@rct rct changed the title light.turn_off all results in TypeError: bool object not subscriptable in tape control light.turn_off all results in TypeError: bool object not subscriptable in tapo_control Oct 23, 2024
@rct
Copy link
Author

rct commented Oct 25, 2024

Some notes from additional testing. I get the same TypeError: 'bool' object is not subscriptable error when trying to turn the light entity on for one of my C120's. The light entity for the other C120 works correctly.

@JurajNyiri
Copy link
Owner

Fixed in https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/releases/tag/5.7.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants