petretiandrea / home-assistant-tapo-p100

A custom integration to control Tapo devices from home assistant.
MIT License
818 stars 102 forks source link

Support for new device: P300 Power Strip #336

Closed MichaelVetter1979 closed 1 year ago

MichaelVetter1979 commented 1 year ago

Is your feature request related to a problem? Please describe. It would be great to mange the new Tapo P300 Power Strip with this home assistant integration. The Tapo-Integration can already acces the device, but only shows entity "overheated". The plugs or switches are nt shown.

Describe the solution you'd like It would be realy nice, if the Integration would detect all entities of these devices.

Describe alternatives you've considered The Device also supports Homekit, but I have trouble reconnectiong with Homekit after an accidental device reset, since Homekit is not unpaired!

Device Info The results of this script are as follows:

loop = asyncio.get_event_loop() {'device_id': '802204A73CFCA2C07C85D342BA968DD120977015', 'fw_ver': '1.0.7 Build 220715 Rel.200458', 'hw_ver': '1.0', 'type': 'SMART.TAPOPLUG', 'model': 'P300', 'mac': 'AC-15-A2-F2-11-DB', 'hw_id': '553C7AE42A568240BEA222D090B68EF4', 'fw_id': '00000000000000000000000000000000', 'oem_id': 'BCA35E01AEBC6BD91465057372DDAB74', 'ip': '192.168.178.21', 'time_diff': 60, 'ssid': 'aGVhdmVu', 'rssi': -22, 'signal_level': 3, 'latitude': 515464, 'longitude': 68618, 'lang': 'de_DE', 'avatar': '', 'region': 'Europe/Berlin', 'specs': '', 'nickname': '', 'has_set_location_info': True} Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x000001F1992CF1C0> C:\Users\micha\main.py:22: RuntimeWarning: coroutine 'main' was never awaited main() RuntimeWarning: Enable tracemalloc to get the object allocation traceback

roulious commented 1 year ago

Bump! +1 for me

jelinj8 commented 1 year ago

+1

cornholio1234 commented 1 year ago

+1 πŸ‘

eugenzh commented 1 year ago

+1

blastbeng commented 1 year ago

+1

Quasaro commented 1 year ago

+1

sepa85 commented 1 year ago

+1

irozakos commented 1 year ago

+1

NikolasRupp commented 1 year ago

+1

StephB67 commented 1 year ago

+1 Please

williwkl commented 1 year ago

+1

naamah75 commented 1 year ago

+1

FloW227 commented 1 year ago

+1

Nathagniel commented 1 year ago

+1

Froyo10 commented 1 year ago

+1

gmarchett commented 1 year ago

+1

millenniumy2k commented 1 year ago

news?

gmarchett commented 1 year ago

+1

lillodipiazza commented 1 year ago

+1

cfrstr28 commented 1 year ago

+1

petretiandrea commented 1 year ago

@MichaelVetter1979 are you printing the unmapped_state? If not:

import asyncio

from plugp100 import TapoApiClient, TapoApiClientConfig

async def main():
    # create generic tapo api
    config = TapoApiClientConfig("<ip>", "<email>", "<passwd>")
    sw = TapoApiClient.from_config(config)
    await sw.login()
    state = await sw.get_state()
    print(state.get_unmapped_state())
lillodipiazza commented 1 year ago

Ci sono novitΓ ?

veniplex commented 1 year ago

+1 for supporting this device :)

Mel0ne commented 1 year ago

+1 supporting P300 needed like air 😁

pedrodparkes commented 1 year ago

+1

tobik176 commented 1 year ago

+1

petretiandrea commented 1 year ago

Hi guys, unfortunately, I don't have the p300 locally, so I can't test it. I've just released an experimental version of plugp100 (my library used by this integration). I need some one test it by following this:

  1. install plugp100 experimental version pip install plugp100==3.2.0
  2. execute this python script by replacing your username, password and the ip with the ip of p300.
    
    import asyncio

from plugp100.api.power_strip_device import PowerStripDevice from plugp100.api.tapo_client import TapoClient

async def main():

create generic tapo api

username = '<tapo_email>'
password = '<tapo_password>'

client = TapoClient(username, password)
power_strip = PowerStripDevice(client, "<tapo_device_ip>")
print(await power_strip.login())

print(await power_strip.get_state_as_json())
print(await power_strip.get_children())

if name == "main": loop = asyncio.new_event_loop() loop.run_until_complete(main()) loop.run_until_complete(asyncio.sleep(0.1)) loop.close()

StephB67 commented 1 year ago

Hi Andrea, I want make this test but i'm not very expert. I have a raspberry with HA OS I've installed Pyscript on this I've created a file P300.py in the folder pyscript I've restart HA But i don't know how i can install plugp100 experimental because the pip command is unknown in my terminal and i don't know how i can launch the script P300.py when the install is ok.

StephB67 commented 1 year ago

i test with my windows computer i use Edupython and i install the plugp100 3.2.0 when i run, i've this message : Traceback (most recent call last): File "C:\Users\steph\Documents\P300.py", line 4, in from plugp100.api.power_strip_device import PowerStripDevice File "C:\Program Files (x86)\EduPython\App\lib\site-packages\plugp100\api\power_strip_device.py", line 1, in from plugp100.api.tapo_client import TapoClient, Json File "C:\Program Files (x86)\EduPython\App\lib\site-packages\plugp100\api\tapo_client.py", line 12, in from plugp100.common.utils.json_utils import dataclass_encode_json, Json File "C:\Program Files (x86)\EduPython\App\lib\site-packages\plugp100\common\utils\json_utils.py", line 4, in Json = dict[str, Any] TypeError: 'type' object is not subscriptable

I need certainly an other library ?

StephB67 commented 1 year ago

Hi Andrea, I fixed the problem and I was able to run the script with the experimental version of plugp100 I have this return (one for each plug in the powerstrip, the label "position" indicate the plug) : {'fw_ver': '1.0.7 Build 220715 Rel.200458', 'hw_ver': '1.0', 'type': 'SMART.TAPOPLUG', 'model': 'P300', 'mac': 'xxxxxxxxxxxxx', 'hw_id': 'xxxxxxxxxxxxxxxx', 'fw_id': 'xxxxxxxxxxxxxxxxxxxxxxx', 'oem_id': 'xxxxxxxxxxxxxxxxxxxxxxx', 'category': 'plug.powerstrip.sub-plug', 'status_follow_edge': True, 'device_id': 'xxxxxxxxxxxxxxxxxxxxxxx', 'original_device_id': 'xxxxxxxxxxxxxxxxxxxxxxx', 'overheat_status': 'normal', 'bind_count': 1, 'on_time': 0, 'slot_number': 3, 'position': 2, 'nickname': 'xxxxxxxxxxxxxxxxxxxxxxx', 'avatar': 'tape_lights', 'device_on': False, 'default_states': {'type': 'last_states'}, 'region': 'Europe/Paris', 'latitude': 48xxxxx, 'longitude': 75xxxx, 'has_set_location_info': True}

petretiandrea commented 1 year ago

Will be available on 2.6.0 release, this is a preview:

p300

petretiandrea commented 1 year ago

Available on v2.6.0

StephB67 commented 1 year ago

Hi, Work fine, good job. Thank's for the time spare on this evolution.

lillodipiazza commented 1 year ago

Wonderful πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰