Comments (14)
Yes, it is possible, and this example shows you how.
The username and password are the e-mail and password you use to log into the TP-Link mobile app.
from tapo.
AH ok thank you but i think i have a other fail ..
python tapo_p110.py Traceback (most recent call last): File "/home/websdr/Downloads/tapo_p110.py", line 61, in <module> asyncio.run(main()) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/home/websdr/Downloads/tapo_p110.py", line 15, in main client = ApiClient(tapo_username, tapo_password) TypeError: argument 'tapo_username': 'NoneType' object cannot be converted to 'PyString'
from tapo.
It looks like it's complaining that the tapo_username variable is empty.
The example is trying to read it from an environment variable. Have you set the environment variables? The README has a section on that.
from tapo.
I'm not that good at programming things... I'll see if I can find something
thanks
from tapo.
hm i dont no .. iam to stupid for this manual ..
from tapo.
On Linux/Mac you can give values to environment variables like this
export [email protected]
export TAPO_PASSWORD=your-tapo-password
export IP_ADDRESS=192.168.1.XXX
On Windows you can do it with
set [email protected]
set TAPO_PASSWORD=your-tapo-password
set IP_ADDRESS=192.168.1.XXX
from tapo.
OK .. i have add the username and password and Ip here
tapo_username = os.getenv("@gmx.de")
tapo_password = os.getenv("**")
ip_address = os.getenv("192.168.168.21")
and where i add the export lines? at the top of the script? i use Linux Ubunut .. and SORRY for the many stupid questions..
from tapo.
OK i have see my poetry make some things ..
pipx upgrade poetry
poetry is already at latest version 1.6.1 (location: /root/.local/pipx/venvs/poetry)
poetry install
The lock file is not compatible with the current version of Poetry.
Upgrade Poetry to be able to read the lock file or, alternatively, regenerate the lock file with the poetry lock
command.
no idea
from tapo.
Puhh.. i have no idea .. what i do here ..
Compiling tokio-macros v2.1.0
Compiling num_cpus v1.16.0
Compiling base16ct v0.2.0
Compiling base64 v0.21.4
Compiling lazy_static v1.4.0
Compiling tapo v0.7.4 (/home/websdr/Downloads/tapo/tapo)
Compiling tokio v1.33.0
Compiling pretty_env_logger v0.5.0
Finished dev [unoptimized + debuginfo] target(s) in 2m 07s
Running target/debug/examples/tapo_p110
Error: NotPresent
websdr@wmk:~/Downloads/tapo$ cargo run --example tapo_p110
Finished dev [unoptimized + debuginfo] target(s) in 0.21s
Running target/debug/examples/tapo_p110
Error: NotPresent
from tapo.
Looks like the environment variables are still not read properly.
Try the following:
- Change the variable definitions in
examples/tapo_p110
back to the original version:
let tapo_username = env::var("TAPO_USERNAME")?;
let tapo_password = env::var("TAPO_PASSWORD")?;
let ip_address = env::var("IP_ADDRESS")?;
- Before executing
cargo run --example tapo_p110
execute the following commands @mihai-dinculescu suggested above on your Linux shell using your own credentials and the IP of your device:
export [email protected]
export TAPO_PASSWORD=your-tapo-password
export IP_ADDRESS=192.168.1.XXX
cargo run --example tapo_p110
from tapo.
AHH thanks it run!! but .... the cargo run have disable the plug .. and the maschine goes offline where is on the plug hmm
2023-10-15T11:22:11.527Z INFO tapo_p110 > Energy data (hourly): EnergyDataResult { local_time: 2023-10-15T13:22:10, data: [13, 14, 13, 14, 13, 14, 13, 14, 14, 13, 14, 13, 16, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], start_timestamp: 1697328000, end_timestamp: 1697414399, interval: 60 }
2023-10-15T11:22:11.572Z INFO tapo_p110 > Energy data (daily): EnergyDataResult { local_time: 2023-10-15T13:22:10, data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 486, 186, 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], start_timestamp: 1696118400, end_timestamp: 1696118400, interval: 1440 }
from tapo.
OK the last step is the poetry Problem
@pwoerndle can you help here?
poetry shell
Spawning shell within /home/websdr/.cache/pypoetry/virtualenvs/tapo-Vr2UzEfI-py3.10
websdr@wmk:~/Downloads/tapo/tapo-py$ . /home/websdr/.cache/pypoetry/virtualenvs/tapo-Vr2UzEfI-py3.10/bin/activate
(tapo-Vr2UzEfI-py3.10) websdr@wmk:~/Downloads/tapo/tapo-py$ export TAPO_USERNAME=*gmx.de
(tapo-Vr2UzEfI-py3.10) websdr@wmk:~/Downloads/tapo/tapo-py$ export TAPO_PASSWORD=*
(tapo-Vr2UzEfI-py3.10) websdr@wmk:~/Downloads/tapo/tapo-py$ export IP_ADDRESS=192.168.10.5
(tapo-Vr2UzEfI-py3.10) websdr@wmk:~/Downloads/tapo/tapo-py$ python examples/tapo_p110.py
Traceback (most recent call last):
File "/home/websdr/Downloads/tapo/tapo-py/examples/tapo_p110.py", line 7, in <module>
from tapo import ApiClient, EnergyDataInterval
ModuleNotFoundError: No module named 'tapo'
from tapo.
I'm not super familiar with the python build, but did you run poetry install
before running poetry shell
?
If your just interested in trying out and you don't need to build from source, you could also just use pip
to install the tapo module and then run the example.
pip install tapo
export [email protected]
export TAPO_PASSWORD=your-tapo-password
export IP_ADDRESS=192.168.1.XXX
python examples/tapo_p110.py
from tapo.
i haved do pip install tapo and poetry install .. before i run .. i have not copy this from the shell sorry
from tapo.
Related Issues (20)
- Failed to install and use API HOT 2
- missing field `re_power_type HOT 16
- ImportError: cannot import name 'ApiClient' from partially initialized module 'tapo' (most likely due to a circular import) HOT 5
- [Improvement] Schedule HOT 4
- Add support for timeout parameter on device connection HOT 1
- Tapo: SessionTimeout HOT 3
- P300 support HOT 3
- Support for security cameras HOT 3
- get_device_info broken for L900 HOT 2
- [info] How can i use this in a windows C# Application. HOT 1
- [Feature Request] Please add audio reactive lighting control HOT 1
- Is it mandatory to use the Hub? HOT 2
- P115 changing WI-FI HOT 5
- H100 initialization attempt returns error HOT 4
- Support client.getDeviceList HOT 3
- Example for doing things with devices accessed throung the hub HOT 1
- Local access to TAPO P110 for energy data HOT 9
- S500D support HOT 3
- cannot import 'LightHander' or 'ColorLightHandler' for typings HOT 3
- Meaning / correctness of timestamps of device.get_energy_data HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tapo.