petretiandrea / plugp100

Work in progress implementation of tapo protocol in python.
GNU General Public License v3.0
72 stars 27 forks source link

TapoError.ERR_PARAMS when brightness value is 1 #101

Closed zanna-37 closed 1 year ago

zanna-37 commented 1 year ago

I'm using a Tapo L520. And the following service call returns an error. Other brightness values work as expected.

service: light.turn_on
data:
  brightness: 1
target:
  entity_id: light.back_terrace_light

The error is: Unexpected error for call_service at pos 1: Returned error_code: TapoError.ERR_PARAMS: Request params error

zanna-37 commented 1 year ago

The error has now changed after the latest release. Now I have


websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 'NoneType' object has no attribute 'map'
Traceback (most recent call last):
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/helpers/script.py", line 468, in _async_step
    await getattr(self, handler)()
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/helpers/script.py", line 703, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/helpers/script.py", line 665, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/core.py", line 1974, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/core.py", line 2011, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/helpers/service.py", line 870, in entity_service_call
    response_data = await _handle_entity_call(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/helpers/service.py", line 942, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/components/light/__init__.py", line 580, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/config/custom_components/tapo/light.py", line 166, in async_turn_on
    await self._change_brightness(brightness)
  File "/config/custom_components/tapo/light.py", line 193, in _change_brightness
    await self.coordinator.device.set_brightness(brightness_to_set)
  File "/config/lsiopy/lib/python3.11/site-packages/plugp100/api/light_device.py", line 53, in set_brightness
    return await self._api.set_device_info(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/lsiopy/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 111, in set_device_info
    return await self._set_device_info(dataclass_encode_json(device_info))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/lsiopy/lib/python3.11/site-packages/plugp100/api/tapo_client.py", line 199, in _set_device_info
    return response.map(lambda _: True)
           ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'map'
petretiandrea commented 1 year ago

This issue is related to Home Assistant not library