Giter VIP home page Giter VIP logo

Comments (3)

joel-kelly avatar joel-kelly commented on August 28, 2024 1

Aiyiyi that would explain it, wouldn't it! Thanks for your feedback!

Sorry for not catching that earlier. For anyone else searching, I was using these plugs (which do not have any power measurement capabilities).

I'm still curious how the changes to the Tuya IoT platform impact the guide listed in the readme, but my hunch is that the default APIs work. (Also still curious if the Tuya API pricing model has changed). But I need to buy proper plugs to investigate!

from tuyapower.

joel-kelly avatar joel-kelly commented on August 28, 2024

Here is more output using the debugging mode:

import tinytuya

tinytuya.set_debug(True, False) # Turn on Debug - for non-ANSI color use tinytuya.set_debug(True, False)

PLUGID = 'eb4aa77b450e9560bboule'
PLUGIP = '192.168.50.217'
PLUGKEY = "DEVICE_KEY" #modified to placeholder
PLUGVERS = "3.3"

tuyapower.devicePrint(PLUGID,PLUGIP,PLUGKEY,PLUGVERS)
DEBUG:status() entry (dev_type is default)
DEBUG:final payload_dict for 'eb4aa77b450e9560bboule' ('v3.3'/'default'): {1: {'command': {'gwId': '', 'devId': '', 'uid': '', 't': ''}}, 7: {'command': {'devId': '', 'uid': '', 't': ''}}, 8: {'command': {'gwId': '', 'devId': ''}}, 9: {'command': {'gwId': '', 'devId': ''}}, 10: {'command': {'gwId': '', 'devId': '', 'uid': '', 't': ''}}, 13: {'command': {'devId': '', 'uid': '', 't': ''}}, 16: {'command': {'devId': '', 'uid': '', 't': ''}}, 18: {'command': {'dpId': [18, 19, 20]}}, 64: {'command': {'reqType': '', 'data': {}}}}
DEBUG:building command 10 payload=b'{"gwId":"eb4aa77b450e9560bboule","devId":"eb4aa77b450e9560bboule","uid":"eb4aa77b450e9560bboule","t":"1694820323"}'
DEBUG:sending payload
DEBUG:payload encrypted=b'000055aa000000010000000a00000088f15a57953868140b85fbef98f228c2a0da228ec7bb661bcf439d78322147ae22a5a3cf6f4b98b4c2a4cc6190b25785f0ff3e34366749ff6f057538a4bba0f8c34e0edfc034cbdd21485d41e0c527a75eda228ec7bb661bcf439d78322147ae22f7e2f379f646cf7dd374b891a0b35c5a695b312354954e03e047fec145d87cb2ca4af9ed0000aa55'
DEBUG:received data=b'000055aa000000010000000a0000006c000000008bc2e640d20d2e5ec63177fd39bb559e262a82d747773d4b6ab823898b48c46295e2ade5b7144502e506eaeba5c510a2038e68872277364c2eccd190c026311f55d2b8affefa538ba92970dc6a80132c46715e522c6f2f866b7f3aef59aaf6379386af730000aa55'
DEBUG:received message=TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b'\x8b\xc2\xe6@\xd2\r.^\xc61w\xfd9\xbbU\x9e&*\x82\xd7Gw=Kj\xb8#\x89\x8bH\xc4b\x95\xe2\xad\xe5\xb7\x14E\x02\xe5\x06\xea\xeb\xa5\xc5\x10\xa2\x03\x8eh\x87"w6L.\xcc\xd1\x90\xc0&1\x1fU\xd2\xb8\xaf\xfe\xfaS\x8b\xa9)p\xdcj\x80\x13,Fq^R,o/\x86k\x7f:\xefY\xaa\xf67', crc=2475077491, crc_good=True, prefix=21930, iv=None)
DEBUG:raw unpacked message = TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b'\x8b\xc2\xe6@\xd2\r.^\xc61w\xfd9\xbbU\x9e&*\x82\xd7Gw=Kj\xb8#\x89\x8bH\xc4b\x95\xe2\xad\xe5\xb7\x14E\x02\xe5\x06\xea\xeb\xa5\xc5\x10\xa2\x03\x8eh\x87"w6L.\xcc\xd1\x90\xc0&1\x1fU\xd2\xb8\xaf\xfe\xfaS\x8b\xa9)p\xdcj\x80\x13,Fq^R,o/\x86k\x7f:\xefY\xaa\xf67', crc=2475077491, crc_good=True, prefix=21930, iv=None)
DEBUG:decode payload=b'\x8b\xc2\xe6@\xd2\r.^\xc61w\xfd9\xbbU\x9e&*\x82\xd7Gw=Kj\xb8#\x89\x8bH\xc4b\x95\xe2\xad\xe5\xb7\x14E\x02\xe5\x06\xea\xeb\xa5\xc5\x10\xa2\x03\x8eh\x87"w6L.\xcc\xd1\x90\xc0&1\x1fU\xd2\xb8\xaf\xfe\xfaS\x8b\xa9)p\xdcj\x80\x13,Fq^R,o/\x86k\x7f:\xefY\xaa\xf67'
DEBUG:decrypting=b'\x8b\xc2\xe6@\xd2\r.^\xc61w\xfd9\xbbU\x9e&*\x82\xd7Gw=Kj\xb8#\x89\x8bH\xc4b\x95\xe2\xad\xe5\xb7\x14E\x02\xe5\x06\xea\xeb\xa5\xc5\x10\xa2\x03\x8eh\x87"w6L.\xcc\xd1\x90\xc0&1\x1fU\xd2\xb8\xaf\xfe\xfaS\x8b\xa9)p\xdcj\x80\x13,Fq^R,o/\x86k\x7f:\xefY\xaa\xf67'
DEBUG:decrypted 3.x payload='{"dps":{"1":true,"9":0,"38":"memory","39":"relay","40":false,"41":"","42":"","43":""}}'
DEBUG:payload type = <class 'str'>
DEBUG:decoded results='{"dps":{"1":true,"9":0,"38":"memory","39":"relay","40":false,"41":"","42":"","43":""}}'
DEBUG:status() received data={'dps': {'1': True, '9': 0, '38': 'memory', '39': 'relay', '40': False, '41': '', '42': '', '43': ''}}
INFO:{'datetime': '2023-09-15T23:25:23Z', 'switch': True, 'power': 0, 'current': 0, 'voltage': 0}
 ERROR: Power data unavailable

TuyaPower (Tuya Power Stats) [0.2.0] tinytuya [1.12.11]

Device eb4aa77b450e9560bboule at 192.168.50.217 key DEVICE_KEY protocol 3.3:
    Switch On: True
    NOTE: Power data unavailable

from tuyapower.

jasonacox avatar jasonacox commented on August 28, 2024

Are you sure this Tuya device (switch) has power measurement? You are getting a valid response that decodes to:

{'1': True, '9': 0, '38': 'memory', '39': 'relay', '40': False, '41': '', '42': '', '43': ''}}

But it is missing any power data points (e.g. 18, 19, or 20) - you can see the index here: https://github.com/jasonacox/tinytuya#version-33---plug-switch-power-strip-type

Are you seeing Current, Voltage and Wattage values in the SmartLife app?

from tuyapower.

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.