fishbigger / tapop100 Goto Github PK
View Code? Open in Web Editor NEWA module for controlling the TP-Link Tapo P100 Plugs
License: MIT License
A module for controlling the TP-Link Tapo P100 Plugs
License: MIT License
Apologies if this is the wrong location to request help on getting this code to work, but could not find any other way on this project page to ask for help. If I overlooked the correct way of asking for help, please let me know the correct way.
I am assuming that the Tapo P110 smart plug is supported by this project.
After installing the dependency with 'pip3 install PyP100', I cannot get the below code to work (taken straight from the README.md page):
from PyP100 import PyP100
p100 = PyP100.P100("192.168.X.X", "[email protected]", "Password123") #Creating a P100 plug object
p100.handshake() #Creates the cookies required for further methods
p100.login() #Sends credentials to the plug and creates AES Key and IV for further methods
p100.turnOn() #Sends the turn on request
p100.turnOff() #Sends the turn off request
p100.getDeviceInfo() #Returns dict with all the device info
I have of course substituted the IP address (from the working Tapo android app) and user name and password (the same as what I use to log into the Tapo account). When I run the code, there is a stacktrace suggesting there is a timeout. The Tapo app on my phone works fine.
I have only added the last part of the stack trace because as far as I can see, that is the most important/interesting one
Traceback (most recent call last):
File "/Users/robafett/PycharmProjects/BatterySaver/venv/lib/python3.9/site-packages/requests/adapters.py", line 507, in send
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='192.168.5.129', port=80): Max retries exceeded with url: /app (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x10b6b4a90>, 'Connection to 192.168.5.129 timed out. (connect timeout=2)'))
python-BaseException
It works perfect if the script is executed from the same network where the device is conected, but it doesn´t work from outside.
Through the app it is possible to control it even if it is not connected to wifi.
Any Ideas?
I´m leaving the same local ip address on the script
p100 = PyP100.P100("192.168.X.X", "[email protected]", "Password123") #Creating a P100 plug object
I get the following error when I'm calling the login method with my Tapo P100 device.
Traceback (most recent call last):
File "/home/jensjp/Repos/TapoP100/PyP100/PyP100.py", line 177, in login
self.token = ast.literal_eval(decryptedResponse)["result"]["token"]
KeyError: 'result'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jensjp/Repos/TapoP100/test.py", line 9, in <module>
p100.login()
File "/home/jensjp/Repos/TapoP100/PyP100/PyP100.py", line 182, in login
raise Exception(f"Error Code: {errorCode}, {errorMessage}")
Exception: Error Code: -1501, Invalid Request or Credentials
The decryptedResponse variable returns the error code; {"error_code":-1501}}.
All the methods worked fine until mid desember. The first occurrence of the
problem may have started with a password change to my tp-link account (not
sure).
maintain connection with session for faster response
Trying to install this and constantly getting this error
The conflict is caused by: pyp100 0.0.13 depends on pycryptodome==3.9.8 pyp100 0.0.12 depends on pycryptodome==3.9.8 pyp100 0.0.11 depends on pycryptodome==3.9.8 pyp100 0.0.9 depends on pycryptodome==3.9.8 pyp100 0.0.8 depends on pycryptodome==3.9.8 pyp100 0.0.7 depends on pycryptodome==3.9.8 pyp100 0.0.6 depends on pycryptodome==3.9.8 pyp100 0.0.5 depends on pycryptodome==3.9.8 pyp100 0.0.4 depends on pycryptodome==3.9.8 pyp100 0.0.3 depends on pycryptodome==3.9.8 pyp100 0.0.2 depends on pycryptodome==3.9.8 pyp100 0.0.1 depends on pycryptodome==3.9.8
I have this problem [Tapo Smart Platform] 333 Error Code: -1501, Invalid Request or Credentials
Any help?
am getting this on debian 11.2.
I am able to login to https://www.tplinkcloud.com c&p credentials used in my script. Ideas?
p100-on.py
from PyP100 import PyP100
p100 = PyP100.P100("10.20.10.102", "x", "x") #Creating a P100 plug object
p100.handshake() #Creates the cookies required for further methods
p100.login() #Sends credentials to the plug and creates AES Key and IV for further methods
#p100.turnOn() #Sends the turn on request
#p100.turnOff() #Sends the turn off request
p100.getDeviceInfo() #Returns dict with all the device info
$ python3 p100-on.py
Traceback (most recent call last):
File "/home/x/.local/lib/python3.9/site-packages/PyP100/PyP100.py", line 159, in login
self.token = ast.literal_eval(decryptedResponse)["result"]["token"]
KeyError: 'result'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/x/p100-on.py", line 6, in <module>
p100.login() #Sends credentials to the plug and creates AES Key and IV for further methods
File "/home/x/.local/lib/python3.9/site-packages/PyP100/PyP100.py", line 163, in login
raise Exception(f"Error Code: {errorCode}, {errorMessage}")
Exception: Error Code: -1501, Invalid Request or Credentials
Hi,
it seems the version currently available through pip/pypi is defective. Installing it using pip install results in an error claiming that HISTORY.md is missing.
Collecting PyP100 Using cached PyP100-0.0.10.tar.gz (4.2 kB) ERROR: Command errored out with exit status 1: command: /opt/PyP100/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-x2xw5199/pyp100_bd86ff7b0573446fb087dd6d6c10caee/setup.py'"'"'; __file__='"'"'/tmp/pip-install-x2xw5199/pyp100_bd86ff7b0573446fb087dd6d6c10caee/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-2ueeyzso cwd: /tmp/pip-install-x2xw5199/pyp100_bd86ff7b0573446fb087dd6d6c10caee/ Complete output (5 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-x2xw5199/pyp100_bd86ff7b0573446fb087dd6d6c10caee/setup.py", line 6, in <module> with open('HISTORY.md') as history_file: FileNotFoundError: [Errno 2] No such file or directory: 'HISTORY.md' ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Using the TapoP100 library on a raspberry pi running WebThings
Brief search on google reveals it maybe an issue with the PyP100 library particularly the function used to export the public RSA Key
I think we should be using the exportKey function not export_key but I am not a Python coder.
Log details below
2021-01-28 22:21:47.290 INFO : Fetching add-on https://github.com/WebThingsIO/tapo-adapter/releases/download/v0.0.1/tapo-adapter-0.0.1-linux-arm-v3.7.tgz as /tmp/cLFylT/tapo-adapter.tar.gz
2021-01-28 22:21:50.497 INFO : Expanding add-on /tmp/cLFylT/tapo-adapter.tar.gz
2021-01-28 22:22:17.673 INFO : Loading add-on: tapo-adapter
2021-01-28 22:22:36.746 INFO : Unloading TapoAdapter
2021-01-28 22:22:38.460 INFO : tapo-adapter: Failed to connect to 192.168.0.59: _RSAobj object has no 'export_key' attribute
2021-01-28 22:22:38.463 INFO : tapo-adapter: Failed to connect to 192.168.0.60: _RSAobj object has no 'export_key' attribute
2021-01-28 22:22:38.465 INFO : tapo-adapter: Failed to connect to 192.168.0.61: _RSAobj object has no 'export_key' attribute
2021-01-28 22:22:38.468 INFO : tapo-adapter: Failed to connect to 192.168.0.62: _RSAobj object has no 'export_key' attribute
I'll probably create a PR for this shortly.
I get this randomly off a plug
Not sure if this was a design decision, to put the decrypt outside the try statement?
Line 156 in 2d34789
INFO:root:Traceback (most recent call last):
File "./plugcontroller.py", line 51, in plug_turn_off
p100.login()
File "/usr/local/lib/python3.7/dist-packages/PyP100/PyP100.py", line 156, in login
decryptedResponse = self.tpLinkCipher.decrypt(r.json()["result"]["response"])
KeyError: 'result'
This could be fixed with return json.loads(decryptedResponse) at end of definition.
Trying to write an similar app in scala /java.
But for some reason and can't get the correct reply from the login. I can make my repo public if you have time @fishbigger ?
Or I'm on ....
Steve
Hi,
After upgrade HA to 2022.3.0b0 in logs I see error connected to pypa/pip#10825
2022-02-24 07:41:04 ERROR (SyncWorker_4) [homeassistant.util.package] Unable to install package PyP100==0.0.18: warning: missing-index-doctype
× The package index page being used does not have a proper HTML doctype declaration.
╰─> Problematic URL: https://wheels.home-assistant.io/alpine-3.14/amd64/
note: This is an issue with the page at the URL mentioned above.
hint: You might need to reach out to the owner of that package index, to get this fixed. See pypa/pip#10825 for context.
ERROR: Cannot install pyp100==0.0.18 because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
From Home Assistant side there is general issue home-assistant/home-assistant.io#21766
Hi.
Could you please explain what units certain metrics use?
"today_runtime": 672, => s
"month_runtime": 1606, => s
"today_energy": 508, => kWh
"month_energy": 863, kWh
"current_power": 45147 => mW ?
"past24h"
"past30d"
Thought I'd create this issue here just so it's findable on the repo, but please feel free to label it wontfix @fishbigger
Trying to use this package brought this issue to my attention.
When you change your TP-Link password, your plug password doesn't change. This may (hopefully!) be fixed in a TP-Link firmware update at some point, but right now, as of firmware 1.34 Build 20200925 Rel. 33922, this is how it is.
Therefore, you need to provide your original password at the time of adding the plug for this to work. This also means that if you actually want to change your password, you should reset your plugs.
But I have to wonder how TP-Link themselves are sending the old password if this is the case.
Is it possible to get this to work over the cloud rather than just locally?
I have been experiencing a -1301 error code (which isn't in the known list) when doing pretty much anything with my tapo L530.
Failure seems sporadic as it happens randomly.
I have been able to setup a bulb and connect it. Turning the bulb off and setting the brightness works, but if I use the switch in homeassistant to turn it on, I'm receiving the following error.
2022-02-02 23:19:18 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [2964029176] Error Code: -1003, JSON formatting error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 494, in async_handle_light_on_service
await light.async_turn_on(**filter_turn_on_params(light, params))
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 948, in async_turn_on
await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/tapo_p100_control/light.py", line 89, in turn_on
self._l530.setBrightness(newBrightness)
File "/usr/local/lib/python3.9/site-packages/PyP100/PyL530.py", line 42, in setBrightness
raise Exception(f"Error Code: {errorCode}, {errorMessage}")
Exception: Error Code: -1003, JSON formatting error
P110 plugs (https://www.tp-link.com/en/home-networking/smart-plug/tapo-p110/) allow for additional energy monitoring.
I'd like to contribute a PyP110 class inheriting from PyP100.
PyP110 class only has one function getEnergyUsage()
in order to retrieve the JSON object and return is as a dict
If you call Handshake() twice the second call will fail due to the contents of the response changing. This resulted in my HA module failing to access my switch due to the following error:
File "/config/custom_components/tapo_p100_control/switch.py", line 83, in update self._p100.handshake() File "/usr/local/lib/python3.9/site-packages/PyP100/PyP100.py", line 124, in handshake encryptedKey = r.json()["result"]["key"] KeyError: 'result'
I'm not sure why HA is making the call twice but there is a simple fix (I tried to raise a PR but I don't seem to have access to push to my own branch). If you change the handshake logic in PyP100.py @ line 122 to:
r = requests.session().post(URL, json=Payload, timeout=2)
This forces a new HTTP session for each request meaning that any subsequent calls always come back with the correct payload.
He there.
Just trying to get your Python module working with Tapo P100, and I'm getting the following error messge:
`
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/PyP100/PyP100.py", line 155, in login
self.token = ast.literal_eval(decryptedResponse)["result"]["token"]
KeyError: 'result'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./p100.py", line 11, in
p100.login()
File "/usr/local/lib/python3.6/dist-packages/PyP100/PyP100.py", line 159, in login
raise Exception(f"Error Code: {errorCode}, {errorMessage}")
Exception: Error Code: -1501, Invalid Request or Credentials
`
I am pretty sure that all info is currect, as can successfully connect from Tapo app. Tried both version from pip and from GitHub with the same result. Don't know where the problem could be as I'm bad a Python coder However I was able to log in to tpcloud via curl and even see that device, althous it says tht it is offline.
Could you please recommed me what to do?
Thanks in advance.
Which devices support fade mode?
Can it be implemented like fade_toBrightness(100)?
Hi,
I have my Tapo in a remote location and I want to control them from my home, is that possible?
Its working at 100%. Easy to use and free thank you for your work and sharing with us.
if you have this issue like i did, in this scenario i was in python version 3.9, downgrading to 3.8 fixed the job to install this module successfully.
hope this helped at least one person
File "d:\Github\MCEmbeddedLight\pyreciever\mcrcon_manager.py", line 17, in mcrcon_manage
bulb.setBrightness(level)
File "C:\Users\Max\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyP100\PyL530.py", line 41, in setBrightness
errorMessage = self.errorCodes[str(errorCode)]
KeyError: '-1301'
-1301 is absent in ERROR_CODES.
could you manage plugin for octoprint? I tried to install and had error with from PyP100 import PyP100. even i installed we need web interface or control system. could you make like tp-link plugin?
I cant login into P100 - i did check password to tp-link cloud
any one home some idea?
I got error:
p100 = PyP100.P100("192.168.X.X", "[email protected]", "Password123")
p100.handshake()
p100.login()
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/PyP100/PyP100.py", line 163, in login
self.token = ast.literal_eval(decryptedResponse)["result"]["token"]
KeyError: 'result'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.10/dist-packages/PyP100/PyP100.py", line 167, in login
raise Exception(f"Error Code: {errorCode}, {errorMessage}")
Exception: Error Code: -1501, Invalid Request or Credentials
Hello,
first of all thank you for the work done.
here, I can't install the dependency "pip3 intall PyP100"
pi@octopi:~ $ pip3 install PyP100
-bash: pip3: command not found
I can't find anywhere the *.py files modified to enter the email and password for a P110.
Could you please help me ?
thank you
I was trying to use this library with my l900 led strip like my bulb, at first it worked, then it started to work with one function and spit out a handshake error and now it won't even login
james@james-desktop:~/Documents/TAPO-And-Govee-Controller-py$ python3 main.py
Traceback (most recent call last):
File "/home/james/Documents/TAPO-And-Govee-Controller-py/main.py", line 25, in <module>
lightStrip.login()
File "/home/james/.local/lib/python3.9/site-packages/PyP100/PyP100.py", line 156, in login
decryptedResponse = self.tpLinkCipher.decrypt(r.json()["result"]["response"])
File "/home/james/.local/lib/python3.9/site-packages/requests/models.py", line 898, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 525, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Hello,
Got a pair of P100 working fine with older FW (1.2.something from the top of my mind.
I've updated the firmware to latest, and protocol seems to have changed: now the response in PyP100 does not seem to contain JSON, and getting key fails.
Expanding response (r) gives a HTML document:
<HTML>
<HEAD>
<TITLE>Forbidden</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Forbidden</H1>
So here we go.
Does anybody have an idea? How could I investigate to help going further?
Hi @fishbigger thx for this project, I started to port it to Node/TS. Is there any reference to the complete flow of communication with the Tapo server? (handshaking, keys to be passed, etc etc)
Do you reverse engineer it from scratch or there's some documentation available? Thx a lot!
I was wondering if or when support for the RGB Lightbulb L530 will be added.
Thanks in advance and best regards
Hi, can i know if the tapo is on/off?
I wan to execute turnOff() if the tapo was on and turnOn() if the tapo was off.
Thanks.
Is there any way we could set timer on or off to the device?
If your password is longer than 8 characters, you will always get a 1501.
However, your password can contain non-alphanumeric characters.
Does the Plug need an Internet connection?
Hi guys, I am facing this issue after following the instruction example:
Traceback (most recent call last):
File "p100_test.py", line 1, in <module>
from PyP100 import PyP100
File "/home/pi/.local/lib/python3.5/site-packages/PyP100/PyP100.py", line 73
decode: bytes = b64decode(key.encode("UTF-8"))
^
SyntaxError: invalid syntax
My code:
from PyP100 import PyP100
p100 = PyP100.P100("192.168.1.163", "[email protected]", "12345") #Creating a P100 plug object
p100.handshake() #Creates the cookies required for further methods
p100.login() #Sends credentials to the plug and creates AES Key and IV for further methods
p100.turnOn() #Sends the turn on request
p100.setBrightness(100) #Sends the set brightness request
p100.turnOff() #Sends the turn off request
p100.getDeviceInfo() #Returns dict with all the device info
Thanks in advanced 😁
Hello, I was wondering if you ever had any luck controlling Tapo devices via the cloud? I can see some old legacy code in PyP100.py, and this will give me a list of devices:
import uuid
import requests
termId = str(uuid.uuid4())
payload = {
'method': 'login',
'params': {
'appType': 'Kasa_Android',
'cloudUserName': username,
'cloudPassword': password,
'terminalUUID': termId
}
}
url = 'https://wap.tplinkcloud.com'
r = requests.post(url, json=payload)
params = {
'token': r.json()['result']['token'],
'appName': 'Kasa_Android',
'termID': termId,
}
payload2 = {"method": "getDeviceList"}
r2 = requests.post(url, params=params, json=payload2)
print(r2.json()["result"]["deviceList"])
But any attempt to control them, eg:
controlUrl = r2.json()["result"]["deviceList"][0]["appServerUrl"]
deviceId = r2.json()["result"]["deviceList"][0]["deviceId"]
payload3 = {
"method": "passthrough",
"params": {
"deviceId": deviceId,
"requestData": {"system":{"set_led_off":{"off": 1}}}
}
}
r3 = requests.post(controlUrl, params=params, json=payload3)
print(r3.json())
gives
{'error_code': -20571, 'msg': 'Device is offline'}
Do you get the same?
Many thanks, Mark
This is the error I am getting on trying to login:
raise JSONDecodeError("Expecting value", s, err.value) from None
I am trying out with the 530B bulb and the following code:
from PyP100 import PyL530
l530 = PyL530.L530("ipaddress", "username", "password") #Creating a L530 bulb object
l530.handshake() #Creates the cookies required for further methods
l530.login() #Sends credentials to the plug and creates AES Key and IV for further methods
handshake happens without any errors, the error pops up during login
When I was trying to go through other issues, it was suggested that it might be an authentication related issue, but changing passwords did not help either. I am also making sure its an 8 digit password.
Please let me know if any other information is required, I request you to help me solve this, Thanks!
Hello,
I don't have enough experience with python programming, but I'm using HASS via not very reliable connection. Hopefully will fix soon. But, I've noticed that after HASS server restarts, my bulb become unavailable after some time.
WARNING (MainThread) [homeassistant.components.light] Updating tapo_p100_control light took longer than the scheduled update interval 0:00:30
Using tcpdump, I've noticed that there is no traffic going to the IP address of the bulb.
Initializing HASS restart - drops python error
homeassistant | 2021-08-19 16:56:35 WARNING (MainThread) [homeassistant.util.executor] Thread[SyncWorker_3] is sti
ll running at shutdown: File "/usr/local/lib/python3.9/threading.py", line 930, in _bootstrap
homeassistant | self._bootstrap_inner()
homeassistant | File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner
homeassistant | self.run() homeassistant | File "/usr/local/lib/python3.9/threading.py", line 910, in run
homeassistant | self._target(*self._args, **self._kwargs)
homeassistant | File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 77, in _worker
homeassistant | work_item.run()
homeassistant | File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
homeassistant | result = self.fn(*self.args, **self.kwargs)
homeassistant | File "/config/custom_components/tapo_p100_control/light.py", line 191, in update
homeassistant | def update(self): homeassistant | File "/usr/local/lib/python3.9/site-packages/PyP100/PyP100.py", line 114, in handshake homeassistant | r = requests.post(URL, json=Payload)
homeassistant | File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 119, in post homeassistant | return request('post', url, data=data, json=json, **kwargs) homeassistant | File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
homeassistant | return session.request(method=method, url=url, **kwargs) homeassistant | File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
homeassistant | resp = self.send(prep, **send_kwargs) homeassistant | File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
homeassistant | r = adapter.send(request, **kwargs) homeassistant | File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
homeassistant | resp = conn.urlopen( homeassistant | File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
homeassistant | httplib_response = self._make_request( homeassistant | File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 440, in _make_requ
est
homeassistant | httplib_response = conn.getresponse() homeassistant | File "/usr/local/lib/python3.9/http/client.py", line 1349, in getresponse
homeassistant | response.begin()
homeassistant | File "/usr/local/lib/python3.9/http/client.py", line 316, in begin
homeassistant | version, status, reason = self._read_status()
homeassistant | File "/usr/local/lib/python3.9/http/client.py", line 277, in _read_status
homeassistant | line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
homeassistant | File "/usr/local/lib/python3.9/socket.py", line 704, in readinto
homeassistant | return self._sock.recv_into(b)
so.. my logical conclusion was that some kind of process just doesn't die.
I did open a source code and found
r = requests.post(URL, json=SecurePassthroughPayload, headers=headers)
First link in google showed me
https://docs.python-requests.org/en/master/user/quickstart/#timeouts
If no timeout is specified explicitly, requests do not time out.
I've modified the script and testing locally. Hopefully it will fix my issue.
Thanks
Check this comment!
pycrypto is not maintained anymore, and it need to be changed to pycryptodome.
The method returns the decrypted energy usage as a string and not a dictionary created with json.loads similiar to getDeviceInfo
Calling P100.getDeviceName() always results in Exception "the JSON object must be str, bytes or bytearray, not dict"
2022-01-09 18:55:20 ERROR (MainThread) [custom_components.tplink_tapo_cloud.config_flow] Unexpected exception
Traceback (most recent call last):
---cut---
File "/srv/homeassistant/lib/python3.9/site-packages/PyP100/PyP100.py", line 356, in getDeviceName
data = json.loads(data)
File "/usr/lib/python3.9/json/init.py", line 339, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not dict
Introduced with PR #21
See my comment 7d3d25b#r63179338
Do you know by any chance how to make the plug to be ON after its powered up by default? I want to make the plug to be switched ON by default, because it goes OFF after power outage.
There is huge interest in this feature: community.tp-link.com/en/home/forum/topic/215412 but seems developers cannot do anything about it. Can you code this feature?
I have a L530 bulb and using this library I can turn it on and off and set the brightness.
It would be great to also be able to change the colour of the bulb.
The variables are:
color_temp - which according to the Tapo app takes values from 2500 to 6500
hue - values 0-360
saturation - values 0-100
I have got this working locally by essentially copying the setBrightness section and editing for these variables.
Can I can put this in as a pull request?
is there any chance to get consumption from p100 with Home Assistant? or it's only switch?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.