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

C520WS - Siren Duration and Volume not working #635

Closed
JurajNyiri opened this issue Jul 20, 2024 · 10 comments · Fixed by #636
Closed

C520WS - Siren Duration and Volume not working #635

JurajNyiri opened this issue Jul 20, 2024 · 10 comments · Fixed by #636

Comments

@JurajNyiri
Copy link
Owner

Description

Siren duration and siren volume has been added to my

C520WS
by TP-Link
Firmware: 1.2.6 Build 231130 Rel.72992n

But when running it it says the function is not supported.

Reproduction Steps

  1. Change siren duration or siren volume
  2. Observe error function not supported

Expected behavior

Entity is either not added or works

If applicable, add error logs.

No response

Device Firmware

1.2.6 Build 231130 Rel.72992n

Integration Version

5.4.32

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

HA OS

Search for similar issues

Yes

Additional information

No response

@JurajNyiri
Copy link
Owner Author

FYI @marcosngomezi

@marcosngomezi
Copy link
Contributor

marcosngomezi commented Jul 20, 2024

What do you get from the camera with pytapo getAlarmConfig() function
and

.executeFunction(
                "getLastAlarmInfo",
                {"msg_alarm": {"name": ["chn1_msg_alarm_info"]}},
            )

?

@JurajNyiri
Copy link
Owner Author

{'msg_alarm': {'chn1_msg_alarm_info': {'enabled': 'off', 'light_alarm_enabled': 'on', 'alarm_mode': ['sound', 'light'], 'alarm_type': '0', 'light_type': '1', 'sound_alarm_enabled': 'on', 'alarm_volume': 'high', 'alarm_duration': '0'}}}

@JurajNyiri
Copy link
Owner Author

The issue is:

print(
    tapo.executeFunction(
        "setAlarmConfig",
        {"msg_alarm": {"siren_duration": [1]}},
    )
)
print(
    tapo.executeFunction(
        "setAlarmConfig",
        {"msg_alarm": {"alarm_duration": [1]}},
    )
)

Both of these do not work, in fact

print(tapo.getAlarmConfig())

Returns

[{'method': 'getAlarmConfig', 'result': {}, 'error_code': -40210}, {'method': 'getAlarmPlan', 'result': {}, 'error_code': -40210}, {'method': 'getSirenTypeList', 'result': {}, 'error_code': -40210}, {'method': 'getLightTypeList', 'result': {}, 'error_code': -40210}, {'method': 'getSirenStatus', 'result': {}, 'error_code': -40210}]

@JurajNyiri
Copy link
Owner Author

JurajNyiri commented Jul 21, 2024

print(tapo.getAlarm())
{'enabled': 'off', 'light_alarm_enabled': 'on', 'alarm_mode': ['sound', 'light'], 'alarm_type': '0', 'light_type': '1', 'sound_alarm_enabled': 'on', 'alarm_volume': 'high', 'alarm_duration': '0'}

@JurajNyiri
Copy link
Owner Author

We need to detect which is supported and use setAlarm instead I think, looking into this.

@JurajNyiri
Copy link
Owner Author

Pushed https://pypi.org/project/pytapo/3.3.25/ which has a support for alarm duration and volume in setAlarm

@JurajNyiri
Copy link
Owner Author

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

@marcosngomezi please test if everything still works as expected on your side and cameras.

@marcosngomezi
Copy link
Contributor

Got some errors and numbers and selects are unavailable on latest 5.5.1:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/tapo_control/number.py", line 108, in async_setup_entry
    numbers = await setupEntities(entry)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo_control/number.py", line 80, in setupEntities
    tapoSirenVolume = TapoSirenVolume(entry, hass, config_entry)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo_control/number.py", line 293, in __init__
    TapoNumberEntity.__init__(
  File "/config/custom_components/tapo_control/tapo/entities.py", line 283, in __init__
    self.updateTapo(entry["camData"])
  File "/config/custom_components/tapo_control/number.py", line 355, in updateTapo
    self.alarm_enabled = camData["alarm_config"]["automatic"] == "on"
                         ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'automatic'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 268, in _async_update_data
    return await self.update_method()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo_control/__init__.py", line 579, in async_update_data
    entity["entity"]._enabled
AttributeError: 'TapoSirenVolume' object has no attribute '_enabled'. Did you mean: 'enabled'?

Looking at it to give you more info

@marcosngomezi
Copy link
Contributor

that fix solves it, and should work for yours also, not very pretty anyway

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

Successfully merging a pull request may close this issue.

2 participants