JurajNyiri / HomeAssistant-Tapo-Control

Control for Tapo cameras as a Home Assistant component
Apache License 2.0
1.13k stars 89 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

Hi,

I see options regarding the LED light (which works),

Where do you see this? Do you have any light entity?

JurajNyiri commented 1 year ago

Please enable debug logs.

logger:
  default: critical
  logs:
    custom_components.tapo_control: debug

Wait until you see "Setting up light for floodlight" and upload the full log here.

Jtupz commented 1 year ago

Thanks for the quick reply, see below:

Hi,

I see options regarding the LED light (which works),

Where do you see this? Do you have any light entity?

The entity is shown in the configuration area of the device, along with "flip", "format SD card" etc. Its named switch.garden_indicator_led

As far as I can see there is no light entity associated with this device.

Please enable debug logs.

logger:
  default: critical
  logs:
    custom_components.tapo_control: debug

Wait until you see "Setting up light for floodlight" and upload the full log here.

Logs below:

2023-08-08 08:35:19.775 DEBUG (MainThread) [custom_components.tapo_control] Setting up light for floodlight 2023-08-08 08:35:19.775 DEBUG (MainThread) [custom_components.tapo_control] Capability getForceWhitelampState not found, querying again... 2023-08-08 08:35:19.775 DEBUG (MainThread) [custom_components.tapo_control] Setting up number for movement angle 2023-08-08 08:35:19.775 DEBUG (MainThread) [custom_components.tapo_control] Capability getPresets not found, querying again...

JurajNyiri commented 1 year ago

Please post full log. The relevant section to help you is not included in the snippet you sent.

Jtupz commented 1 year ago

Setting up light for floodlight

2023-08-08 09:13:20.860 DEBUG (MainThread) [custom_components.tapo_control] Setting up switches 2023-08-08 09:13:20.860 DEBUG (MainThread) [custom_components.tapo_control] Found cached capability getPrivacyMode, creating TapoPrivacySwitch 2023-08-08 09:13:20.860 DEBUG (MainThread) [custom_components.tapo_control] Tapo Privacy - init - start 2023-08-08 09:13:20.860 DEBUG (MainThread) [custom_components.tapo_control] Updating TapoPrivacySwitch to: off 2023-08-08 09:13:20.860 DEBUG (MainThread) [custom_components.tapo_control] Tapo Privacy - init - end 2023-08-08 09:13:20.860 DEBUG (MainThread) [custom_components.tapo_control] Adding tapoPrivacySwitch... 2023-08-08 09:13:20.860 DEBUG (MainThread) [custom_components.tapo_control] Found cached capability getLensDistortionCorrection, creating TapoLensDistortionCorrectionSwitch 2023-08-08 09:13:20.860 DEBUG (MainThread) [custom_components.tapo_control] Tapo Lens Distortion Correction - init - start 2023-08-08 09:13:20.860 DEBUG (MainThread) [custom_components.tapo_control] Tapo Lens Distortion Correction - init - end 2023-08-08 09:13:20.860 DEBUG (MainThread) [custom_components.tapo_control] Adding tapoLensDistortionCorrectionSwitch... 2023-08-08 09:13:20.860 DEBUG (MainThread) [custom_components.tapo_control] Found cached capability getLED, creating TapoIndicatorLedSwitch 2023-08-08 09:13:20.860 DEBUG (MainThread) [custom_components.tapo_control] Tapo Indicator LED - init - start 2023-08-08 09:13:20.860 DEBUG (MainThread) [custom_components.tapo_control] Tapo Indicator LED - init - end 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Adding tapoIndicatorLedSwitch... 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Found cached capability getImageFlipVertical, creating TapoFlipSwitch 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Flip - init - start 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Flip - init - end 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Adding tapoFlipSwitch... 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Capability getAutoTrackTarget not found, querying again... 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Setting up buttons 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Reboot - init - start 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Reboot - init - end 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Format SD Card - init - start 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Format SD Card - init - end 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Found cached capability getAlarm, creating TapoStartManualAlarmButton 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Manual Alarm Start - init - start 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Manual Alarm Start - init - end 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Adding tapoStartManualAlarmButton... 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Found cached capability getAlarm, creating TapoStopManualAlarmButton 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Manual Alarm Stop - init - start 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Manual Alarm Stop - init - end 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Adding tapoStopManualAlarmButton... 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Sync Time - init - start 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Sync Time - init - end 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Capability getPresets not found, querying again... 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Setting up light for floodlight 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Capability getForceWhitelampState not found, querying again... 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Setting up number for movement angle 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Capability getPresets not found, querying again... 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Setting up selects 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Found cached capability getDayNightMode, creating TapoNightVisionSelect 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Night Vision - init - start 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Night Vision - init - append 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Night Vision - init - update 2023-08-08 09:13:20.861 DEBUG (MainThread) [custom_components.tapo_control] Tapo Night Vision - init - TapoEntity 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Night Vision - init - SelectEntity 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Night Vision - init - end 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Adding tapoNightVisionSelect... 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Found cached capability getLightFrequencyMode, creating TapoLightFrequencySelect 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Light Frequency - init - start 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Light Frequency - init - append 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Light Frequency - init - update 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Light Frequency - init - TapoEntity 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Light Frequency - init - SelectEntity 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Light Frequency - init - end 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Adding tapoLightFrequencySelect... 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Found cached capability getAlarm, creating TapoAutomaticAlarmModeSelect 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Automatic Alarm - init - start 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Automatic Alarm - init - append 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Automatic Alarm - init - update 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Automatic Alarm - init - TapoEntity 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Automatic Alarm - init - SelectEntity 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Automatic Alarm - init - end 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Adding tapoAutomaticAlarmModeSelect... 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Found cached capability getMotionDetection, creating TapoMotionDetectionSelect 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Motion Detection - init - start 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Motion Detection - init - append 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Motion Detection - init - update 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] TapoMotionDetectionSelect updateTapo 1 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] TapoMotionDetectionSelect updateTapo 3 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] TapoMotionDetectionSelect updateTapo 4 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] TapoMotionDetectionSelect updateTapo 6 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Updating TapoMotionDetectionSelect to: off 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Motion Detection - init - TapoEntity 2023-08-08 09:13:20.862 DEBUG (MainThread) [custom_components.tapo_control] Tapo Motion Detection - init - SelectEntity 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Motion Detection - init - end 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Adding TapoMotionDetectionSelect... 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Found cached capability getPersonDetection, creating TapoPersonDetectionSelect 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Person Detection - init - start 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Person Detection - init - append 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Person Detection - init - update 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] TapoPersonDetectionSelect updateTapo 1 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] TapoPersonDetectionSelect updateTapo 3 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] TapoPersonDetectionSelect updateTapo 4 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] TapoPersonDetectionSelect updateTapo 6 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Updating TapoPersonDetectionSelect to: off 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Person Detection - init - TapoEntity 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Person Detection - init - SelectEntity 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Person Detection - init - end 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Adding tapoPersonDetectionSelect... 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Found cached capability getVehicleDetection, creating TapoVehicleDetectionSelect 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Vehicle Detection - init - start 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Vehicle Detection - init - append 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Vehicle Detection - init - update 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] TapoVehicleDetectionSelect updateTapo 1 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] TapoVehicleDetectionSelect updateTapo 3 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] TapoVehicleDetectionSelect updateTapo 4 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] TapoVehicleDetectionSelect updateTapo 6 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Updating TapoVehicleDetectionSelect to: off 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Vehicle Detection - init - TapoEntity 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Vehicle Detection - init - SelectEntity 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Vehicle Detection - init - end 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Adding tapoVehicleDetectionSelect... 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Capability getBabyCryDetection not found, querying again... 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Setting up sirens 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Found cached capability getAlarm, creating TapoSiren 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Siren - init - start 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Siren - init - end 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Adding TapoSirenEntity... 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Update - init - start 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Update - init - end 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Setting up binary sensor for motion. 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] EventsListener init 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Adding TapoNoiseBinarySensor... 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] TapoNoiseBinarySensor - init - start 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Noise - init - start 2023-08-08 09:13:20.863 DEBUG (MainThread) [custom_components.tapo_control] Tapo Noise - init - end 2023-08-08 09:13:20.864 DEBUG (MainThread) [custom_components.tapo_control] TapoNoiseBinarySensor - init - end 2023-08-08 09:13:21.161 WARNING (MainThread) [homeassistant.components.camera] Updating xiaomi_cloud_map_extractor camera took longer than the scheduled update interval 0:00:05 2023-08-08 09:13:21.222 INFO (MainThread) [custom_components.tapo_control] Camera does not support TapoAutoTrackSwitch 2023-08-08 09:13:21.222 DEBUG (MainThread) [custom_components.tapo_control] Adding switch entities... 2023-08-08 09:13:21.277 INFO (MainThread) [custom_components.tapo_control] Camera does not support TapoCalibrateButton 2023-08-08 09:13:21.277 INFO (MainThread) [custom_components.tapo_control] Buttons: Camera does not support movement. 2023-08-08 09:13:21.303 INFO (MainThread) [custom_components.tapo_control] Camera does not support TapoFloodlight 2023-08-08 09:13:21.360 INFO (MainThread) [custom_components.tapo_control] Camera does not support TapoMovementAngle 2023-08-08 09:13:21.365 INFO (MainThread) [custom_components.tapo_control] Camera does not support TapoBabyCryDetectionSelect 2023-08-08 09:13:21.365 DEBUG (MainThread) [custom_components.tapo_control] Capability getPetDetection not found, querying again... 2023-08-08 09:13:21.489 INFO (MainThread) [custom_components.tapo_control] Camera does not support TapoPetDetectionSelect 2023-08-08 09:13:21.489 DEBUG (MainThread) [custom_components.tapo_control] Capability getBarkDetection not found, querying again... 2023-08-08 09:13:21.569 INFO (MainThread) [custom_components.tapo_control] Camera does not support TapoBarkDetectionSelect 2023-08-08 09:13:21.570 DEBUG (MainThread) [custom_components.tapo_control] Capability getMeowDetection not found, querying again... 2023-08-08 09:13:21.670 INFO (MainThread) [custom_components.tapo_control] Camera does not support TapoMeowDetectionSelect 2023-08-08 09:13:21.670 DEBUG (MainThread) [custom_components.tapo_control] Capability getGlassBreakDetection not found, querying again... 2023-08-08 09:13:21.776 INFO (MainThread) [custom_components.tapo_control] Camera does not support TapoGlassBreakDetectionSelect 2023-08-08 09:13:21.776 DEBUG (MainThread) [custom_components.tapo_control] Found cached capability getTamperDetection, creating TapoTamperDetectionSelect 2023-08-08 09:13:21.776 DEBUG (MainThread) [custom_components.tapo_control] Tapo Tamper Detection - init - start 2023-08-08 09:13:21.776 DEBUG (MainThread) [custom_components.tapo_control] Tapo Tamper Detection - init - append 2023-08-08 09:13:21.776 DEBUG (MainThread) [custom_components.tapo_control] Tapo Tamper Detection - init - update 2023-08-08 09:13:21.776 DEBUG (MainThread) [custom_components.tapo_control] TapoTamperDetectionSelect updateTapo 1 2023-08-08 09:13:21.777 DEBUG (MainThread) [custom_components.tapo_control] TapoTamperDetectionSelect updateTapo 3 2023-08-08 09:13:21.777 DEBUG (MainThread) [custom_components.tapo_control] TapoTamperDetectionSelect updateTapo 5 2023-08-08 09:13:21.777 DEBUG (MainThread) [custom_components.tapo_control] TapoTamperDetectionSelect updateTapo 6 2023-08-08 09:13:21.777 DEBUG (MainThread) [custom_components.tapo_control] Updating TapoTamperDetectionSelect to: high 2023-08-08 09:13:21.777 DEBUG (MainThread) [custom_components.tapo_control] Tapo Tamper Detection - init - TapoEntity 2023-08-08 09:13:21.777 DEBUG (MainThread) [custom_components.tapo_control] Tapo Tamper Detection - init - SelectEntity 2023-08-08 09:13:21.777 DEBUG (MainThread) [custom_components.tapo_control] Tapo Tamper Detection - init - end 2023-08-08 09:13:21.777 DEBUG (MainThread) [custom_components.tapo_control] Adding tapoTamperDetectionSelect... 2023-08-08 09:13:21.777 DEBUG (MainThread) [custom_components.tapo_control] Capability getPresets not found, querying again... 2023-08-08 09:13:21.891 INFO (MainThread) [custom_components.tapo_control] Camera does not support TapoMoveToPresetSelect 2023-08-08 09:13:21.891 DEBUG (MainThread) [custom_components.tapo_control] Capability getPresets not found, querying again... 2023-08-08 09:13:22.112 INFO (MainThread) [custom_components.tapo_control] Camera does not support TapoPatrolModeSelect

It mentioned the camera does not support floodlight, but it has a floodlight and it can be controlled in the Tapo app.

JurajNyiri commented 1 year ago

Thank you.

That means the app is controlling the light in a different way. Someone who owns this camera will need to inspect the communication between the camera and app and document the calls, then I can make an update to the integration.

Jtupz commented 1 year ago

Thanks again, understood.

I am happy to do this if its something you are able to assist me with?

fredrikhaggbom commented 1 year ago

I can (probably) help with inspecting the app traffic if necessary. However, I have a C320WS and I can control the floodlight in HA (a light entity is created). I have latest firmware on the camera, 1.3.0. @Jtupz Have I understood correctly that you do not see any floodlight control at all in your integration? When I go to Settings -> Devices & Services -> Tapo: Cameras Control -> "1 device", I can see Floodlight in the "Controls" card.

Jtupz commented 1 year ago

I can (probably) help with inspecting the app traffic if necessary. However, I have a C320WS and I can control the floodlight in HA (a light entity is created). I have latest firmware on the camera, 1.3.0. @Jtupz Have I understood correctly that you do not see any floodlight control at all in your integration? When I go to Settings -> Devices & Services -> Tapo: Cameras Control -> "1 device", I can see Floodlight in the "Controls" card.

Correct, the only entities I see under the control section are:

Manual Alarm Set (button press) Manual Alarm Stop (button Press) Privacy (switch) Siren (switch)

Any help would be greatly appreciated!

fredrikhaggbom commented 1 year ago

@Jtupz Well, I did look at the traffic between app -> camera, but since it already works for me I doubt that it will help... However, can you please perform these steps and post the response from the last curl request:

  1. Go to https://coding.tools/md5 and enter the password you've set up as device account for the camera. Copy the MD5 hashed value.

  2. Perform this request and copy stok from the result (needed in next step). Make sure to replace the password value with the hash from step 1, and the IP with the actual (local) ip of the camera:

    curl -i -s -k -X $'POST' \
    -H $'Content-Type: application/json'-H $'Accept-Encoding: gzip, deflate' \
    --data-binary $'{\"method\":\"login\",\"params\":{\"username\":\"admin\",\"password\":\"YOUR-MD5-HASH\"}}' \
    $'https://YOUR-CAMERAIP/'
  3. Perform this request. Replace IP with the local IP of your camera and "STOK-FROM-PREV-REQUEST" with the stok you received earlier:

    curl -i -s -k -X $'POST' \
    -H $'Content-Type: application/json' \
    --data-binary $'{\"method\":\"multipleRequest\",\"params\":{\"requests\":[{\"method\": \"getLdc\",\"params\": {\"image\": {\"name\": [\"switch\", \"common\"]}},},]}}' \
    $'https://YOUR-CAMERAIP/stok=STOK-FROM-PREV-REQUEST/ds'

Post the result from the last request.

fuzzybear62 commented 1 year ago

I have several CW320WS, some HW 1.0 FW 1.3.0 that runs flawless, instead HW 2.0 FW 1.0.5 expose a less quality image sensor and different behavior on services like siren and alarm and floodlight. I hope will help the output of the curl command suggested above:

HW 2.0 FW 1.0.5

HTTP/1.1 200 OK Connection: close Cache-Control: no-cache Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked

{"result":{"responses":[{"method":"getLdc","result":{"image":{"switch":{"schedule_end_time":"64800","schedule_start_time":"21600","clear_licence_plate_mode":"off","switch_mode":"common","rotate_type":"off","flip_type":"off","ldc":"off","night_vision_mode":"md_night_vision","full_color_people_enhance":"off","full_color_min_keep_time":"5","wtl_intensity_level":"3","wtl_force_time":"300","overexposure_people_suppression":"off","best_view_distance":"0","image_scene_mode":"normal","image_scene_mode_common":"normal","image_scene_mode_shedday":"normal","image_scene_mode_shednight":"normal","image_scene_mode_autoday":"normal","image_scene_mode_autonight":"normal"},"common":{"chroma":"50","luma":"50","sharpness":"50","saturation":"50","contrast":"50","inf_delay":"5","wd_gain":"50","exp_gain":"0","smartir_level":"0","auto_exp_gain_max":"0","wb_R_gain":"50","wb_B_gain":"50","wb_G_gain":"50","wtl_sensitivity":"4","wtl_delay":"5","wtl_sensitivity_day2night":"1400","wtl_sensitivity_night2day":"9100","iris_level":"160","lock_red_gain":"0","lock_gr_gain":"0","lock_gb_gain":"0","lock_blue_gain":"0","lock_red_colton":"0","lock_green_colton":"0","lock_blue_colton":"0","focus_limited":"10","inf_start_time":"64800","inf_end_time":"21600","wtl_start_time":"64800","wtl_end_time":"21600","inf_sensitivity_day2night":"1400","inf_sensitivity_night2day":"9100","wide_dynamic":"off","high_light_compensation":"off","dehaze":"off","eis":"off","auto_exp_antiflicker":"off","inf_type":"auto","inf_sensitivity":"4","wtl_type":"auto","backlight":"off","area_compensation":"default","smartir":"auto_ir","exp_type":"auto","exp_level":"0","shutter":"1\/25","style":"original","focus_type":"manual","wb_type":"auto","lock_source":"local","smartwtl":"auto_wtl","smartwtl_level":"5","smartwtl_digital_level":"100","light_freq_mode":"auto"}}},"error_code":0}]},"error_code":0}

HW 1.0 FW 1.3.0

HTTP/1.1 200 OK Connection: keep-alive Content-Type: application/json Cache-Control: no-cache Expires: 0 Transfer-Encoding: chunked

{ "result": { "responses": [ { "method": "getLdc", "result": { "image": { "switch": { ".name": "switch", ".type": "switch_type", "switch_mode": "common", "schedule_start_time": "21600", "schedule_end_time": "64800", "flip_type": "off", "rotate_type": "off", "ldc": "off", "night_vision_mode": "inf_night_vision", "wtl_intensity_level": "5", "force_wtl_state": "off", "lct_style_enable": "1" }, "common": { ".name": "common", ".type": "para", "luma": "50", "contrast": "50", "chroma": "50", "saturation": "50", "sharpness": "50", "exp_type": "auto", "shutter": "1\/25", "focus_type": "semi_auto", "focus_limited": "600", "exp_gain": "0", "inf_type": "auto", "inf_start_time": "64800", "inf_end_time": "21600", "inf_sensitivity": "4", "inf_delay": "5", "wide_dynamic": "off", "light_freq_mode": "auto", "wd_gain": "50", "wb_type": "auto", "wb_R_gain": "50", "wb_G_gain": "50", "wb_B_gain": "50", "lock_red_gain": "0", "lock_gr_gain": "0", "lock_gb_gain": "0", "lock_blue_gain": "0", "lock_red_colton": "0", "lock_green_colton": "0", "lock_blue_colton": "0", "lock_source": "local", "area_compensation": "default", "smartir": "off", "smartir_level": "100", "high_light_compensation": "off", "dehaze": "off" } } }, "error_code": 0 } ] }, "error_code": 0 }

Let me know if could help with other tests

fredrikhaggbom commented 1 year ago

Thanks @fuzzybear62! I'm not really entirely familiar with the code of this project, but from what I can see, HW 2.0 does not have property "force_wtl_state" in the getLdc result. I think that's the property used for creating the floodlight entity. Is this correct, @JurajNyiri? Not sure which property to use instead on hw 2.0...

JurajNyiri commented 1 year ago

Please turn on the light and post the result, then turn off the light and post the result.

fredrikhaggbom commented 1 year ago

Yes, please post result from when lamp is off and then on, but please use this request instead of the one in step 4 above:

curl -i -s -k -X $'POST' \
    -H $'Content-Type: application/json' \
    --data-binary $'{\"method\":\"multipleRequest\",\"params\":{\"requests\":[{\"method\": \"getLdc\",\"params\": {\"image\": {\"name\": [\"switch\", \"common\"]}}},{\"method\":\"getForceWhitelampState\",\"params\":{\"image\":{\"name\":\"switch\"}}},{\"method\":\"getWhitelampConfig\",\"params\":{\"image\":{\"name\":\"switch\"}}}]}}' \
    $'https://YOUR-CAMERAIP/stok=STOK-FROM-PREV-REQUEST/ds'
fuzzybear62 commented 1 year ago

Flood ligh OFF

HTTP/1.1 200 OK Connection: close Cache-Control: no-cache Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked

{"result":{"responses":[{"method":"getLdc","result":{"image":{"switch":{"schedule_end_time":"64800","schedule_start_time":"21600","clear_licence_plate_mode":"off","switch_mode":"common","rotate_type":"off","flip_type":"off","ldc":"off","night_vision_mode":"md_night_vision","full_color_people_enhance":"off","full_color_min_keep_time":"5","wtl_intensity_level":"3","wtl_force_time":"300","overexposure_people_suppression":"off","best_view_distance":"0","image_scene_mode":"normal","image_scene_mode_common":"normal","image_scene_mode_shedday":"normal","image_scene_mode_shednight":"normal","image_scene_mode_autoday":"normal","image_scene_mode_autonight":"normal"},"common":{"chroma":"50","luma":"50","sharpness":"50","saturation":"50","contrast":"50","inf_delay":"5","wd_gain":"50","exp_gain":"0","smartir_level":"0","auto_exp_gain_max":"0","wb_R_gain":"50","wb_B_gain":"50","wb_G_gain":"50","wtl_sensitivity":"4","wtl_delay":"5","wtl_sensitivity_day2night":"1400","wtl_sensitivity_night2day":"9100","iris_level":"160","lock_red_gain":"0","lock_gr_gain":"0","lock_gb_gain":"0","lock_blue_gain":"0","lock_red_colton":"0","lock_green_colton":"0","lock_blue_colton":"0","focus_limited":"10","inf_start_time":"64800","inf_end_time":"21600","wtl_start_time":"64800","wtl_end_time":"21600","inf_sensitivity_day2night":"1400","inf_sensitivity_night2day":"9100","wide_dynamic":"off","high_light_compensation":"off","dehaze":"off","eis":"off","auto_exp_antiflicker":"off","inf_type":"auto","inf_sensitivity":"4","wtl_type":"auto","backlight":"off","area_compensation":"default","smartir":"auto_ir","exp_type":"auto","exp_level":"0","shutter":"1\/25","style":"original","focus_type":"manual","wb_type":"auto","lock_source":"local","smartwtl":"auto_wtl","smartwtl_level":"5","smartwtl_digital_level":"100","light_freq_mode":"auto"}}},"error_code":0},{"method":"getForceWhitelampState","result":{},"error_code":-40210},{"method":"getWhitelampConfig","result":{"image":{"switch":{"schedule_end_time":"64800","schedule_start_time":"21600","clear_licence_plate_mode":"off","switch_mode":"common","rotate_type":"off","flip_type":"off","ldc":"off","night_vision_mode":"md_night_vision","full_color_people_enhance":"off","full_color_min_keep_time":"5","wtl_intensity_level":"3","wtl_force_time":"300","overexposure_people_suppression":"off","best_view_distance":"0","image_scene_mode":"normal","image_scene_mode_common":"normal","image_scene_mode_shedday":"normal","image_scene_mode_shednight":"normal","image_scene_mode_autoday":"normal","image_scene_mode_autonight":"normal"}}},"error_code":0}]},"error_code":0}

Floodlight ON

HTTP/1.1 200 OK Connection: close Cache-Control: no-cache Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked

{"result":{"responses":[{"method":"getLdc","result":{"image":{"switch":{"schedule_end_time":"64800","schedule_start_time":"21600","clear_licence_plate_mode":"off","switch_mode":"common","rotate_type":"off","flip_type":"off","ldc":"off","night_vision_mode":"md_night_vision","full_color_people_enhance":"off","full_color_min_keep_time":"5","wtl_intensity_level":"3","wtl_force_time":"300","overexposure_people_suppression":"off","best_view_distance":"0","image_scene_mode":"normal","image_scene_mode_common":"normal","image_scene_mode_shedday":"normal","image_scene_mode_shednight":"normal","image_scene_mode_autoday":"normal","image_scene_mode_autonight":"normal"},"common":{"chroma":"50","luma":"50","sharpness":"50","saturation":"50","contrast":"50","inf_delay":"5","wd_gain":"50","exp_gain":"0","smartir_level":"0","auto_exp_gain_max":"0","wb_R_gain":"50","wb_B_gain":"50","wb_G_gain":"50","wtl_sensitivity":"4","wtl_delay":"5","wtl_sensitivity_day2night":"1400","wtl_sensitivity_night2day":"9100","iris_level":"160","lock_red_gain":"0","lock_gr_gain":"0","lock_gb_gain":"0","lock_blue_gain":"0","lock_red_colton":"0","lock_green_colton":"0","lock_blue_colton":"0","focus_limited":"10","inf_start_time":"64800","inf_end_time":"21600","wtl_start_time":"64800","wtl_end_time":"21600","inf_sensitivity_day2night":"1400","inf_sensitivity_night2day":"9100","wide_dynamic":"off","high_light_compensation":"off","dehaze":"off","eis":"off","auto_exp_antiflicker":"off","inf_type":"auto","inf_sensitivity":"4","wtl_type":"auto","backlight":"off","area_compensation":"default","smartir":"auto_ir","exp_type":"auto","exp_level":"0","shutter":"1\/25","style":"original","focus_type":"manual","wb_type":"auto","lock_source":"local","smartwtl":"auto_wtl","smartwtl_level":"5","smartwtl_digital_level":"100","light_freq_mode":"auto"}}},"error_code":0},{"method":"getForceWhitelampState","result":{},"error_code":-40210},{"method":"getWhitelampConfig","result":{"image":{"switch":{"schedule_end_time":"64800","schedule_start_time":"21600","clear_licence_plate_mode":"off","switch_mode":"common","rotate_type":"off","flip_type":"off","ldc":"off","night_vision_mode":"md_night_vision","full_color_people_enhance":"off","full_color_min_keep_time":"5","wtl_intensity_level":"3","wtl_force_time":"300","overexposure_people_suppression":"off","best_view_distance":"0","image_scene_mode":"normal","image_scene_mode_common":"normal","image_scene_mode_shedday":"normal","image_scene_mode_shednight":"normal","image_scene_mode_autoday":"normal","image_scene_mode_autonight":"normal"}}},"error_code":0}]},"error_code":0}

fredrikhaggbom commented 1 year ago

The responses are identical which I guess means that HW 2.0 handles the floodlight in a totally separate call then the HW 1.0 camera. I think we need to go back to @JurajNyiri original request: someone needs to trace the app traffic to see the request used for toggling/handling floodlight in the HW 2 camera. This can be done fairly easy for example using Burp suite.

Jtupz commented 1 year ago

@Jtupz Well, I did look at the traffic between app -> camera, but since it already works for me I doubt that it will help... However, can you please perform these steps and post the response from the last curl request:

  1. Go to https://coding.tools/md5 and enter the password you've set up as device account for the camera. Copy the MD5 hashed value.
  2. Perform this request and copy stok from the result (needed in next step). Make sure to replace the password value with the hash from step 1, and the IP with the actual (local) ip of the camera:
curl -i -s -k -X $'POST' \
    -H $'Content-Type: application/json'-H $'Accept-Encoding: gzip, deflate' \
    --data-binary $'{\"method\":\"login\",\"params\":{\"username\":\"admin\",\"password\":\"YOUR-MD5-HASH\"}}' \
    $'https://YOUR-CAMERAIP/'
  1. Perform this request. Replace IP with the local IP of your camera and "STOK-FROM-PREV-REQUEST" with the stok you received earlier:
curl -i -s -k -X $'POST' \
    -H $'Content-Type: application/json' \
    --data-binary $'{\"method\":\"multipleRequest\",\"params\":{\"requests\":[{\"method\": \"getLdc\",\"params\": {\"image\": {\"name\": [\"switch\", \"common\"]}},},]}}' \
    $'https://YOUR-CAMERAIP/stok=STOK-FROM-PREV-REQUEST/ds'

Post the result from the last request.

I have the MD5 and IP address ready, but where should I be performing these actions?

To add to this, the service request for the sirens do not work for me:

_Failed to call service button/press. Error: Parameter to get/do does not exist, Response: {"errorcode": -40106}

fuzzybear62 commented 1 year ago

HW 2.0 FW 1.0.5 Protocol

HW2.0_protocol.txt

This is a simple shell script I used to verify the commands:

echo "\n\n\n================ Config\n" curl -i -s -k -X $'POST' \ -H $'Content-Type: application/json' \ --data-binary $'{"method":"multipleRequest","params":{"requests":[{"method":"getWhitelampConfig","params":{"image":{"name":"switch"}}}]}}' \ $'https://YOUR-IP/stok=YOUR-STOK/ds' echo "\n\n\n================ Status\n" curl -i -s -k -X $'POST' \ -H $'Content-Type: application/json' \ --data-binary $'{"method":"multipleRequest","params":{"requests":[{"method":"getWhitelampStatus","params":{"image":{"get_wtl_status":["null"]}}}]}}' \ $'https://YOUR-IP/stok=YOUR-STOK/ds' echo "\n\n\n================ Switch State\n" curl -i -s -k -X $'POST' \ -H $'Content-Type: application/json' \ --data-binary $'{"method":"multipleRequest","params":{"requests":[{"method":"reverseWhitelampStatus","params":{"image":{"reverse_wtl_status":["null"]}}}]}}' \ $'https://YOUR-IP/stok=YOUR-STOK/ds' echo "\n\n\n================ Status\n" curl -i -s -k -X $'POST' \ -H $'Content-Type: application/json' \ --data-binary $'{"method":"multipleRequest","params":{"requests":[{"method":"getWhitelampStatus","params":{"image":{"get_wtl_status":["null"]}}}]}}' \ $'https://YOUR-IP/stok=YOUR-STOK/ds'

On the app there isn't a button for siren, so I don't know how to activate/deactivate

If needed I can capture more protocol calls

JurajNyiri commented 1 year ago

@fuzzybear62 could you please also provide responses there? I need those to make adjustments to the code. Especially with the lamp statuses, please document also when it was ON, when OFF etc. Please also add request to turn on/off the lamp. What is reverseWhiteLamp and whiteLamp?

fuzzybear62 commented 1 year ago

command_and_output.txt

There is no On or Off call, buth toggle. So you have to obtain status (as in my example) and then take the correct action on that

reverseWhiteLamp toggle the status On/Off

Upon app configuration the lamp will stay on for "X" seconds (user's choice in app) and with light intensity (user's choice in app) that I suppose are "wtl_intensity_level":"3","wtl_force_time":"300" in the status query

JurajNyiri commented 1 year ago

I see "getWhitelampStatus","result":{"status":1, in both requests even after executing the reverse. How does this work? What is the value when the lamp is ON and what is the value when lamp is OFF?

Could you please also gather calls for setting the intensity and time and take screenshots from the app how it looks like and all the options?

fuzzybear62 commented 1 year ago

"result":{"rest_time":300,"status":1} LAMP in ON "result":{"rest_time":0,"status":0} LAMP is OFF

With HW 2.0 the lamp behavior depends on the Night mode settings that are IR, Color and "Intelligent". Mine are settled up to "intelligent" and the commands refer to that setting. For sure I can dig for each option, but I need some time. I'll post here as soon I've done.

fuzzybear62 commented 1 year ago

Here a near complete protocol for HW 2.0 and 1.0.5 FW HW2.0_protocol.txt

and here the input/output json for many commands C320WS_HW2.0_Protocol.json.txt

the response for the set command it seems always the same I don't belive that you would replicate the full app in HA and keep in mind that is on the market the HW 2.2 (I do not have one of this batch) but if you need some other output I'll do in the spare time

JurajNyiri commented 1 year ago

Thank you, this is great. I will try to implement this soon.

JurajNyiri commented 1 year ago

@fuzzybear62 released pytapo 3.2.2

Please install it using pip install pytapo==3.2.2. Then create following file

from pytapo import Tapo

# Camera
user = "admin"  # admin user
password = ""  # cloud password
host = ""  # ip of the camera, example: 192.168.1.52

tapo = Tapo(host, user, password, password)

print(tapo.getMost())
print(tapo.getWhitelampStatus())
print(tapo.reverseWhitelampStatus())
print(tapo.getWhitelampStatus())
print(tapo.reverseWhitelampStatus())
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(300))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(600))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(False, 3))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(False, 4))
print(tapo.getWhitelampConfig())

And post results, this should verify all the new functionality in 3.2.1. Once we verify it works I can do changes to HA integration.

JurajNyiri commented 1 year ago

@fuzzybear62 also please post all the possible choices in the app for intensityLevel and forceTime of the light so that these can be replicated in HA as well.

fuzzybear62 commented 1 year ago

Il gio 17 ago 2023, 13:01 Juraj Nyíri @.***> ha scritto:

@fuzzybear62 https://github.com/fuzzybear62 also please post all the possible choices in the app for intensityLevel and forceTime of the light so that these can be replicated in HA as well.

— Reply to this email directly, view it on GitHub https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues/377#issuecomment-1682077241, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIXEEPZY2FWY6NPXBSW2GCDXVX22LANCNFSM6AAAAAA3HO7QEA . You are receiving this because you were mentioned.Message ID: @.***>

fuzzybear62 commented 1 year ago

I'll be able todo this evening

Il gio 17 ago 2023, 13:00 Juraj Nyíri @.***> ha scritto:

@fuzzybear62 https://github.com/fuzzybear62 released pytapo 3.2.1

Please install it using pip install pytapo==3.2.1. Then create following file

from pytapo import Tapo

Camera

user = "admin" # admin user password = "" # cloud password host = "" # ip of the camera, example: 192.168.1.52

tapo = Tapo(host, user, password, password)

print(tapo.getMost()) print(tapo.getWhitelampStatus()) print(tapo.reverseWhitelampStatus()) print(tapo.getWhitelampStatus()) print(tapo.reverseWhitelampStatus()) print(tapo.getWhitelampConfig()) print(tapo.setWhitelampConfig(300)) print(tapo.getWhitelampConfig()) print(tapo.setWhitelampConfig(600)) print(tapo.getWhitelampConfig()) print(tapo.setWhitelampConfig(False, 3)) print(tapo.getWhitelampConfig()) print(tapo.setWhitelampConfig(False, 4)) print(tapo.getWhitelampConfig())

And post results, this should verify all the new functionality in 3.2.1. Once we verify it works I can do changes to HA integration.

— Reply to this email directly, view it on GitHub https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues/377#issuecomment-1682075802, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIXEEP2BKX6DDV7WA7SV4BDXVX2V5ANCNFSM6AAAAAA3HO7QEA . You are receiving this because you were mentioned.Message ID: @.***>

fredrikhaggbom commented 1 year ago

@JurajNyiri Great! I think this should be set to "intensityLevel" and not "forceTime" (line 491): https://github.com/JurajNyiri/pytapo/blob/c1f5b68b2242d7d1f6b32ea99f96a631b509d03c/pytapo/__init__.py#L491C64-L491C73

JurajNyiri commented 1 year ago

Nice catch! Fixed.

fuzzybear62 commented 1 year ago

Here a near complete protocol for HW 2.0 and 1.0.5 FW HW2.0_protocol.txt

and here the input/output json for many commands C320WS_HW2.0_Protocol.json.txt

the response for the set command it seems always the same I don't belive that you would replicate the full app in HA and keep in mind that is on the market the HW 2.2 (I do not have one of this batch) but if you need some other output I'll do in the spare time

fuzzybear62 commented 1 year ago

photo_2023-08-17 13 49 05 photo_2023-08-17 13 48 57

JurajNyiri commented 1 year ago

@fuzzybear62 thank you, released pytapo 3.2.2

Please install it using pip install pytapo==3.2.2. Then create following file

from pytapo import Tapo

# Camera
user = "admin"  # admin user
password = ""  # cloud password
host = ""  # ip of the camera, example: 192.168.1.52

tapo = Tapo(host, user, password, password)

print(tapo.getMost())
print(tapo.getWhitelampStatus())
print(tapo.reverseWhitelampStatus())
print(tapo.getWhitelampStatus())
print(tapo.reverseWhitelampStatus())
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(300))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(600))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(False, 3))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(False, 4))
print(tapo.getWhitelampConfig())

And post results, this should verify all the new functionality in 3.2.1. Once we verify it works I can do changes to HA integration.

fuzzybear62 commented 1 year ago

Done output.txt

JurajNyiri commented 1 year ago

Thank you! Looks like wtl_intensity_level did not change.

print(tapo.setWhitelampConfig(False, 1))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(False, 2))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(False, 3))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(False, 4))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(False, 5))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(300, 1))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(600, 2))
print(tapo.getWhitelampConfig())

Could you please try again? Make sure that you are using 3.2.2 as there was a bug in 3.2.1.

fuzzybear62 commented 1 year ago

"Collecting pytapo==3.2.2" pretty sure :-)

Confirm that time is set, but luminosity is not

Manually with this command:

{"method":"multipleRequest","params":{"requests":[{"method":"setWhitelampConfig","params":{"image":{"switch":{"wtl_force_time":"1800","wtl_intensity_level":"4"}}}}]}}

it works

JurajNyiri commented 1 year ago

Could you please try the commands I sent above and post output?

fuzzybear62 commented 1 year ago

I have tested the last command you sent. And also checked on the camera. This is the output output_second.txt

JurajNyiri commented 1 year ago

Thank you, this was helpful, the only difference I see it expects a string and we were sending in an integer.

Please download 3.2.3 and run this again and send output, should work at least partially now.

print(tapo.setWhitelampConfig(False, 1))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(False, 2))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(False, 3))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(False, 4))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(False, 5))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(300, 1))
print(tapo.getWhitelampConfig())
print(tapo.setWhitelampConfig(600, 2))
print(tapo.getWhitelampConfig())
fuzzybear62 commented 1 year ago

It works output_third.txt

JurajNyiri commented 1 year ago

@fuzzybear62 @Jtupz please download manually https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/archive/refs/heads/reverseLight.zip and follow manual installation steps or install 5.3.0.beta.6.

Then enable debug logs.

logger:
  default: critical
  logs:
    custom_components.tapo_control: debug

You should now see a new button entity Toggle Spotlight and 2 select entites - Spotlight Intensity and Spotlight on/off for. I had no way how to test this so it will probably not work, let me know and upload debug logs if it is not working. Selects should be automatically reflecting also settings in the app, and setting it once selected. Button should be toggling the spotlight.

Follow up question: Can you try setting forceTime to something that is not supported by the app? For example print(tapo.setWhitelampConfig(10, 2)) or print(tapo.setWhitelampConfig(3600, 2)), does it actually set it and work? If yes, try a lot higher numbers to see if there is a limit.

fuzzybear62 commented 1 year ago

I've already tested to send values out of boundaries for time and luminosity, and they are ignored. The only values admited are those in the limit I wrote on the doc

My istance of HA is managing my house, and I'll prefer to maintain the status of production system. How can I test without messing up the running installation?

JurajNyiri commented 1 year ago

You could spin up another instance of HA. Or you could test and if something is broken roll back to stable 5.2.4. I am running BETA versions of this integration myself in my house so you could consider it kind of stable. Go with beta.6 I just released, there is not much that could go wrong (worst case you do not see new entities) and worst case you rollback and restart.

fuzzybear62 commented 1 year ago

Sorry, but I've no time to start up another HA. Have you put this version on HACS marked as beta?

JurajNyiri commented 1 year ago

Yes, you can download it here: https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/releases/tag/5.3.0.beta.6 See https://hacs.xyz/docs/faq/beta/

JurajNyiri commented 1 year ago

Interesting, I have just found that C200 HW 3.0 "supports" this spotlight - it turns on little white LED, but there is no force time! It also ignores setting for intensity even if it reports "5".

fuzzybear62 commented 1 year ago

I'll candidate myself to manage their dev team :-)

JurajNyiri commented 1 year ago

Haha. Unfortunately that means that I am still not able to test this fully - but the entities are there so it should work for you. Let me know how it goes.

JurajNyiri commented 1 year ago

Released 5.3.0.beta.7 based on what I learned from C200 HW3.0.

@fuzzybear62 What is left to test:

fuzzybear62 commented 1 year ago

I've tested the beta6 and it works for luminosity, time and toggle. There is a glitch in the tapo app when you change the time the goes in loop, but I'll investigate later.

Let my test the 7th before sending the logs