JurajNyiri / HomeAssistant-Tapo-Control

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

Feature Request: Support Floodlight Control on Tapo C320WS HW2.0 #377

Closed Jtupz closed 1 year ago

Jtupz commented 1 year ago

Description

Everything seems to work fine, with the exception of the floodlight entity control. Documentation says that it should be available, however I do not see this option.

Reproduction Steps

Download from HACS, follow setup instructions Connect with account Camera is Tapo C320WS

Expected behavior

To see the ability to turn on and off the floodlight

If applicable, add error logs.

No response

Device Firmware

1.0.5

Using stream component

No

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

HASS OS VM in Proxmox

Search for similar issues

Yes

Additional information

I see options regarding the LED light (which works), and the option to use the light as the alarm “siren” (no action taken)

JurajNyiri commented 1 year ago

Thank you, let me know how the 7 goes! (Selects moved under configuration!) What kind of glitch in the app?

fuzzybear62 commented 1 year ago

Tested, it works. I belive that the toggle function is not useful in automations, but you can read the light status and so trasform in the classical On-Off to maintain compatibility with existing automations.

on HW 1.0 cameras there is a new option "Spotlight on/off for" that is not cliccable

The log is quite unreadable because I've five cameras and the messages not seems include the camera reference

The switchs "Manual Alarm Start", "Manual Alarm Stop" and "Siren" are not working, this is the trace: 2023-08-19 00:33:07.151 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [1379300264] Error: Parameter to get/do does not exist, Response: {"error_code": -40106}
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
return await service.entity_service_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call
response_data = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/button/init.py", line 124, in _async_press_action
await self.async_press()
File "/config/custom_components/tapo_control/button.py", line 135, in async_press
await self._hass.async_add_executor_job(self._controller.startManualAlarm)
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pytapo/init.py", line 1024, in startManualAlarm
return self.performRequest(
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pytapo/init.py", line 189, in performRequest
raise Exception(
Exception: Error: Parameter to get/do does not exist, Response: {"error_code": -40106}

The app, when you are in the form where time choices are shown goes in loop when changing parameters on HA, but I'll wil try again later

fuzzybear62 commented 1 year ago

This is what is going on in the app (there is no automatic refresh, so you have to go back and re enter in the selection screen). Using curl command I've never get this behavior.

If you are not in the app all works well.

photo_2023-08-19 00 46 40

JurajNyiri commented 1 year ago

I belive that the toggle function is not useful in automations, but you can read the light status and so trasform in the classical On-Off to maintain compatibility with existing automations.

In 5.3.0.beta.8 there is no more toggle but a light entity instead. It reflects the state of light as expected.

on HW 1.0 cameras there is a new option "Spotlight on/off for" that is not cliccable

That is normal, in Beta 6 an entity was added when it shouldn't have, just click the entity and click remove/delete as HA is telling you - it is safe to remove. Similarly to toggle/button entity now that has been replaced with light entity with Beta 8.

Screenshot 2023-08-19 at 10 51 07

Siren/Manual alarm start & stop is a known issue, unfortunately there is no way how to automatically detect support for it that I know of.

fuzzybear62 commented 1 year ago

Beta 8 is working as expected. Tested removing hw1.0 camera and re-add and all the enities are as expected.

For siren (and alarm) I'll try to sniff when an alarm is started and stopped. If I have some news I'll post. Meanwhile peraphs is better to hide (or gray) the three options to avoid error generation

Good team job!

JurajNyiri commented 1 year ago

Thank you for testing!

Meanwhile peraphs is better to hide (or gray) the three options to avoid error generation

That is not possible as there is no known way currently how to detect whether camera supports it.

fuzzybear62 commented 1 year ago

Yes, if is hw 2.0 (at least with this firmware, also known on device info) is not supported ;-)

JurajNyiri commented 1 year ago

In practice it is not feasible to add it to blocklist as there are many different combinations of cameras/firmwares as I explained here. We detect support for features by having a certain functions available. It will stay unfixed for now until a proper way is discovered how to detect support without actually executing the siren.

fuzzybear62 commented 1 year ago

BTW I've just seen that is available the C320WB with better sensor and sensitivity. another round of the carousel?

JurajNyiri commented 1 year ago

Code is written in a way that it works in all cameras, even future released, there might be missing features if something new is introduced - like in this case in this issue, but most of the things always work, so most likely this and many others cameras will work as expected.

fuzzybear62 commented 1 year ago

Perfect! As soon I'll receive we will see

fuzzybear62 commented 1 year ago

For complete testing I've added other two 2.0 cameras and configured with movement sensor checkmark. The configuration in app (and ha) is Movement off, Person on, Vehicle on. On the app I received the notification for person and/or vehicle (they works fine and are very precise), in HA no sensor is shown in the entities. Movement On instead is a nightmare because it generate a lot of false alarms, and this why I keep off.

All other functions works as expected

JurajNyiri commented 1 year ago

https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues/304

JurajNyiri commented 1 year ago

Available in 5.3.0.

fuzzybear62 commented 1 year ago

A short update: a new firmware for the HW 1.0 is rolling out for HW 1.0 marked 1.3.7. After the upgrade the floodlight become identical in behavior as HW 2.0 (timed mode). Deleting the camera and adding again with the add-on, make the timed switch appears and work as expected.