unexpected status()
I have a plug which is joined to my tuya app on my iPhone and the device is being seen in Home Assistant. I wish to monitor power as well.
I grabbed the device ID and IP address and tried to run this script but am getting an error:
Polling Device ebf8372483a88daab4ckmy at 10.211.2.137 with key 0123456789abcde1 and protocol version 3.1
Unexpected status() payload=b'\xf1b\xe6\x13^\xcdc\xc3\x8f\xf4\xab\xfa\tB\xc7\xbb\xefxU\xd9g.,\xd2\xc6\xd8\xfc\xb3@A\x17%'
Dictionary b'\xf1b\xe6\x13^\xcdc\xc3\x8f\xf4\xab\xfa\tB\xc7\xbb\xefxU\xd9g.,\xd2\xc6\xd8\xfc\xb3@A\x17%'
Unexpected status() payload=b'\xf1b\xe6\x13^\xcdc\xc3\x8f\xf4\xab\xfa\tB\xc7\xbb\xefxU\xd9g.,\xd2\xc6\xd8\xfc\xb3@A\x17%'
Dictionary b'\xf1b\xe6\x13^\xcdc\xc3\x8f\xf4\xab\xfa\tB\xc7\xbb\xefxU\xd9g.,\xd2\xc6\xd8\xfc\xb3@A\x17%'
Please advise.
The payload looks encrypted. I suggest doing a scan to see if this is actually a version 3.3 plug:
python3 -m pip install tuyapower
python3 -m tuyapower
You will get something like this - notice the different versions:
TuyaPower (Tuya compatible smart plug scanner) [0.0.20]
Scanning on UDP ports 6666 and 6667 for devices...
FOUND Device [Valid payload]: 10.0.1.x
ID = 01234567891234567890, productKey = iXfg9AQVUPhlfyGw, Version = 3.1
Stats: on=True, W=56.2, mA=478.0, V=120.3 [OK]
FOUND Device [Valid payload]: 10.0.1.y
ID = 01234567891234567891, productKey = MShdslm9Uw7Q59nN, Version = 3.3
Device Key required to poll for stats
If it is 3.3, you just need to specify that when you call plugpower.py:
python plugpower.py 01234567890 10.0.1.99 0123456789abcdef 3.3
Same here.
python3 -m tuyapower TuyaPower (Tuya compatible smart plug scanner) [0.0.20]
Scanning on UDP ports 6666 and 6667 for devices (15 retries)...
FOUND Device [Valid payload]: 192.X.X.X ID = XXXXXX, productKey = XXXXXX, Version = 3.3 Device Key required to poll for stats
and when running: python plugpower.py <ID> <IP> <KEY> 3.3
get an error:
Traceback (most recent call last):
File "plugpower.py", line 94, in
Hi @myakove I may be missing it, but were you specifying the ID, IP and key for plugpower.py?
It will look something like this:
python3 plugpower.py PLUGID PLUGIP PLUGKEY PLUGVERS
Or you can set those variables in the environment:
#!/bin/bash
export PLUGID=XXXXXX
export PLUGIP=192.X.X.X
export PLUGKEY=XXXXXX
export PLUGVERS=3.3
python3 plugpower.py
Hi,
This is what I sent: python plugpower.py bf4731ed09220ae2aamlof 192.168.X.X KEY 3.3
I'm curious if the tuyapower update might work better. Try pulling the tuyapower script instead:
wget https://raw.githubusercontent.com/jasonacox/tuyapower/master/plugpower.py
python3 plugpower.py bf4731ed09220ae2aamlof 192.168.X.X KEY 3.3
Switch On: False Power (W): -99.000000 Current (mA): -99.000000 Voltage (V): -99.000000 Projected usage (kWh): Day: -2.376000 Week: -16.632000 Month: -72.072000
{ "datetime": "2020-08-13T03:56:25Z", "switch": "False", "power": "-99", "current": "-99", "voltage": "-99" }
Even when the plug is powered on there is no data. So no error, but nothing is pulled.
That's helpful! The tuyapower module has more error handling.
This response means it is unable to decrypt the response payload with that key (the -99 indicates invalid response or unsupported feature of the device -- some plugs do not send power data for instance). This can happen if you have the wrong key but I suspect there may be another 3.3 anomaly here. It could be due to the manufactures implementation or a firmware change. I'll do some research and see what I can find.
Can you provide the plug manufacture and model? Also do you have other plugs that work?
When debugging with pdb I see that err is "'Timeout polling device'"
Also in the output "ERROR: Timeout polling device" << Missed this one :)
I have only one device. No model on the device and not on the package. Where can I find some useful info about my device model?
This is what I have:
US $10.41 57%OFF | Smart WiFi Plug Adaptor 16A Remote Voice Control Power Monitor Socket Outlet Timing Function work with Alexa Google Home Tuya https://a.aliexpress.com/_d6R8jD8
Hi @myakove - I'm not able to replicate this with a similar 3.3 device I have. The only way I can get something close is to use a bad PLUGKEY. How did you get the PLUGKEY for your device? I just updated the tuyapower README with steps to do this using the Tuya developer portal - see instructions: https://github.com/jasonacox/tuyapower#get-the-tuya-device-key . I recommend you give that a try if you haven't already.
I tried this one already, no luck.