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

Siren trigger not working #641

Closed
biopixen opened this issue Jul 23, 2024 · 17 comments
Closed

Siren trigger not working #641

biopixen opened this issue Jul 23, 2024 · 17 comments
Labels
Bug Something isn't working Fixed Bug has been fixed.

Comments

@biopixen
Copy link

Description

When installed and configured in Home Assistant
Core 2024.7.3
Supervisor 2024.06.2
Operating System 12.4
Frontend 20240710.0
Running Tapo: Cameras Control version 5.5.4

Clicking the Siren Button generates the following errormessage: Failed to call service siren/turn_on. argument of type 'bool' is not iterable

No Siren noise is heard.

Reproduction Steps

1: Go to Settings
2: Click in Devices & services
3: Click on Tapo: Cameras Control
4: Click on the device
5: Click on the toggle button to the right of the Siren icon under Controls

Expected behavior

Expected the sirent to start from the camera.

If applicable, add error logs.

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:241
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 15:59:09 (8 occurrences)
Last logged: 16:30:27

[139916973195472] Unexpected exception
[139916777598992] Unexpected exception
[139916775776336] Unexpected exception
[139917640346800] Unexpected exception
[139916861052320] 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 2731, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2774, 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/siren/init.py", line 121, in async_handle_turn_on_service
await siren.async_turn_on(
File "/config/custom_components/tapo_control/siren.py", line 115, in async_turn_on
if result_has_error(result) and result_has_error(result2):
^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/tapo_control/siren.py", line 174, in result_has_error
"result" in result
TypeError: argument of type 'bool' is not iterable

Device Firmware

1.0.4 Build 230901 Rel.66926n

Integration Version

5.5.4

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

Running on a Dedicated Linux Laptop

Search for similar issues

Yes

Additional information

Developer Tools

Tapo_C225_D8AB Siren | off | friendly_name: Tapo_C225_D8AB Siren supported_features: 19

I have tried Reconfigured the device and enabled Webhooks but with same result and errormessage.

@JurajNyiri
Copy link
Owner

Could you please enable debug logs and post the log here?

@biopixen
Copy link
Author

Hi! Thank you for a quick reply.
I have uploaded the debug log and am pasting in the last information that might be of interest:

_2024-07-23 20:30:09.265 DEBUG (SyncWorker_25) [custom_components.tapo_control] [pytapo] New request:
2024-07-23 20:30:09.265 DEBUG (SyncWorker_25) [custom_components.tapo_control] [pytapo] {'data': {'method': 'do', 'msg_alarm': {'manual_msg_alarm': {'action': 'start'}}}, 'headers': {'Host': 'REDACTED', 'Referer': 'REDACTED', 'Accept': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Tapo CameraClient Android', 'Connection': 'close', 'requestByApp': 'true', 'Content-Type': 'application/json; charset=UTF-8'}, 'verify': False}
2024-07-23 20:30:09.419 DEBUG (SyncWorker_25) [custom_components.tapo_control] [pytapo] 200
2024-07-23 20:30:09.419 DEBUG (SyncWorker_25) [custom_components.tapo_control] [pytapo] {'error_code': -40106}
2024-07-23 20:30:09.420 DEBUG (MainThread) [custom_components.tapo_control] Error: Parameter to get/do does not exist, Response: {"error_code": -40106}
2024-07-23 20:30:09.421 DEBUG (SyncWorker_25) [custom_components.tapo_control] [pytapo] New request:
2024-07-23 20:30:09.421 DEBUG (SyncWorker_25) [custom_components.tapo_control] [pytapo] {'data': {'method': 'multipleRequest', 'params': {'requests': [{'method': 'setSirenStatus', 'params': {'msg_alarm': {'status': 'on'}}}]}}, 'headers': {'Host': 'REDACTED', 'Referer': 'REDACTED', 'Accept': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Tapo CameraClient Android', 'Connection': 'close', 'requestByApp': 'true', 'Content-Type': 'application/json; charset=UTF-8'}, 'verify': False}
2024-07-23 20:30:09.545 DEBUG (SyncWorker_25) [custom_components.tapo_control] [pytapo] 200
2024-07-23 20:30:09.546 DEBUG (SyncWorker_25) [custom_components.tapo_control] [pytapo] {'result': {'responses': [{'method': 'setSirenStatus', 'result': {}, 'error_code': -40210}]}, 'error_code': 0}
2024-07-23 20:30:09.547 DEBUG (MainThread) [custom_components.tapo_control] Error: Function not supported, Response: {"method": "setSirenStatus", "result": {}, "error_code": -40210}
2024-07-23 20:30:09.547 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139916632345040] 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 2731, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2774, 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/siren/init.py", line 121, in async_handle_turn_on_service
await siren.async_turn_on(
File "/config/custom_components/tapo_control/siren.py", line 115, in async_turn_on
if result_has_error(result) and result_has_error(result2):
^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/tapo_control/siren.py", line 174, in result_has_error
"result" in result
TypeError: argument of type 'bool' is not iterable

home-assistant_tapo_control_2024-07-23T18-30-10.857Z.log

@JurajNyiri
Copy link
Owner

JurajNyiri commented Jul 23, 2024

Thank you, 2 more questions:

  • Was the siren working in previous versions of integration?
  • Is it possible to trigger the siren via the official app?

@biopixen
Copy link
Author

Hi! Sure!
1: Unclear. I have not used a previous version of the integration. I got two cameras 2 days ago a 225 and a 120. Installed the latest versions etc. The only think i have NOT done is to upgrade the firmware on the camera as I'm cautions to do that in case there are anything that breaks. Internet access for/to the cameras have been blocked.

2: Yes. But there is no "click here and trigger the siren". I played with the app and i believe the app requires two things to trigger a siren alert.

  • I must choose something that the camera should detect. Person, Pet, Motion etc.
  • I need to turn the "Alarm On"

In my testing i turned the motion detection ON and then the alarm ON. After moving in front of the camera the siren rang.

@JurajNyiri
Copy link
Owner

I checked the logs, there is nothing different about it that I can see that would help me determine whether the camera supports the trigger or not. Officially it is not supported on any cameras, but it does work on some.

Please download https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/tree/5.6.1 manually, it should behave similarly, but now go to disabled state for a while once clicked and throw a nicer meaningful error message.

@biopixen Please let me know if it works and I can release this.

@JurajNyiri JurajNyiri added the Bug Something isn't working label Aug 1, 2024
@JurajNyiri
Copy link
Owner

Hi @biopixen any luck testing this?

@biopixen
Copy link
Author

HI @JurajNyiri back from an extended vacation. Unfortunately i had to return the camera and am not able to continue the testing and verification. Thank you again for your support and commitment to solving the issue.

@IzzIsHOr
Copy link

Issue still exists on C225 by TP-Link Firmware: 1.0.29 Build 240522 Rel.74568n

Failed to perform the action siren/turn_on. argument of type 'bool' is not iterable

@JurajNyiri
Copy link
Owner

@IzzIsHOr make sure to update to the latest version and post full error message please from logs

@KlumzyKlein
Copy link

I get the same error as @IzzIsHOr - "Failed to perform the action siren/turn_on. argument of type 'bool' is not iterable".

On Version 5.6.1
Camera is 1.0.29 Build 240123 Rel.74249n

Log shows:

[140443684190768] Unexpected exception [140443683350432] 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/siren/__init__.py", line 121, in async_handle_turn_on_service await siren.async_turn_on( File "/config/custom_components/tapo_control/siren.py", line 115, in async_turn_on if result_has_error(result) and result_has_error(result2): ^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tapo_control/siren.py", line 186, in result_has_error if "error_code" not in result or result["error_code"] == 0: ^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: argument of type 'bool' is not iterable

Removing the line

#if "error_code" not in result or result["error_code"] == 0: #return False

gives me the error:

File "/usr/src/homeassistant/homeassistant/components/siren/__init__.py", line 121, in async_handle_turn_on_service await siren.async_turn_on( File "/config/custom_components/tapo_control/siren.py", line 117, in async_turn_on raise Exception("Camera does not support triggering the siren.") Exception: Camera does not support triggering the siren.

To make sure, I manually tested the alarm in the Tapo App and seems to work fine.

Changing the Alarm Type in the App changes the Siren Type correctly in Home Assistant.
Same for the Siren Volume.

I have a similar issue with my C120 (1.1.15 Build 240516 Rel.68711n).
Changing the Alarm Type / Alarm Volume in the App changes the relevant values in Home Assistant, however in this case there is no toggle exposed in Home Assistant to trigger the Siren. Let me know if you want me to raise a separate bug for that one.

@JurajNyiri JurajNyiri reopened this Aug 16, 2024
@masfernandez
Copy link

Same error here, all details below:

Core 2024.8.3
Supervisor 2024.08.0
Operating System 13.1
Frontend 20240809.0
Tapo: 5.6.1
Camera: C520WS 1.0, firmware 1.2.8 build 240606 rel 39146n

Logs:

2024-08-25 19:05:45.836 DEBUG (SyncWorker_20) [custom_components.tapo_control] [pytapo] New request: 2024-08-25 19:05:45.836 DEBUG (SyncWorker_20) [custom_components.tapo_control] [pytapo] {'data': {'method': 'securePassthrough', 'params': {'request': '<deleted for security, if needed please tell me>'}}, 'headers': {'Host': 'REDACTED', 'Referer': 'REDACTED', 'Accept': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Tapo CameraClient Android', 'Connection': 'close', 'requestByApp': 'true', 'Content-Type': 'application/json; charset=UTF-8', 'Seq': '383', 'Tapo_tag': 'REDACTED'}, 'verify': False} 2024-08-25 19:05:46.069 DEBUG (SyncWorker_20) [custom_components.tapo_control] [pytapo] 200 2024-08-25 19:05:46.069 DEBUG (SyncWorker_20) [custom_components.tapo_control] [pytapo] {'seq': 383, 'result': {'response': '<deleted for security, if needed please tell me>'}, 'error_code': 0} 2024-08-25 19:05:46.070 DEBUG (MainThread) [custom_components.tapo_control] Error: Function not supported, Response: {"method": "setSirenStatus", "result": {}, "error_code": -40210} 2024-08-25 19:05:46.071 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140238171157504] 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/siren/__init__.py", line 121, in async_handle_turn_on_service await siren.async_turn_on( File "/config/custom_components/tapo_control/siren.py", line 115, in async_turn_on if result_has_error(result) and result_has_error(result2): ^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tapo_control/siren.py", line 186, in result_has_error if "error_code" not in result or result["error_code"] == 0: ^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: argument of type 'bool' is not iterable

Siren enabled from Tap App working OK.
Don't know if siren was working on other versions, just installed everything

Regards.
MA

@JurajNyiri JurajNyiri changed the title Siren on TAPO C225 not working Siren trigger not working Oct 8, 2024
@JurajNyiri
Copy link
Owner

JurajNyiri commented Oct 8, 2024

Could you please confirm if for the affected cameras, there is a button in Tapo app that triggers the siren? Not sets the alarm or schedule etc (there are other entities for that), but actually when clicked, sounds the siren.

We definitely need to fix the error to be nicer and fix is rather simple, but if there is a way to trigger it we should implement that as well.

@masfernandez
Copy link

I confirm that there is a button in the Tapo app that triggers the siren. These buttons are for changing the sound type (Alarm settings)

I attached the screenshot of the buttons:

IMG_9849

@JurajNyiri
Copy link
Owner

@JurajNyiri JurajNyiri added the Fixed Bug has been fixed. label Oct 17, 2024
@AshuTheDoughnut
Copy link

Siren no longer works for my C210. It used to work perfectly fine. I have already tried downgrading the integration version but doesn't seem to work.

@AshuTheDoughnut
Copy link

image
Just updated to version 5.8.2
Still having the same issue

@JurajNyiri
Copy link
Owner

That works as expected. Read #713 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Fixed Bug has been fixed.
Projects
None yet
Development

No branches or pull requests

6 participants