[Custom Component] Tapo P100 Plug Control

I now updated to latest firmware 1.4.10 built 20211104 and I still get the same error.

2022-01-28 12:42:13 ERROR (MainThread) [custom_components.tapo.common_setup] Error fetching tapo data:
2022-01-28 12:42:24 ERROR (MainThread) [custom_components.tapo.common_setup] Error fetching tapo data:

Iā€™m happy to announce that my integration is officially added to HACS store. So you donā€™t need anymore to add my repository as a custom one.

Sorry, but Iā€™m confused, This logs are from HA or the script that I have posted? Try to run only my script and post here the log.

In my p100 Iā€™ve 1.3.6. I donā€™t know if the problem is related to your firmware version. Anyway, try to run this script and post here the result.

import asyncio
from plugp100 import TapoApiClient


async def main():
    # create generic tapo api
    sw = TapoApiClient("<ip>", "<email>", "<passwd>")
    await sw.login()
    print(await sw.get_state())

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.run_until_complete(asyncio.sleep(0.1))
loop.close()

Hi Pedro,

Thanks for all the hard work, and great news on getting on to HACS.

Iā€™m embarrassed to say that Iā€™m not sure where this script should be runā€¦ could you clarify, and will do the same.

No problem, copy this code into a python file, like main.py and run it using python python main.py. Be sure to run on an environment where plugp100 is installed. If you receive an error like no plugp100 found install it using pip: pip install plugp100=2.1.13b1.

Okay. Thanks. I suspect I speak for a number of HA users, but thatā€™s still stretching my familiarity with the core OS. Iā€™m running HA in HAOS, with very limited Linux knowledge. I know the basics, but where are we going for thisā€¦? Terminal in HA, or logging in to the Linux install?

Hi Pedro, re -

Sorry, but Iā€™m confused,ā€¦

I think the output you want is as follows from the linux command line -

ian@CapHA1:~$ pwd
/home/ian
ian@CapHA1:~$ python3 /HomeAssistant/pyscript/tapo-test.py
f759................................f718
TapoDeviceState(device_id='80224.....................0EC2', mac='C0-06-C3-F5-1D-F4', nickname='lamp 9', model='P100', type='SMART.TAPOPLUG', device_on=False, brightness=None, hue=None, saturation=None, color_temp=None, overheated=False, signal_level=1, rssi=-70, energy_info=None)
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f60131e35b0>

(I put the dots in above, as I was not sure what was coded in those stringsā€¦).

BUT - I have also got the switches working - BUT I had to add them one at a time via the GUI (nothing in the configuration.yaml now for the P100s).
Even then, I was getting the occasional failure to (I forget the message sorry - either connect to the device or authenticate), and I had to just redo it, and usually worked the 2nd time.

UPDATE - it was ā€œInvalid authenticationā€ - as I just had anotherā€¦

Cheers, Ian

So with UI works? And with configuration.yaml doesnā€™t?

Yes, I think you can use a terminal in HA, if python command is available.

Thank you, sooo much this works really well 8 sockets and no reboots ā€¦(via the integration GU)

Hiya @pedro96 Hope you are OK and having a great week :slight_smile: Sorry, I promised an update on my installation, but have been hampered (as we all are) but life/work etc. :slight_smile: I had a new pack of Tapo L530 bulbs, which would have finished off my house, from normal, to all smart bulbs :slight_smile: I tried for over a week to get one of the bulbs linking up, and seemed to manage to mess up my HA in the process X-) (Totally my fault/problem) but just in case anyone else is reading on - I couldnā€™t get the TAPO Controller integration to work (please read on to see why!) and so I tried to uninstall and re-install it - strangely, even though Iā€™ve been in the business for 27 years now, I found trying to remove an integration to be somewhat of a mystic art :wink: , and probably ended up removing all the wrong things - SO the lesson of the start of my paragraph, is don;t just try and remove this integration, as it does work!, and if you are careless like me, you get to reinstall HA again :wink: :slight_smile:

Onto the main reason for my update - firstly, again thanks for writing this awesome integration :smiley: I really like the output from the Tapo bulbs, so it would be a shame to have to migrate to another bulb type (not including the cost of course!)

The actual reason the new bulb didnā€™t work, was a bit more obvious when I took the initiative to look in the right/obvious place :slight_smile:

The new bulb is not just new firmware, but new hardware, compared to all my other bulbs. The new one is

  • Model ā€œTapo L530ā€
  • Hardware Version ā€œ2.0ā€
  • Firmware Version ā€œ1.0.6 Build 211029 Rel. 105823ā€

The old one is :

  • Model ā€œTapo L530 Seriesā€
  • Hardware Version ā€œ1.0ā€
  • Firmware Version ā€œ1.1.9ā€

So I am pretty sure there must be a variation of command set , or something slightly different on the newer hardware/firmware.

It does integrate via the UI, and Iā€™m pretty sure it comes up as a match to the L530 , as you get a colour picker chart, when selecting the bulb in HA.

When controlling the bulb, it allows you to turn on and off, and the slider works from cool to warm incrementally all ok.

If you try and change the brightness, you get an error popping up in the bottom left of the screen in HA, saying: ā€œfailed to call service light/tun_on. Index out of rangeā€

If you try and use the colour picker, you get a message saying ā€œfailed to call service light/turn_on, None-Typeā€ (and then something I havenā€™t caught yet, as it goes too quick.

After trying to use these a few times, it seems to crash the bulb, and it becomes unresponsive. Sometimes it will come back online in a few minutes, otherwise you can off/on it from the mobileTapo app (Iā€™ve not blocked internet access , while migrating/setting up) , or powering it off/on works too.

if you have some pointers to decrypt the traffic, I can probably setup a port mirror, and capture the app talking to the new hardware bulb, and pass on the info to you, in case this is indeed different in hardware 2.0 to hardware 1.0 :slight_smile:

Sorry for the long rambling message, hope this helps, and thanks in advance if you have time to investigate this new model too :slight_smile:

Cheers, pi

Sorry, I forgot to add, after failing at this for a week, I tried again but with one of my original bulbs, and it worked perfectly first time :slight_smile: (again, thanks!) :slight_smile: :slight_smile: So I can get on and do all the other bulbs, led strips, and power sockets in the meantime :slight_smile:

Hi @automic, to allow me to check if there are some differences between the two model, you can try to execute this snippet of code. Execute this 2 or 3 times, and before each execution change the brightness from tapo app. You can post here the output.

import asyncio
from plugp100 import TapoApiClient


async def main():
    # create generic tapo api
    sw = TapoApiClient("<ip>", "<email>", "<passwd>")
    await sw.login()
    print(await sw.get_state())

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.run_until_complete(asyncio.sleep(0.1))
loop.close()

Additionally, you can execute the same script on your ā€œoldā€ L530 :slight_smile:

EDIT: @automic another user has opened a new issue on Github which report a problem with L530. Iā€™ve asked him the version of tapo, and he reported the same hardware and firmware version reported by you. So there is an issue regarding hardware/software versions. The only way to solve this is to execute my snippet code and report the output. When you have an output, can you publish it on github at https://github.com/petretiandrea/home-assistant-tapo-p100/issues/133#issuecomment-1032903811? In this way I can track the issue. Thanks

Hiya @pedro96 :slight_smile: Thanks very much for this, am late back from work, but Iā€™ll have a go running that tomorrow, to get some examples for you :slight_smile: Thanks :slight_smile:

Hi guys, Iā€™ve release right now a new version 1.2.5, so try it, I hope will fix the brightness problem related to all bulbs and led strip. Also, Iā€™ve updated the README to provide a better explanation on how to install the integration and how to add a tapo device.

Release a new version 1.2.6 this probably will fix definitely problem with L530 and L900. Try it :slight_smile:

Hi all, I have one of the new L920 multicolor light strips.
The integration finds it and adds the device to HA (Iā€™m on v.1.2.8) but the only entities created are sensors for overheat and signal level, no light entity is created and I havenā€™t been able to find a way to control the light at all.

Are these supported yet? If not, is anyone able to advise on any info I can provide from that might help with adding them to this awesome integration?

Hi, to request a support for a new device, you must execute this python script and report the output. I suggest you to open a new issue on GitHub by posting the output of this script and tagging the issue as ā€œenhancementā€. Thanks :slight_smile:

import asyncio
from plugp100 import TapoApiClient


async def main():
    # create generic tapo api
    sw = TapoApiClient("<ip>", "<email>", "<passwd>")
    await sw.login()
    state = await sw.get_state()
    print(state.state)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.run_until_complete(asyncio.sleep(0.1))
loop.close()

Hi, is there a way, how this integration could set Default state for bulbs? Like during the night, I would like to have default state brightness of 25% and other times have 100%. I know I could achieve that with automation and movement sensors, but I am not having them right, so I am using regular switch to turn the lights on.

Idea is that in HA I would have automation, where trigger would be availability of bulb and then run a service which would set the default state.