Giter Site home page Giter Site logo

Question: Tapo P115 Energy Data about tapo HOT 14 CLOSED

tuvok81 avatar tuvok81 commented on May 24, 2024
Question: Tapo P115 Energy Data

from tapo.

Comments (14)

mihai-dinculescu avatar mihai-dinculescu commented on May 24, 2024

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.

tuvok81 avatar tuvok81 commented on May 24, 2024

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.

mihai-dinculescu avatar mihai-dinculescu commented on May 24, 2024

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.

tuvok81 avatar tuvok81 commented on May 24, 2024

I'm not that good at programming things... I'll see if I can find something

thanks

from tapo.

tuvok81 avatar tuvok81 commented on May 24, 2024

hm i dont no .. iam to stupid for this manual ..

from tapo.

mihai-dinculescu avatar mihai-dinculescu commented on May 24, 2024

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.

tuvok81 avatar tuvok81 commented on May 24, 2024

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.

tuvok81 avatar tuvok81 commented on May 24, 2024

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.

tuvok81 avatar tuvok81 commented on May 24, 2024

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.

pwoerndle avatar pwoerndle commented on May 24, 2024

Looks like the environment variables are still not read properly.

Try the following:

  1. 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")?;
  1. 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.

tuvok81 avatar tuvok81 commented on May 24, 2024

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.

tuvok81 avatar tuvok81 commented on May 24, 2024

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.

pwoerndle avatar pwoerndle commented on May 24, 2024

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.

tuvok81 avatar tuvok81 commented on May 24, 2024

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)

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.