Comments (16)
That's brilliant, thank you. This error does make sense, and it's what I was afraid of.
I'll have a fix in the next couple of days.
from tapo.
It looks like this is a regression of the change in #135.
Can you please call get_device_info_json
instead of get_device_info
, and paste the output here?
from tapo.
After I changed get_device_info to get_device_info_json it works great.:
2024-01-19T09:11:54.974Z INFO tapo_l510 > Device usage: DeviceUsageEnergyMonitoringResult { time_usage: UsageByPeriodResult { today: 28, past7: 1211, past30: 13237 }, power_usage: UsageByPeriodResult { today: 1, past7: 172, past30: 1829 }, saved_power: UsageByPeriodResult { today: 27, past7: 1039, past30: 11408 } }
Thanks for the help and your great work mate!
from tapo.
Sorry, the output that's pasted above is for device usage.
Can you please provide the one for device info?
from tapo.
Sure, I just changed the sensitive parts.
Device info: Object {"avatar": String("bulb"), "brightness": Number(30), "default_states": Object {"brightness": Object {"type": String("last_states"), "value": Number(30)}}, "device_id": String("8023C0D888DD972F67F68BF0809ABE791EF4B5E0"), "device_on": Bool(false), "fw_id": String("7BECA9DC454565672FEC87D1104F9972"), "fw_ver": String("1.3.0 Build 20230831 Rel. 75926"), "has_set_location_info": Bool(true), "hw_id": String("93F94D88DA9499F43B929DD38EBDF09A"), "hw_ver": String("1.0.0"), "ip": String("xx.xx.xx.xx"), "lang": String("hu_HU"), "latitude": Number(21412431), "longitude": Number(212141), "mac": String("11-11-11-11-11-11"), "model": String("L510 Series"), "nickname": String("S29ueWhh"), "oem_id": String("6B97E8E19CE8019B59D9E81CEDD371BD"), "on_time": Number(0), "overheated": Bool(false), "region": String("Europe/Budapest"), "rssi": Number(-46), "signal_level": Number(3), "specs": String("EU"), "ssid": String("V29yay1OZXR3b3Jr"), "time_diff": Number(60), "type": String("SMART.TAPOBULB")}
Not fully okay as I see it now, because it wont get forexample the nickname correctly.
from tapo.
Thank you, this is very helpful.
The get_device_info_json
function gives the response as it comes from the Tapo API without trying to parse it in any way. Decoding the nickname is part of the parsing that get_device_info
does.
I know what needs changing now. re_power_type
seems optional.
from tapo.
The fix has been released in Tapo Rust v0.7.8 and Tapo Python v0.1.5.
from tapo.
@zaraquer, it would be lovely if you could try out the new version. I suspect that there might be some further errors :(
from tapo.
Thanks! I will check it today a bit later. Sorry for the late answer, I was away from my computer. BTW thanks again for your fast and amazing work!
from tapo.
I tried the python version first.
With get_device_info:
Traceback (most recent call last):
File "/root/tapo/tapo-py/examples/tapo_l510.py", line 40, in
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 "/root/tapo/tapo-py/examples/tapo_l510.py", line 32, in main
device_info = await device.get_device_info()
Exception: Serde(Error("missing field re_power_type
", line: 1, column: 539))
After I changed it to get_device_info_json:
Traceback (most recent call last):
File "/root/tapo/tapo-py/examples/tapo_l510.py", line 40, in
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 "/root/tapo/tapo-py/examples/tapo_l510.py", line 33, in main
print(f"Device info: {device_info.to_dict()}")
AttributeError: 'dict' object has no attribute 'to_dict'
from tapo.
Are you sure you're using the latest version? I'm surprised to see the missing field re_power_type
error occurring.
to_dict
is required only on the result of get_device_info
.
get_device_info_json
returns a dict
straight up, so you should not call to_dict
on its result.
from tapo.
Yeah, its the latest.
git log
commit 4923824 (HEAD -> main, origin/main, origin/HEAD)
Author: Dinculescu [email protected]
Date: Sun Jan 21 21:23:35 2024 +0000
tapo-py: Add support for the L530, L630, and L900 devices
Addresses #123.
commit e9d2953 (tag: py-v0.1.5)
Author: Dinculescu [email protected]
Date: Sat Jan 20 21:28:49 2024 +0000
tapo-py: Release v0.1.5
commit c8307d5 (tag: v0.7.8)
Author: Dinculescu [email protected]
Date: Sat Jan 20 21:27:13 2024 +0000
Release v0.7.8
I'm testing with the example's.
from tapo.
Okay, I deleted dict, now this is what I get:
python examples/tapo_l510.py
Turning device on...
Waiting 2 seconds...
Setting the brightness to 30%...
Waiting 2 seconds...
Turning device off...
Device info: {'avatar': 'bulb', 'brightness': 30, 'default_states': {'brightness': {'type': 'last_states', 'value': 30}}, 'device_id': '8023C0D888DD972F67F68BF0809ABE791EF4B5E0', 'device_on': False, 'fw_id': '7BECA9DC454565672FEC87D1104F9972', 'fw_ver': '1.3.0 Build 20230831 Rel. 75926', 'has_set_location_info': True, 'hw_id': '93F94D88DA9499F43B929DD38EBDF09A', 'hw_ver': '1.0.0', 'ip': 'xx.xx.xx.xx', 'lang': 'hu_HU', 'latitude': 554786, 'longitude': 332565, 'mac': 'aa-aa-aa-aa-aa-aa', 'model': 'L510 Series', 'nickname': 'S29ueWhh', 'oem_id': '6B97E8E19CE8019B59D9E81CEDD371BD', 'on_time': 0, 'overheated': False, 'region': 'Europe/Budapest', 'rssi': -46, 'signal_level': 3, 'specs': 'EU', 'ssid': 'V29yay1OZXR4b3Jr', 'time_diff': 60, 'type': 'SMART.TAPOBULB'}
Device usage: <builtins.DeviceUsageEnergyMonitoringResult object at 0x7f1f75495590>
from tapo.
Hmm, before running the example, can you please run
cd tapo-py
poetry install
poetry shell
maturin develop
and try get_device_info
again?
from tapo.
I did what you suggest:
(tapo-Q5KVV4uC-py3.10)~/tapo/tapo-py# python examples/tapo_l510.py
Turning device on...
Waiting 2 seconds...
Setting the brightness to 30%...
Waiting 2 seconds...
Turning device off...
Traceback (most recent call last):
File "/root/tapo/tapo-py/examples/tapo_l510.py", line 40, 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 "/root/tapo/tapo-py/examples/tapo_l510.py", line 32, in main
device_info = await device.get_device_info()
Exception: Serde(Error("missing field `dynamic_light_effect_enable`", line: 1, column: 722))
from tapo.
The fix has been released in Tapo Rust v.0.7.9 and Tapo Python v0.2.0.
from tapo.
Related Issues (20)
- Failed to install and use API HOT 2
- 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.