Closed JurajNyiri closed 4 months ago
FYI @marcosngomezi
What do you get from the camera with pytapo getAlarmConfig()
function
and
.executeFunction(
"getLastAlarmInfo",
{"msg_alarm": {"name": ["chn1_msg_alarm_info"]}},
)
?
{'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'}}}
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}]
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'}
We need to detect which is supported and use setAlarm instead I think, looking into this.
Pushed https://pypi.org/project/pytapo/3.3.25/ which has a support for alarm duration and volume in setAlarm
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.
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
that fix solves it, and should work for yours also, not very pretty anyway
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
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