Giter VIP home page Giter VIP logo

home-assistant-tapo-p100's Introduction

Home Assistant Tapo Integration

This is a custom integration to control Tapo devices from home assistant.

The core of the integration is provided by plugp100 python library based on the work of @K4CZP3R.

Stable Release hacs Project Maintenance License BuyMeCoffee

Please help me to complete the new roadmap

Sponsors

Gold Sponsors

Silver Sponsors

James Mac

Warnings

Tapo protocol

Tapo is updating its devices with a new firmware which use a new protocol called KLAP. This integration supports it but if you run an older version your devices may not work. Please keep this integration up to date by using HACS!

Local Integration

Although the integration works using LAN, the tapo device needs internet access to synchronize with tapo cloud, especially for credentials, a missing internet access could lead into "Invalid authentication error". A static IP must be set for device.

Authentication

For some unknown reason email with capital letters throw an "Invalid authentication" error. Before opening a new issue check your email address on Tapo App Settings. If your email contains capital letters, the integration won't work. I've opened an issue that explains this #122, I will fix asap. As a workaround you can create a new account using all lower-case in your email address.

Features

Discovery

The integration now supports native tapo discovery! To enable it you must add at least one tapo device or this line to your tapo configuration file

tapo:
  discovery: true # you can omit "discovery" by default, using "tapo:" will enable discovery automatically.

This will enable tapo device discovery. Not all tapo devices support tapo discovery, so if you can't find a device, try adding it manually. Tapo integration discovery filters out unsupported devices!

Screenshot

Discovery

You can disable integration discovery by editing configuration.yaml in the following way:

tapo:
  discovery: false

Device IP Tracking

When using DHCP home assistant discovery the feature of mac address tracking is now disabled, as HA now automatically tracks mac addresses now. Please be sure to have DHCP discovery enabled on your configuration.yaml (enabled by default).

[BREAKING] Tracking mac address feature is now disabled as it is not recommended by HA. Tracking is now performed by HA itself.

Supported devices

  • pure async home assistant's method
  • support for tapo H100 hub and siren
  • support for tapo H200 hub is currently Work In Progress!
  • support for T31x temperature and humidity sensor hub's device
  • support for T100 motion sensor hub's device
  • support for T110 smart door hub's device
  • support for S220, S210 switch hub's device
  • partial support for S200B button hub's device (actually no events are reported to HA)
  • support for tapo powerstrip (P300). A special thanks go to @alxlk to support me with max one-time contribution which allows me to buy the device
  • support for tapo switch (P100, P110, P105, P115, P125, P110M)
  • support for tapo light bulb with or without color (L530, L510, L520, L630, L610, L530B, L530E)
  • support for tapo light strip with or without color (L900)
  • partial support for tapo light strip (L920, L930 (including light effects)). Only RGB works not the addressable feature of strip.
  • support for energy monitoring (P110, P115, P110M)
  • support for tapo light switches with or without the dimmer (S500, S500d, S505d)
  • support for KE100 by @delatt
  • support for additional tapo sensors: overheat and wifi_signal
  • allow configuration from home assistant UI with config flow
  • allow configuration from configuration.yaml. supported domains are switch, light, sensor

Additional features

  • manually change ip address. Now you can change the ip address of a tapo device without removing and re-adding it.
  • Diagnostic settings
  • Firmware update control

How to install

This integration is part of HACS store, so you don't need to add this repository as a custom repository any more. You can find it directly on HACS Store: search for tapo and you will find Tapo Controller. (HACS >= 1.6.0 is required)

This video shows installation steps:

Install Steps

How to add a Tapo device (after installing the integration)

Using UI

  1. Be sure the integration is installed successfully
  2. Go to integrations menu
  3. Search for Tapo integration
  4. Insert host (ip address), username and password for control your tapo device (the same used for tapo app). If you have a problem in this phase, like "invalid auth" error, please see #122, and if error persists write a comment in the same issue
  5. Wait for connection. The integration will automatically recognize if the tapo device is a switch or light or something else :)

Configuration by configuration.yaml

[BREAKING]

The latest version of this integration removes configuration.yaml device configuration support. This is to follow home assistant best practices https://developers.home-assistant.io/docs/configuration_yaml_index/ and https://github.com/home-assistant/architecture/blob/master/adr/0010-integration-configuration.md#decision

Beta versions

To access to the beta version, you must install it as a custom repository

  1. Install from HACS, add this repository as custom repository
  2. Search into HACS store the tapo integration and install
  3. Full restart of home assistant is recommended

Contributions are welcome!

Open a pull request, every contribution are welcome.


home-assistant-tapo-p100's People

Contributors

codyc1515 avatar delatt avatar dependabot[bot] avatar develolongscript avatar dimiterz avatar freality avatar gpancot avatar hobiano avatar imbaczek avatar irubnich avatar isaa-ctaylor avatar jamesonuk avatar jfox-sk avatar josecoelho96 avatar kisty avatar leandroissa avatar ludy87 avatar multiflexi avatar niciliketo avatar petretiandrea avatar rbrtribeiro avatar renovate[bot] avatar rfnunes avatar sapphire-sh avatar sbte avatar soruh avatar stoufiler avatar thanasiskalos avatar thisischrisnow avatar veggielane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

home-assistant-tapo-p100's Issues

Not able to add intergration via Ui

After installing Via hacs and restarting Home Assistant, and the going to configuration - Integration - Add New. The tapo integration isn't found in the list
I followed the Hacs install process shown on your Video to the letter

HACS - Home Assistant
This is all I get on the Integration page.

Configuration - Home Assistant
.

L530e problemi

Ciao, non riesco a far funzionare bene le lampadine L530e dopo averle integrate.
Si accendono, poi non si riesce a cambiare la luminosità o colore: diventano poi non disponibili per qualche minuto.

LOG:

Error fetching tapo data:

Logger: custom_components.tapo.common_setup
Source: helpers/update_coordinator.py:219
Integration: Tapo Controller (documentation, issues)
First occurred: 06:34:48 (330 occurrences)
Last logged: 10:57:49


Error doing job: Task exception was never retrieved

Logger: homeassistant
Source: custom_components/tapo/tapo_entity.py:33
Integration: Tapo Controller (documentation, issues)
First occurred: 10:56:58 (6 occurrences)
Last logged: 11:03:01

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 505, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 583, in _async_write_ha_state
if (name := (entry and entry.name) or self.name) is not None:
File "/config/custom_components/tapo/tapo_sensor_entity.py", line 47, in name
return super().name + " " + self.sensor_config.name
File "/config/custom_components/tapo/tapo_entity.py", line 33, in name
return self.coordinator.data.nickname
AttributeError: 'NoneType' object has no attribute 'nickname'

Timer

So I got a project, where the users want to control the timer of the switch to be automatically turn OFF 40 minutes after it was turned ON every time.
Or features like TAPO app, where the user could schedule the time when it was turned ON, when to turned OFF.

Error while setting up tapo platform for switch

Version of the custom_component

v1.1.4

Configuration

Item was set up with the UI, thus no YAML config available. Everything has worked perfectly for months. I have 2 tapo p100 plugs, no lights.

Describe the bug

It seems that the latest version of HA (core-2021.9.4) and Supervisor (supervisor-2021.09.0) have broken this component.
Not sure if relevant, but the OS is Home Assistant OS 6.3 and it's running on an RPi4.

Debug log

Logger: homeassistant.components.switch
Source: custom_components/tapo/switch.py:15
Integration: Switch (documentation, issues)
First occurred: 8:47:26 (2 occurrences)
Last logged: 8:47:26

Error while setting up tapo platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/tapo/switch.py", line 15, in async_setup_entry
    if coordinator.data.model.lower() in SUPPORTED_DEVICE_AS_SWITCH:
AttributeError: 'NoneType' object has no attribute 'model'

Config flow could not be loaded

Version of the custom_component

Version 1.0

Describe the bug

When I try to add the integration, I'm getting the "Config flow could not be loaded" error. The integration has been manually copied in the custom_components folder, as HACS currently is greyed out for adding custom repositories on my install.

Debug log


2022-01-19 18:59:17 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 98, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 1654, in parseString
    raise exc
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 1644, in parseString
    loc, tokens = self._parse( instring, 0 )
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 1406, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py", line 3205, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pkg_resources._vendor.pyparsing.ParseException: Expected stringEnd (at char 8), (line:1, col:9)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/util/package.py", line 38, in is_installed
    pkg_resources.get_distribution(package)
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 464, in get_distribution
    dist = Requirement.parse(dist)
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3139, in parse
    req, = parse_requirements(s)
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3084, in parse_requirements
    yield Requirement(line)
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3094, in __init__
    super(Requirement, self).__init__(requirement_string)
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 100, in __init__
    raise InvalidRequirement(
pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'=2.1.11'": Expected stringEnd

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 138, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 130, in post
    return await super().post(request)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post
    result = await self._flow_mgr.async_init(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 197, in async_init
    flow, result = await task
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 215, in _async_init
    flow = await self.async_create_flow(handler, context=context, data=data)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 706, in async_create_flow
    await async_process_deps_reqs(self.hass, self._hass_config, integration)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 378, in async_process_deps_reqs
    await requirements.async_get_integration_with_requirements(
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 85, in async_get_integration_with_requirements
    await _async_process_integration(hass, integration, done)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 101, in _async_process_integration
    await async_process_requirements(
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 164, in async_process_requirements
    await _async_process_requirements(
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 184, in _async_process_requirements
    if pkg_util.is_installed(req):
  File "/usr/src/homeassistant/homeassistant/util/package.py", line 45, in is_installed
    req = pkg_resources.Requirement.parse(urlparse(package).fragment)
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3139, in parse
    req, = parse_requirements(s)
ValueError: not enough values to unpack (expected 1, got 0)

No attribute "device_on"

Hello!

HA: 2021.12.5
Tapo HACS: v1.2.1

I'm getting this error when I try to switch on from a Tapo Light Stripe (L900)

'NoneType' object has no attribute 'device_on'

The log:

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/tapo/light.py:62
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 21:33:51 (2 occurrences)
Last logged: 21:45:03

[140077253799552] 'NoneType' object has no attribute 'device_on'
[140077069589856] 'NoneType' object has no attribute 'device_on'
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 367, in async_handle_light_on_service
profiles.apply_default(light.entity_id, light.is_on, params)
File "/config/custom_components/tapo/light.py", line 62, in is_on
return self._tapo_coordinator.data.device_on
AttributeError: 'NoneType' object has no attribute 'device_on'

When I try to switch on from the Tapo APP all works fine.

Unexpected exception

When I entered my credentials (and host), I have an error (Unexpected).
I guess, this is linked to the new HA version. Here is my setup:

Home Assistant OS 7.0
core-2021.12.1

I have the following logs:

Logger: custom_components.tapo.config_flow
Source: custom_components/tapo/config_flow.py:85
Integration: Tapo Controller (documentation, issues)
First occurred: 09:39:30 (1 occurrences)
Last logged: 09:39:30

Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/tapo/config_flow.py", line 48, in async_step_user
entry_metadata = await self._validate_input(user_input)
File "/config/custom_components/tapo/config_flow.py", line 85, in _validate_input
state = await tapo_api.get_state()
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 89, in get_state
state=await self.get_state_as_dict(),
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 213, in get_state_as_dict
return await self._execute_method_request(device_info_method)
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 238, in _execute_method_request
self.__validate_response(resp_dict)
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 257, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: 9999

Let me know if I can help

Light State not refreshing

Found another interesting bug, unsure if it is with the integration or home assistant.

I was trying to pass some data in scripts to turn on the lights with specific brightness and/or colour temps, as seen below:

service: light.turn_on
data_template:
entity_id: '{{ entity }}'
brightness_pct: 100

When running the script with a specific light, the light does turn on but the "On" state is not visible in either Home Assistant or the Tapo App. In both softwares, the light is considered off although it is physically on. This is using the same L530 we used to debug the brightness and colour temp bug in a previous issue, running on 1.2.8 (I can post the software and hardware details again if needed).

On the other hand, if I run the script without passing any other data, apart from entity_id, the script works fine and the state is correctly refreshed in both tapo app and HA.

service: light.turn_on
data_template:
entity_id: '{{ entity }}'

L900 LED strip when changing colour the plugin stops working period

Version of the custom_component

Version core-2021.12.6
Installation Type Home Assistant Container
Development false
Supervisor false
Docker true
User root
Virtual Environment false
Python Version 3.9.7
Operating System Family Linux
Operating System Version 4.4.59+
CPU Architecture x86_64
Timezone Europe/London

-->

Configuration

nothing in yaml done form UI

Describe the bug

L900 LED strip when changing colour or brightness the plugin stops working period
Nothing in logs a reboot fixes the issue.

Debug log


2021-12-28 15:55:06 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hive which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-12-28 15:55:06 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration garbage_collection which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-12-28 15:55:06 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration tesla_custom which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-12-28 15:55:06 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration ble_monitor which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-12-28 15:55:06 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration tapo which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-12-28 15:55:06 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-12-28 15:55:51 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'click' when rendering '{{ value_json.click }}'
2021-12-28 15:55:52 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'click' when rendering '{{ value_json.click }}'
2021-12-28 15:55:52 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'click' when rendering '{{ value_json.click }}'
2021-12-28 15:55:52 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'click' when rendering '{{ value_json.click }}'
2021-12-28 15:55:52 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'click' when rendering '{{ value_json.click }}'
2021-12-28 15:55:52 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid color mode received
2021-12-28 15:55:52 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'click' when rendering '{{ value_json.click }}'
2021-12-28 15:56:52 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'click' when rendering '{{ value_json.click }}'

Error executing service: <ServiceCall light.turn_on>

Sometimes when I when I want to change color there happens such bug:

Эта ошибка возникла в кастомной интеграции.

`Logger: homeassistant.core
Source: custom_components/tapo/tapo_entity.py:33
Integration: Tapo Controller (documentation, issues)
First occurred: 10:41:19 (3 occurrences)
Last logged: 18:47:35

Error executing service: <ServiceCall light.turn_on (c:83e4f5f4b3e68fc9ac93f88e5b545028): entity_id=['light.tapo_2'], params=hs_color=(120.0, 71.42857142857142)>
Error executing service: <ServiceCall light.turn_on (c:f5e7d4ed92b757320d88911ff520d9e7): entity_id=['light.tapo_2'], params=hs_color=(240.0, 85.71428571428571)>
Error executing service: <ServiceCall light.turn_on (c:1ca72b17a5689dfbf3b18148cf267970): entity_id=['light.tapo_2'], params=brightness=255>
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 969, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection
sock = await self._connect_sock(
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 496, in sock_connect
return await fut
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 528, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
ConnectionResetError: [Errno 104] Connect call failed ('192.168.1.103', 80)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 121, in set_hue_saturation
return await self.set_device_info(LightParams(hue=hue, saturation=saturation))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 94, in _set_device_info
response = await self.http.async_make_post_cookie(f"{self.url}?token={self.token}", request_body,
File "/usr/local/lib/python3.8/site-packages/plugp100/core/http_client.py", line 18, in async_make_post_cookie
async with self.session.post(url, json=json, cookies=cookie) as response:
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 1117, in aenter
self._resp = await self._coro
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 520, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 535, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 892, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.103:80 ssl:default [Connect call failed ('192.168.1.103', 80)]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/core.py", line 1507, in catch_exceptions
await coro_or_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 760, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 417, 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 94, in async_turn_on
await self._change_color([hue, saturation])
File "/config/custom_components/tapo/light.py", line 123, in _change_color
await self._execute_with_fallback(
File "/config/custom_components/tapo/tapo_entity.py", line 33, in _execute_with_fallback
await self.coordinator.api.login()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 69, in login
await self._handshake()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 146, in _handshake
self.tp_link_cipher = self.encryption.decode_handshake_key(resp_dict['result']['key'], self.key_pair)
File "/usr/local/lib/python3.8/site-packages/plugp100/core/encryption.py", line 38, in decode_handshake_key
do_final = cipher.decrypt(decode, None)
File "/usr/local/lib/python3.8/site-packages/Crypto/Cipher/PKCS1_v1_5.py", line 169, in decrypt
m_int = self._key._decrypt(ct_int)
File "/usr/local/lib/python3.8/site-packages/Crypto/PublicKey/RSA.py", line 154, in _decrypt
raise ValueError("Ciphertext too large")
ValueError: Ciphertext too large`

Also this one:

`Эта ошибка возникла в кастомной интеграции.

Logger: custom_components.tapo
Source: helpers/update_coordinator.py:219
Integration: Tapo Controller (documentation, issues)
First occurred: 08:38:50 (215 occurrences)
Last logged: 18:57:06

Error fetching tapo data:`

изображение

Color/temp control not working on latest update

Version of the custom_component

Latest

Configuration

N/A

Describe the bug

Brightness still works, no color or temp control though

Debug log


Logger: homeassistant.components.websocket_api.http.connection
Source: components/light/__init__.py:485
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 11:33:13 AM (11 occurrences)
Last logged: 12:01:59 PM

[139913444255728] type NoneType doesn't define __round__ method
[139913468791728] type NoneType doesn't define __round__ method
[139913453106128] type NoneType doesn't define __round__ method
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 141, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1488, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1523, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 642, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 681, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 679, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 235, in async_handle_light_on_service
    await light.async_turn_on(**params)
  File "/config/custom_components/tapo/light.py", line 75, in async_turn_on
    await self._tapo_coordinator.async_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 200, in async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 260, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 295, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 321, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 485, in state_attributes
    data[ATTR_HS_COLOR] = (round(hs_color[0], 3), round(hs_color[1], 3))
TypeError: type NoneType doesn't define __round__ method

Logger: homeassistant.components.light
Source: components/light/__init__.py:485
Integration: Light (documentation, issues)
First occurred: 11:32:05 AM (2 occurrences)
Last logged: 11:32:05 AM

Error adding entities for domain light with platform tapo
Error while setting up tapo platform for light
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 317, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 509, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 530, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 295, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 321, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 485, in state_attributes
    data[ATTR_HS_COLOR] = (round(hs_color[0], 3), round(hs_color[1], 3))
TypeError: type NoneType doesn't define __round__ method

Unexpected error

Version: 1.1.1

Configuration

HACS Integration, not on configuration.YAML

Describe the bug

When entering IP host name, user and password it says: Unexpected error

Screenshot_1

Debug log

File "/config/custom_components/tapo/config_flow.py", line 48, in async_step_user

entry_metadata = await self._validate_input(user_input)

File "/config/custom_components/tapo/config_flow.py", line 85, in _validate_input

state = await tapo_api.get_state()

File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 73, in get_state

return TapoDeviceState(await self._get_state())

File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 209, in _get_state

self.__validate_response(resp_dict)

File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response

raise TapoException.from_error_code(resp['error_code'])

plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: 9999

Add support for Tapo L900 Led Strip

Output of the python script is as follows:

3aabd55657bfc9d5535137d33d723d2e427f8625
{'device_id': '80231D215468F5596767CFF7883596951EBD89A3', 'fw_ver': '1.0.6 Build 210823 Rel.180931', 'hw_ver': '1.0', 'type': 'SMART.TAPOBULB', 'model': 'L900', 'mac': '10-27-F5-3C-45-9F', 'hw_id': '17A075F2055FD95D99BE012EB439F21C', 'fw_id': '7BECA9DC454565672FEC87D1104F9972', 'oem_id': '8807B384544C42EFE1B0ABB0C45CAA8E', 'color_temp_range': [9000, 9000], 'overheated': False, 'ip': '192.168.1.241', 'time_diff': 60, 'ssid': 'RW5keW1pb24=', 'rssi': -43, 'signal_level': 3, 'latitude': 405633, 'longitude': -40195, 'lang': 'es_ES', 'avatar': 'light_strip', 'region': 'Europe/Madrid', 'specs': '', 'nickname': 'VGlyYSBsZWQgYnVoYXJkaWxsYQ==', 'has_set_location_info': True, 'lighting_effect': {'enable': 0, 'id': 'TapoStrip_1MClvV18i15Jq3bvJVf0eP', 'name': 'Aurora', 'custom': 0, 'brightness': 100, 'display_colors': [[120, 100, 100], [240, 100, 100], [260, 100, 100], [280, 100, 100]]}, 'device_on': False, 'brightness': 100, 'hue': 0, 'saturation': 0, 'color_temp': 0, 'default_states': {'type': 'last_states', 'state': {'brightness': 100, 'hue': 0, 'saturation': 0, 'color_temp': 0}}}

Thanks a lot!

Auto discovery

Automatic discovery

  • new automatic discovery using DHCP

Invalid authentication p100

Hi there =)
I have try to add my P100 device.
Host is the IP address that they got from my router and username and password is from my Tapo App account but i got every time "Invalid authentication". Have anyone an idea?
Thanks a lot for help =)
Screenshot_20220104-125753_Tapo
Screenshot_20220104-125658_Home Assistant

Originally posted by @Chriss1337 in #105 (comment)

Watt comsumtion recording/analysis

I have to say this is a very good project, thank you very much.

Is it possible to add the feature about watt consumption recording or analysis?

Anyway, you public this project to HACS is very kind, and I like it. Thank you very much.

Tapo Bulb L530 set to cool white makes it unavailable

Version of the custom_component

v1.0

Describe the bug

Tapo Bulb L530 set to cool white makes it unavailable. When the slider is set to the coolest setting (153), the bulb becomes unavailable. Sometimes it will be back after a few minutes or after a restart.

Debug log


2021-04-19 12:10:11 ERROR (MainThread) [custom_components.tapo] Unexpected exception from <bound method DataUpdateCoordinator.async_refresh of <custom_components.tapo.TapoUpdateCoordinator object at 0x7f8a6ba7f0>>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 104, in _handle_timer_finish
await task
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 161, in async_refresh
await self._async_refresh(log_failures=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 235, in _async_refresh
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 295, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 310, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 334, in _async_write_ha_state
sstate = self.state
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 704, in state
return STATE_ON if self.is_on else STATE_OFF
File "/config/custom_components/tapo/light.py", line 47, in is_on
return self._tapo_coordinator.data.device_on
AttributeError: 'NoneType' object has no attribute 'device_on'
2021-04-19 12:10:30 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall light.turn_on (c:7f0fd406fc21bf4e5461af02bc809402): entity_id=['light.tapo_bulb_l530'], params=color_temp=153>
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 31, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 118, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 76, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 106, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 228, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/core.py", line 1496, in catch_exceptions
await coro_or_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1515, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 206, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 649, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 692, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 686, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 322, in async_handle_light_on_service
await light.async_turn_on(**params)
File "/config/custom_components/tapo/light.py", line 94, in async_turn_on
await self._change_color_temp(color_temp)
File "/config/custom_components/tapo/light.py", line 115, in _change_color_temp
await self._execute_with_fallback(
File "/config/custom_components/tapo/tapo_entity.py", line 34, in _execute_with_fallback
return await self._execute_with_fallback(function, False)
File "/config/custom_components/tapo/tapo_entity.py", line 34, in _execute_with_fallback
return await self._execute_with_fallback(function, False)
File "/config/custom_components/tapo/tapo_entity.py", line 34, in _execute_with_fallback
return await self._execute_with_fallback(function, False)
[Previous line repeated 17 more times]
File "/config/custom_components/tapo/tapo_entity.py", line 33, in _execute_with_fallback
await self.coordinator.api.login()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 69, in login
await self._handshake()
File "/usr/local/lib/python3.8/site-packages/plugp100/api.py", line 146, in _handshake
self.tp_link_cipher = self.encryption.decode_handshake_key(resp_dict['result']['key'], self.key_pair)
File "/usr/local/lib/python3.8/site-packages/plugp100/core/encryption.py", line 40, in decode_handshake_key
raise ValueError("Decryption failed!")
ValueError: Decryption failed!

Setup failed with core-2022.3.1

Logger: homeassistant.setup
Source: setup.py:162
First occurred: 10:20:22 (1 occurrences)
Last logged: 10:20:22

Setup failed for custom integration tapo: Requirements for tapo not found: ['plugp100==2.1.10b1']

core-2022.3.1
supervisor-2022.01.1
Home Assistant OS 7.4

With core-2022.2.1 everything it's ok

Full P110 configuration via yaml

Firstly, thanks for the project :)

Secondly, I would like to ask if it is possible to declare via yaml the switch and sensors that appear in Home Assistant if I do the configuration of the P110 plug via GUI.

Thanks in advance.

Entities and Switch become unavailable if using Tapo App

Version of the custom_component

The latest Beta version

Configuration

Add your logs here.

No Configuration in yaml

Describe the bug

I have a P110. Looking to homeassistant, I can see that the entity and switch become unavailable after sometime, if I start using the Tapo app.
If I stop using the app, after sometime, they become available again.

Debug log


2021-09-30 17:27:25 DEBUG (MainThread) [plugp100.api] Method request: {"method": "get_device_info", "params": null}
2021-09-30 17:27:25 DEBUG (MainThread) [plugp100.api] Method request encrypted: RIYVeTQkWK9qOtnETJcZN/XaRjA+yO6hMtLTZ9HYbOyIaaf64WS/2OdZLXNH4kjW
2021-09-30 17:27:25 DEBUG (MainThread) [plugp100.api] Secure passthrough method: <plugp100.core.methods.secure_passthrough_method.SecurePassthroughMethod object at 0xa5ba91f0>
2021-09-30 17:27:25 DEBUG (MainThread) [plugp100.api] Request body: {'method': 'securePassthrough', 'params': {'request': 'RIYVeTQkWK9qOtnETJcZN/XaRjA+yO6hMtLTZ9HYbOyIaaf64WS/2OdZLXNH4kjW'}}
2021-09-30 17:27:25 DEBUG (Recorder) [homeassistant.components.recorder] Sending keepalive
2021-09-30 17:27:25 DEBUG (Recorder) [homeassistant.components.recorder.pool.RecorderPool] Connection <sqlite3.Connection object at 0xb310a130> checked out from pool
2021-09-30 17:27:25 DEBUG (MainThread) [plugp100.api] Will perform handshaking...
2021-09-30 17:27:25 DEBUG (MainThread) [plugp100.api] Generating keypair
2021-09-30 17:27:25 DEBUG (MainThread) [root] Generating key...
2021-09-30 17:27:25 DEBUG (MainThread) [root] MIME encoding private and public key...
2021-09-30 17:27:25 DEBUG (MainThread) [plugp100.api] Handshake params: {"key": "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDnUv3yhU6e3O/+DRezCa2J7V0sS9938ujrMSyZ\r\n41C2XrMh+Wc6pOcgcSBUUtx3RKpFkwkJpqrwMRAVMSBEEfTtOFf4rMIKsZT4VT26KabGtO5kbuIe\r\nf1phQUChu5AxEons3HDdFF/DWmWsf0ALIK/DAS0j6XAgmbTYLbraJjUmSQIDAQAB\n-----END PUBLIC KEY-----\n"}
2021-09-30 17:27:25 DEBUG (MainThread) [plugp100.api] Handshake method: {"method": "handshake", "params": {"key": "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDnUv3yhU6e3O/+DRezCa2J7V0sS9938ujrMSyZ\r\n41C2XrMh+Wc6pOcgcSBUUtx3RKpFkwkJpqrwMRAVMSBEEfTtOFf4rMIKsZT4VT26KabGtO5kbuIe\r\nf1phQUChu5AxEons3HDdFF/DWmWsf0ALIK/DAS0j6XAgmbTYLbraJjUmSQIDAQAB\n-----END PUBLIC KEY-----\n"}}
2021-09-30 17:27:25 DEBUG (MainThread) [plugp100.api] Request body: {'method': 'handshake', 'params': {'key': '-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDnUv3yhU6e3O/+DRezCa2J7V0sS9938ujrMSyZ\r\n41C2XrMh+Wc6pOcgcSBUUtx3RKpFkwkJpqrwMRAVMSBEEfTtOFf4rMIKsZT4VT26KabGtO5kbuIe\r\nf1phQUChu5AxEons3HDdFF/DWmWsf0ALIK/DAS0j6XAgmbTYLbraJjUmSQIDAQAB\n-----END PUBLIC KEY-----\n'}}
2021-09-30 17:27:25 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-30 17:27:25 DEBUG (MainThread) [custom_components.tapo] Finished fetching tapo data in 0.211 seconds (success: False)
2021-09-30 17:27:25 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.caldeira_today_energy, old_state=<state sensor.caldeira_today_energy=0.006; state_class=total_increasing, unit_of_measurement=kWh, friendly_name=Caldeira today energy, icon=mdi:power, device_class=energy @ 2021-09-30T17:26:24.873958+01:00>, new_state=<state sensor.caldeira_today_energy=unavailable; state_class=total_increasing, unit_of_measurement=kWh, friendly_name=Caldeira today energy, icon=mdi:power, device_class=energy @ 2021-09-30T17:27:25.212557+01:00>>
2021-09-30 17:27:25 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=switch.caldeira, old_state=<state switch.caldeira=on; friendly_name=Caldeira @ 2021-09-30T17:26:25.243172+01:00>, new_state=<state switch.caldeira=unavailable; friendly_name=Caldeira @ 2021-09-30T17:27:25.213136+01:00>>
2021-09-30 17:27:25 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [2973973352] Sending {"id": 2, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "sensor.caldeira_today_energy", "old_state": {"entity_id": "sensor.caldeira_today_energy", "state": "0.006", "attributes": {"state_class": "total_increasing", "unit_of_measurement": "kWh", "friendly_name": "Caldeira today energy", "icon": "mdi:power", "device_class": "energy"}, "last_changed": "2021-09-30T16:26:24.873958+00:00", "last_updated": "2021-09-30T16:26:24.873958+00:00", "context": {"id": "c7f68f3aae9adca2ac1392ee6ae98cd2", "parent_id": null, "user_id": null}}, "new_state": {"entity_id": "sensor.caldeira_today_energy", "state": "unavailable", "attributes": {"state_class": "total_increasing", "unit_of_measurement": "kWh", "friendly_name": "Caldeira today energy", "icon": "mdi:power", "device_class": "energy"}, "last_changed": "2021-09-30T16:27:25.212557+00:00", "last_updated": "2021-09-30T16:27:25.212557+00:00", "context": {"id": "82c199b6b4b938c3b376851d4690c3be", "parent_id": null, "user_id": null}}}, "origin": "LOCAL", "time_fired": "2021-09-30T16:27:25.212557+00:00", "context": {"id": "82c199b6b4b938c3b376851d4690c3be", "parent_id": null, "user_id": null}}}
2021-09-30 17:27:25 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [2973973352] Sending {"id": 2, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "switch.caldeira", "old_state": {"entity_id": "switch.caldeira", "state": "on", "attributes": {"friendly_name": "Caldeira"}, "last_changed": "2021-09-30T16:26:25.243172+00:00", "last_updated": "2021-09-30T16:26:25.243172+00:00", "context": {"id": "cf0606ced973cf21cf035b671d282a85", "parent_id": null, "user_id": null}}, "new_state": {"entity_id": "switch.caldeira", "state": "unavailable", "attributes": {"friendly_name": "Caldeira"}, "last_changed": "2021-09-30T16:27:25.213136+00:00", "last_updated": "2021-09-30T16:27:25.213136+00:00", "context": {"id": "f7583e8e75eba00b6c2bead8fc729ce5", "parent_id": null, "user_id": null}}}, "origin": "LOCAL", "time_fired": "2021-09-30T16:27:25.213136+00:00", "context": {"id": "f7583e8e75eba00b6c2bead8fc729ce5", "parent_id": null, "user_id": null}}}

Add month_energy, today_runtime and month_runtime as entities etc.

Based on P110 Energy Monitoring support #64 there are lots of useful entities that could be added to home assistant.

E.g.:

  • month_energy
  • today_runtime
  • month_runtime
  • overheated
  • signal_level
Data run today from your updated script

743e03c849dfa98b94c9394174d8f2544cc6b4d1
{'device_id': '80222EF474BEC01D849DB7F9B01DB7041E800077', 'fw_ver': '1.0.7 Build 210629 Rel.174901', 'hw_ver': '1.0', 'type': 'SMART.TAPOPLUG', 'model': 'P110', 'mac': 'C0-06-C3-E4-AB-5C', 'hw_id': '56DD079101D61D400A11C4A3D41C51DA', 'fw_id': '00000000000000000000000000000000', 'oem_id': 'AE7B616A7168B34151ABBCF86C88DF34', 'overheated': False, 'ip': '192.168.0.59', 'time_diff': 0, 'ssid': 'U0tZNVlSR0s=', 'rssi': -44, 'signal_level': 3, 'latitude': 513553, 'longitude': -18955, 'lang': 'en_US', 'avatar': 'plug', 'region': 'Europe/London', 'specs': '', 'nickname': 'UG93ZXIgRGVzaw==', 'has_set_location_info': True, 'device_on': True, 'on_time': 31570, 'default_states': {'type': 'last_states', 'state': {}}}
{'today_runtime': 1018, 'month_runtime': 31986, 'today_energy': 610, 'month_energy': 24609, 'local_time': '2021-09-03 17:17:26', 'past24h': [22, 18, 19, 18, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 7, 51, 59, 69, 62, 53, 53, 82, 82, 18], 'past30d': [0, 0, 0, 311, 914, 1127, 1690, 1559, 1631, 1683, 1478, 1484, 1347, 837, 833, 979, 681, 644, 1174, 1612, 1034, 843, 857, 348, 0, 0, 0, 266, 667, 610], 'past1y': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23066, 1543], 'past7d': [[26, 26, 25, 26, 25, 25, 26, 26, 28, 27, 29, 27, 23, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 22, 8, 57, 50, 27, 23, 9, 29, 7, 7, 6, 8], [7, 7, 7, 8, 7, 7, 7, 8, 22, 51, 62, 44, 60, 67, 64, 61, 60, 23, 22, 18, 19, 18, 9, 9], [9, 9, 9, 9, 9, 9, 10, 10, 7, 51, 59, 69, 62, 53, 53, 82, 82, 18, 0, 0, 0, 0, 0, 0]], 'current_power': 40274}
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x10ffbdfd0>
guyshoebridge@Mac-mini ~ %

Originally posted by @gshoebridge in #64 (comment)

Light goes to off if turned on by a physical light switch

Version of the custom_component

v.1.1

Describe the bug

When the light bulb is turned off by cutting the power and than turned on, it goes to its default on state. But as soon as the connection to home assistant is established the light turns back of. So the light is on for 5 seconds and than goes off again. This happens every time, even if it was previously on in home assistant.

Debug log


No errors

Error fetching data

Hello. I have default yaml file with tapo_p100_control installed (but not working though)
And it is almost impossible to use because of the huge switch lag and constant errors with my six p100 plugs.
What is going on?

Logger: custom_components.tapo
Source: helpers/update_coordinator.py:219
Integration: Tapo Controller (documentation, issues)
First occurred: 4:47:09 (14 occurrences)
Last logged: 4:48:40

Error fetching tapo data:

2021-09-23 04:46:52 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration sleep_as_android which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-23 04:46:52 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration xiaomi_gateway3 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-23 04:46:52 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration tapo which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-23 04:46:52 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration tapo_p100_control which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-23 04:46:52 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-23 04:47:08 WARNING (MainThread) [homeassistant.setup] Setup of input_text is taking over 10 seconds.
2021-09-23 04:47:08 WARNING (MainThread) [homeassistant.setup] Setup of zone is taking over 10 seconds.
2021-09-23 04:47:08 WARNING (MainThread) [homeassistant.setup] Setup of input_select is taking over 10 seconds.
2021-09-23 04:47:08 WARNING (MainThread) [homeassistant.setup] Setup of timer is taking over 10 seconds.
2021-09-23 04:47:09 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:47:09 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Living Room' for tapo integration not ready yet: None; Retrying in background
2021-09-23 04:47:11 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:47:11 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Hall' for tapo integration not ready yet: None; Retrying in background
2021-09-23 04:47:11 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:47:11 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Kitchen' for tapo integration not ready yet: None; Retrying in background
2021-09-23 04:47:12 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:47:12 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Office' for tapo integration not ready yet: None; Retrying in background
2021-09-23 04:47:15 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:47:15 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Living Room' for tapo integration not ready yet: None; Retrying in background
2021-09-23 04:47:15 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:47:15 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Bedroom' for tapo integration not ready yet: None; Retrying in background
2021-09-23 04:47:19 ERROR (MainThread) [custom_components.xiaomi_gateway3.core.xiaomi_cloud] Timeout while requesting MIoT api /home/device_list
2021-09-23 04:47:30 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:47:51 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:48:21 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:48:40 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:48:40 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:48:40 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:48:40 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:48:40 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:49:11 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:49:50 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:49:50 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:50:28 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:50:28 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:50:28 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:50:41 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:52:08 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:52:11 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:52:18 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:52:18 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:52:18 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:
2021-09-23 04:52:19 ERROR (MainThread) [custom_components.tapo] Error fetching tapo data:

Error

Version of the custom_component

v1.1.3
HACS 1.13.2
HA core-2021.6.6
Home Assistant Container

Configuration

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
 http:
  base_url: mydomain.com:443
  use_x_forwarded_for: true
  trusted_proxies:
    - 127.0.0.1
    - 192.168.1.0/24

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
cover: !include covers.yaml
automation: !include automations.yaml
script: !include scripts.yaml
binary_sensor: !include binary_sensor.yaml
frontend:
  themes: !include_dir_merge_named themes
homeassistant:
  customize: !include customize.yaml
#ios:


history:
  include:
    domains:
      - climate
      - cover
      - weather
      - person
      - binary_sensor
    entities:
      - sensor.sonoff_10005_humidity
      - sensor.sonoff_10005_temperature

homekit:
  filter:
    include_domains:
      - climate
      - light
      - cover
      - weather
      - person
    include_entity_globs:
      - binary_sensor.*_occupancy



device_tracker:
  - platform: huawei_router
    host: '****'
    username: '****'
    password: '****'
    new_device_defaults:
      track_new_devices: false
    

Describe the bug

Direct installing / updating of the integration doesn't work, only by following the suggestions in the log and some persistence. This has always been the case, I've been using it for the last 3 versions.

Debug log


2021-07-12 16:33:23 ERROR (SyncWorker_7) [homeassistant.util.package] Unable to install package plugp100==2.1.7: ERROR: Cannot install plugp100==2.1.7 because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
WARNING: You are using pip version 21.1.2; however, version 21.1.3 is available.
You should consider upgrading via the '/usr/local/bin/python3 -m pip install --upgrade pip' command.
2021-07-12 16:33:23 ERROR (MainThread) [homeassistant.setup] Setup failed for tapo: Requirements for tapo not found: ['plugp100==2.1.7'].

Tapo Plug p100 Entity doesn't show current status after UI switch pressed

Version of the custom_component

v1.0

Describe the bug

Pressing a switch in home assistant switches the plug, but also shows an error. Status of the switch in UI is not updated. Bug happens only sometimes, mostly after longer pause between last switch.

Debug log


[547844523968] 'NoneType' object has no attribute 'device_on'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 143, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1515, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 206, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 649, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 692, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 686, in _handle_entity_call
    await result
  File "/config/custom_components/tapo/switch.py", line 27, in async_turn_on
    await self._tapo_coordinator.async_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 161, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 235, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 295, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 310, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 334, in _async_write_ha_state
    sstate = self.state
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 704, in state
    return STATE_ON if self.is_on else STATE_OFF
  File "/config/custom_components/tapo/switch.py", line 23, in is_on
    return self._tapo_coordinator.data.device_on
AttributeError: 'NoneType' object has no attribute 'device_on'

Tapo Control not found in Integration

Hi, I installed through HACS and your Github repo and restarted the server. Seemed like all went well. I can see that the folder TAPO was created. But when I go to integration and search for TAPO, nothing comes up. Any idea what the issue could be?

I looked in HACS AND Configuration > Integration. No Tapo found.

I have Tapo Control version 1.1.2 - Home Assistant Version core-2021-6-6 (newest version).

1.2.8 issue - Colour wheel "index out of range"

Issue

Version 1.2.8 gives "index out of range" error when changing colour wheel. Colour temperature works fine.
Version 1.2.7 works perfectly, in both colour wheel and temperature.

Version of the custom_component

1.2.8

Configuration

Set up via Integrations.

Describe the bug

When changing the colour (not the temperature, which works), I am presented with the error "Index out of range"

Debug log

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/tapo/tapo_entity.py:43
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 12:25:34 PM (2 occurrences)
Last logged: 12:25:36 PM

[140221645713616] index out of range
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 41, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 135, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 93, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 123, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 256, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 41, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 135, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 93, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 123, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 256, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 41, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 135, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 93, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 123, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 256, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 41, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 135, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 93, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 123, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 256, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 41, in _execute_with_fallback
return await function()
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 135, in set_color_temperature
return await self.set_device_info(LightParams(color_temperature=color_temperature))
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 93, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 123, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 256, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 190, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1630, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1667, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 668, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 921, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 705, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 504, 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 115, in async_turn_on
await self._change_color([hue, saturation])
File "/config/custom_components/tapo/light.py", line 154, in _change_color
await self._execute_with_fallback(
File "/config/custom_components/tapo/tapo_entity.py", line 44, in _execute_with_fallback
return await self._execute_with_fallback(function, False)
File "/config/custom_components/tapo/tapo_entity.py", line 44, in _execute_with_fallback
return await self._execute_with_fallback(function, False)
File "/config/custom_components/tapo/tapo_entity.py", line 44, in _execute_with_fallback
return await self._execute_with_fallback(function, False)
[Previous line repeated 1 more time]
File "/config/custom_components/tapo/tapo_entity.py", line 43, in _execute_with_fallback
await self.coordinator.api.login()
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 83, in login
await self._handshake()
File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 163, in _handshake
self.tp_link_cipher = self.encryption.decode_handshake_key(resp_dict['result']['key'], self.key_pair)
File "/usr/local/lib/python3.9/site-packages/plugp100/core/encryption.py", line 46, in decode_handshake_key
b_arr.insert(i, do_final[i])
IndexError: index out of range

P100 Plug won't add - Invalid Authentication

Version of the custom_component

Latest

Configuration

N/A

Describe the bug

When trying to add a device, the window times out after a while and I get "invalid authentication" even though the credentials are correct.

Have run the following:

docker run --rm -e TAPO_ADDRESS=your_tapo_ip -e TAPO_USERNAME=your_username -e TAPO_PASSWORD=your_password petretiandrea/tapo-utils

and get the following response:

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7eff186c3ee0>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7eff18291580>, 1120377.678797548)]']
connector: <aiohttp.connector.TCPConnector object at 0x7eff186c3f40>
c159a13a930b9abe56e9168670d1f230373c1cb9
{'device_id': '8022B94790343BE918DE99DA6B3E1E0F1DBF10D7', 'fw_ver': '1.4.5 Build 20210122 Rel. 57265', 'hw_ver': '1.20.0', 'type': 'SMART.TAPOPLUG', 'model': 'P100', 'mac': '40-3F-8C-B0-00-76', 'hw_id': '9994A0A7D5B29645B8150C392284029D', 'fw_id': '1D18AD293A25ABDE41405B20C6F98816', 'oem_id': 'D43E293FEA5A174CC7534285828B0D15', 'specs': 'UK', 'device_on': False, 'on_time': 0, 'overheated': False, 'nickname': 'SGFsbHdheQ==', 'location': 'hallway', 'avatar': '', 'longitude': <REMOVED>, 'latitude': <REMOVED>, 'has_set_location_info': True, 'ip': '192.168.136.201', 'ssid': '<REMOVED>', 'signal_level': 2, 'rssi': -51, 'region': 'Europe/London', 'time_diff': 0, 'lang': 'en_US'}

Affter update to core-2021.7.0

After i update the core version from core 2021.5.5 to 2021.7.0 the tapo entity not working.
I got the following errors:

Logger: homeassistant.setup
Source: setup.py:173
First occurred: 5:55:50 PM (1 occurrences)
Last logged: 5:55:50 PM
Setup failed for tapo: Requirements for tapo not found: ['plugp100==2.1.6'].

And

Unable to install package plugp100==2.1.6: ERROR: Command errored out with exit status 1: command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-i305p3fb/pycares/setup.py'"'"'; file='"'"'/tmp/pip-install-i305p3fb/pycares/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-y07pk1ty cwd: /tmp/pip-install-i305p3fb/pycares/ Complete output (22 lines): running bdist_wheel running build running build_py creating build creating build/lib.linux-armv7l-3.9 creating build/lib.linux-armv7l-3.9/pycares copying src/pycares/init.py -> build/lib.linux-armv7l-3.9/pycares copying src/pycares/utils.py -> build/lib.linux-armv7l-3.9/pycares copying src/pycares/main.py -> build/lib.linux-armv7l-3.9/pycares copying src/pycares/_version.py -> build/lib.linux-armv7l-3.9/pycares copying src/pycares/errno.py -> build/lib.linux-armv7l-3.9/pycares running build_ext generating cffi module 'build/temp.linux-armv7l-3.9/_cares.c' creating build/temp.linux-armv7l-3.9 building '_cares' extension creating build/temp.linux-armv7l-3.9/build creating build/temp.linux-armv7l-3.9/build/temp.linux-armv7l-3.9 creating build/temp.linux-armv7l-3.9/deps creating build/temp.linux-armv7l-3.9/deps/c-ares creating build/temp.linux-armv7l-3.9/deps/c-ares/src gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -DHAVE_CONFIG_H=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -I/usr/local/include/python3.9 -Ideps/c-ares/src -Ideps/c-ares/src/config_linux -c build/temp.linux-armv7l-3.9/_cares.c -o build/temp.linux-armv7l-3.9/build/temp.linux-armv7l-3.9/_cares.o error: command 'gcc' failed: No such file or directory ---------------------------------------- ERROR: Failed building wheel for pycares ERROR: Command errored out with exit status 1: command: /usr/local/bin/python3 /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpb_lwqb0d cwd: /tmp/pip-install-i305p3fb/multidict Complete output (44 lines): ********************** * Accellerated build * ********************** running bdist_wheel running build running build_py creating build creating build/lib.linux-armv7l-3.9 creating build/lib.linux-armv7l-3.9/multidict copying multidict/_multidict_py.py -> build/lib.linux-armv7l-3.9/multidict copying multidict/_multidict_base.py -> build/lib.linux-armv7l-3.9/multidict copying multidict/_compat.py -> build/lib.linux-armv7l-3.9/multidict copying multidict/_abc.py -> build/lib.linux-armv7l-3.9/multidict copying multidict/init.py -> build/lib.linux-armv7l-3.9/multidict running egg_info writing multidict.egg-info/PKG-INFO writing dependency_links to multidict.egg-info/dependency_links.txt writing top-level names to multidict.egg-info/top_level.txt reading manifest file 'multidict.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '.pyc' found anywhere in distribution warning: no previously-included files found matching 'multidict/_multidict.html' warning: no previously-included files found matching 'multidict/.so' warning: no previously-included files found matching 'multidict/.pyd' warning: no previously-included files found matching 'multidict/.pyd' no previously-included directories found matching 'docs/_build' adding license file 'LICENSE' writing manifest file 'multidict.egg-info/SOURCES.txt' copying multidict/init.pyi -> build/lib.linux-armv7l-3.9/multidict copying multidict/_multidict.c -> build/lib.linux-armv7l-3.9/multidict copying multidict/py.typed -> build/lib.linux-armv7l-3.9/multidict creating build/lib.linux-armv7l-3.9/multidict/_multilib copying multidict/_multilib/defs.h -> build/lib.linux-armv7l-3.9/multidict/_multilib copying multidict/_multilib/dict.h -> build/lib.linux-armv7l-3.9/multidict/_multilib copying multidict/_multilib/istr.h -> build/lib.linux-armv7l-3.9/multidict/_multilib copying multidict/_multilib/iter.h -> build/lib.linux-armv7l-3.9/multidict/_multilib copying multidict/_multilib/pair_list.h -> build/lib.linux-armv7l-3.9/multidict/_multilib copying multidict/_multilib/views.h -> build/lib.linux-armv7l-3.9/multidict/_multilib running build_ext building 'multidict._multidict' extension creating build/temp.linux-armv7l-3.9 creating build/temp.linux-armv7l-3.9/multidict gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.9 -c multidict/_multidict.c -o build/temp.linux-armv7l-3.9/multidict/_multidict.o -O2 -std=c99 -Wall -Wsign-compare -Wconversion -fno-strict-aliasing -pedantic error: command 'gcc' failed: No such file or directory ---------------------------------------- ERROR: Failed building wheel for multidict ERROR: Could not build wheels for multidict which use PEP 517 and cannot be installed directly WARNING: You are using pip version 20.2.4; however, version 21.1.3 is available. You should consider upgrading via the '/usr/local/bin/python3 -m pip install --upgrade pip' command.

any idea what happened?

Tapo controller doesn't show up in Home Assistant 2021.12.8

I have an issue with home-assistant-tapo-p100 1.2.1 (and 1.1.4 which I redownloaded to see if the older version would work)

Configuration

Configure a default setup of Home Assistant (frontend, api, etc)

default_config:

#werkt niet?
#http:

ssl_certificate: /ssl/fullchain.pem

ssl_key: /ssl/privkey.pem

Text to speech

tts:

  • platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

Describe the bug

In your video, after installing the tapo controller using HACS and restarting the Home Assistant server, it shows up in the Home Assistant UI when searching for the Tapo Controller.

HOWEVER
That step, being the integrating tapo controller does not work for me in Home Assistant 2021.12.8 on debian.

In the configs, manually adding switches using IP adresses errors on the yaml expecting an Array

Debug log

2022-01-06 14:48:47 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-01-06 14:48:47 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration tapo which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-01-06 14:48:51 WARNING (MainThread) [homeassistant.components.hassio] Can't read Supervisor data: 404 Client Error for http+docker://localhost/v1.41/containers/addon_a0d7b954_ssh/json: Not Found ("No such container: addon_a0d7b954_ssh")
2022-01-06 14:48:57 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Huawei Home Gateway' for upnp integration not ready yet: Error during async_call(), status: 500, upnp error: 501 (Action Failed); Retrying in background

non trova il p100

Ho installato tapo e vedo tapo controller in hacs fra le integrazioni come devo fare a configurare il sistema in maniera che veda la mia presa ?? scusa ma sono un poì ignorante!!!

Version of the custom_component

Configuration

Add your logs here.

Describe the bug

A clear and concise description of what the bug is.

Debug log


Add your logs here.

Strip led L900

I have an L900 RGB led strip, it turns on and off but does not change color. is it possible to integrate it?

change tapo p100 starting status.

I have a problem, I really like Tapo P100 and want to change my starting status.

My problem is that after a power outage, the p100 does not remember theprevious state and is always turned off.

How do I changeit ? Is there any setting for a power outage?

L530 light bulbs can't change brightness on Home Assistant.

Home assistant is running on a docker container, Tapo integration was done by moving the custom-components folder to the appropriate directory. Device integration was done via UI. Same bug occurs if configured in yaml file.

Version 1.2.4

Device turns on and off using home assistant perfectly, but trying to change the brightness of my Tapo L530 smart bulbs does not work with this integration at the moment, causing the bulb to disconnect from home assistant. To restore the connection I am required to restart home assistant.

Brightness change error log:

2022-02-05 21:10:58 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [1817646632] index out of range
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 41, in _execute_with_fallback
return await function()
File "/config/custom_components/tapo/light.py", line 122, in _set_brightness
await self._tapo_coordinator.api.set_brightness(brightness_to_set)
File "/config/.local/lib/python3.9/site-packages/plugp100/api.py", line 132, in set_brightness
return await self.set_device_info(LightParams(brightness=brightness))
File "/config/.local/lib/python3.9/site-packages/plugp100/api.py", line 93, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/config/.local/lib/python3.9/site-packages/plugp100/api.py", line 123, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/config/.local/lib/python3.9/site-packages/plugp100/api.py", line 256, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/lib/python3.9/site-packages/homeassistant/core.py", line 1495, in async_call
task.result()
File "/usr/lib/python3.9/site-packages/homeassistant/core.py", line 1530, in _execute_service
await handler.job.target(service_call)
File "/usr/lib/python3.9/site-packages/homeassistant/helpers/entity_component.py", line 209, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/lib/python3.9/site-packages/homeassistant/helpers/service.py", line 663, in entity_service_call
future.result() # pop exception if have
File "/usr/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 896, in async_request_call
await coro
File "/usr/lib/python3.9/site-packages/homeassistant/helpers/service.py", line 700, in _handle_entity_call
await result
File "/usr/lib/python3.9/site-packages/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 "/config/custom_components/tapo/light.py", line 101, in async_turn_on
await self._change_brightness(kwargs.get(ATTR_BRIGHTNESS, 255))
File "/config/custom_components/tapo/light.py", line 124, in _change_brightness
await self._execute_with_fallback(_set_brightness)
File "/config/custom_components/tapo/tapo_entity.py", line 43, in _execute_with_fallback
await self.coordinator.api.login()
File "/config/.local/lib/python3.9/site-packages/plugp100/api.py", line 83, in login
await self._handshake()
File "/config/.local/lib/python3.9/site-packages/plugp100/api.py", line 163, in _handshake
self.tp_link_cipher = self.encryption.decode_handshake_key(resp_dict['result']['key'], self.key_pair)
File "/config/.local/lib/python3.9/site-packages/plugp100/core/encryption.py", line 46, in decode_handshake_key
b_arr.insert(i, do_final[i])
IndexError: index out of range

After this bug occurs, device seems to disconnect from Home Assistant, log below:

2022-02-05 21:10:58 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [1817646632] index out of range
Traceback (most recent call last):
File "/config/custom_components/tapo/tapo_entity.py", line 41, in _execute_with_fallback
return await function()
File "/config/custom_components/tapo/light.py", line 122, in _set_brightness
await self._tapo_coordinator.api.set_brightness(brightness_to_set)
File "/config/.local/lib/python3.9/site-packages/plugp100/api.py", line 132, in set_brightness
return await self.set_device_info(LightParams(brightness=brightness))
File "/config/.local/lib/python3.9/site-packages/plugp100/api.py", line 93, in set_device_info
await self._set_device_info(device_params.as_dict(), terminal_uuid)
File "/config/.local/lib/python3.9/site-packages/plugp100/api.py", line 123, in _set_device_info
self.__validate_response(decrypted_inner_response)
File "/config/.local/lib/python3.9/site-packages/plugp100/api.py", line 256, in __validate_response
raise TapoException.from_error_code(resp['error_code'])
plugp100.core.exceptions.TapoException.TapoException: Returned unknown error_code: -1008

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/lib/python3.9/site-packages/homeassistant/core.py", line 1495, in async_call
task.result()
File "/usr/lib/python3.9/site-packages/homeassistant/core.py", line 1530, in _execute_service
await handler.job.target(service_call)
File "/usr/lib/python3.9/site-packages/homeassistant/helpers/entity_component.py", line 209, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/lib/python3.9/site-packages/homeassistant/helpers/service.py", line 663, in entity_service_call
future.result() # pop exception if have
File "/usr/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 896, in async_request_call
await coro
File "/usr/lib/python3.9/site-packages/homeassistant/helpers/service.py", line 700, in _handle_entity_call
await result
File "/usr/lib/python3.9/site-packages/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 "/config/custom_components/tapo/light.py", line 101, in async_turn_on
await self._change_brightness(kwargs.get(ATTR_BRIGHTNESS, 255))
File "/config/custom_components/tapo/light.py", line 124, in _change_brightness
await self._execute_with_fallback(_set_brightness)
File "/config/custom_components/tapo/tapo_entity.py", line 43, in _execute_with_fallback
await self.coordinator.api.login()
File "/config/.local/lib/python3.9/site-packages/plugp100/api.py", line 83, in login
await self._handshake()
File "/config/.local/lib/python3.9/site-packages/plugp100/api.py", line 163, in _handshake
self.tp_link_cipher = self.encryption.decode_handshake_key(resp_dict['result']['key'], self.key_pair)
File "/config/.local/lib/python3.9/site-packages/plugp100/core/encryption.py", line 46, in decode_handshake_key
b_arr.insert(i, do_final[i])
IndexError: index out of range

Still issues when dimming L900

Hello,

I saw that there were already a few posts about this, all closed. But I still have problems with my L900s. As soon as I dim them, the integration crashes.

Version of the custom_component

const.py says: VERSION = "1.0" but downloaded the newest Version 1.24 and doublechecked for updates

Configuration

No special configuration

Describe the bug

Switching on and off as well as changing the color works without any problems. As soon as I dim the LEDs the integration crashes and I get the message "index out of range".

Debug log


Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/tapo/tapo_entity.py:43
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 18:42:56 (1 occurrences)
Last logged: 18:42:56

[139834101742272] 'utf-8' codec can't decode byte 0xf1 in position 0: invalid continuation byte
Traceback (most recent call last):
  File "/config/custom_components/tapo/tapo_entity.py", line 41, in _execute_with_fallback
    return await function()
  File "/config/custom_components/tapo/light.py", line 122, in _set_brightness
    await self._tapo_coordinator.api.set_brightness(brightness_to_set)
  File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 132, in set_brightness
    return await self.set_device_info(LightParams(brightness=brightness))
  File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 93, in set_device_info
    await self._set_device_info(device_params.as_dict(), terminal_uuid)
  File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 119, in _set_device_info
    self.tp_link_cipher.decrypt(
  File "/usr/local/lib/python3.9/site-packages/plugp100/core/tp_link_cipher.py", line 22, in decrypt
    pad_text = aes.decrypt(base64.b64decode(data.encode("UTF-8"))).decode("UTF-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa6 in position 0: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 190, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1630, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1667, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 668, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 927, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 705, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 504, 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 101, in async_turn_on
    await self._change_brightness(kwargs.get(ATTR_BRIGHTNESS, 255))
  File "/config/custom_components/tapo/light.py", line 124, in _change_brightness
    await self._execute_with_fallback(_set_brightness)
  File "/config/custom_components/tapo/tapo_entity.py", line 43, in _execute_with_fallback
    await self.coordinator.api.login()
  File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 84, in login
    await self._login_request(self.username, self.password)
  File "/usr/local/lib/python3.9/site-packages/plugp100/api.py", line 201, in _login_request
    self.tp_link_cipher.decrypt(
  File "/usr/local/lib/python3.9/site-packages/plugp100/core/tp_link_cipher.py", line 22, in decrypt
    pad_text = aes.decrypt(base64.b64decode(data.encode("UTF-8"))).decode("UTF-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf1 in position 0: invalid continuation byte


No Host to configure

Using latest version of home-assistant-tapo-p100

I have installed via HACs and rebooted my pi device (I have HACs for other addons, so know the score here).

Describe the bug

I have a username and password for TAPO on the app on my smart phone, but io don;t have a controller... so when (via UI) it asks for "controller" and i leave it blank, It then has a red exclamation and blanks the details for me to try again.

For note I have 3 x TP-Link Tapo L900 strips connected via Wifi and the Tapo app, and can control them with that without issue. All on latest firmware (1.0.9) and then connected to my home's wifi.

You help / advice trying to get thgis to work in home assistant appreciated.

P110 Energy Monitoring support

Request for energy monitoring support over P110 devices

  • I have found get_energy_usage method, but need to be checked if it's working
  • plugp100 2.1.10b0 contains a new method get_energy_usage() useful to establish if works.

Managing enities in configuration.yaml

Hi!
Thanks for your work! Im using it to manage my color bulb, works perfectly!
I think it should be nice to have a possibility to configure this integration via configuration.yaml like in old version. Didnt find this way in a new one, so think it you may return it :)

Screenshot_3

Invalid add on repository

Trying to add this through the custom add-on repository in version core-2021.8.5 and get the error "invalid add on repository". Am I missing something?

Using this url https://github.com/petretiandrea/home-assistant-tapo-p100 (the text box in the screenshot doesn't show it all)

image

Invalid authentication error

Version of the custom_component

Newest

Describe the bug

When trying to add a device, the window times out after a while and I get "invalid authentication" even though the credentials are correct.

Invalid authentication

Version of the custom_component

Any

Describe the bug

A lot of people receive an "Invalid authentication" error message. Thanks to #120 and @mostlyvirtual, we have found an issue regarding username with capital letters. As reported by the user, in Tapo App settings is shown the email address, if this address contains capital letter, you probably receive "Invalid authentication" error from integration. In #120 they resolved by creating another account using an email all lower-case. In this way, the integration works.

So actually, only lower case E-mail works. I will investigate on this and fix asap

EDIT: Thanks to @rfnunes. When entering email, use the same case as seen in Tapo App.

Error adding entities for domain light with platform tapo

Pulled from Hacs.

Updated today to latest 51ff857 update and it proke my light, cant connect to it, get following error from Hass logs.

Logger: homeassistant.components.light
Source: util/color.py:517
Integration: Lampor (documentation, issues)
First occurred: 14:48:31 (2 occurrences)
Last logged: 14:48:31

Error adding entities for domain light with platform tapo
Error while setting up tapo platform for light
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 317, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 509, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 530, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 295, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 321, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 481, in state_attributes
data[ATTR_COLOR_TEMP] = self.color_temp
File "/config/custom_components/tapo/light.py", line 66, in color_temp
return kelvin_to_mired(color_temp)
File "/usr/src/homeassistant/homeassistant/util/color.py", line 517, in color_temperature_kelvin_to_mired
return math.floor(1000000 / kelvin_temperature)
ZeroDivisionError: division by zero

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.