fishbigger / TapoP100

A module for controlling the TP-Link Tapo P100 Plugs
MIT License
567 stars 139 forks source link

JSON Formatting error on light turn on #46

Closed r00tat closed 2 years ago

r00tat commented 2 years ago

I have been able to setup a bulb and connect it. Turning the bulb off and setting the brightness works, but if I use the switch in homeassistant to turn it on, I'm receiving the following error.

2022-02-02 23:19:18 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [2964029176] Error Code: -1003, JSON formatting error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 494, in async_handle_light_on_service
await light.async_turn_on(**filter_turn_on_params(light, params))
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 948, in async_turn_on
await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/tapo_p100_control/light.py", line 89, in turn_on
self._l530.setBrightness(newBrightness)
File "/usr/local/lib/python3.9/site-packages/PyP100/PyL530.py", line 42, in setBrightness
raise Exception(f"Error Code: {errorCode}, {errorMessage}")
Exception: Error Code: -1003, JSON formatting error
r00tat commented 2 years ago

I've also noticed that changing the brightness does not work a lot. I'm going to troubleshoot this later on.