Closed judester1 closed 1 year ago
I got it working/returning data by changing to version 3.4 and using code below:
import tinytuya
d = tinytuya.OutletDevice('bf3e7252097f07dbd5iejq', '192.168.0.60', 'XXXXXXX')
d.set_version(3.4)
d.set_socketPersistent(True)
print(" > Send Request for Status < ")
payload = d.generate_payload(tinytuya.DP_QUERY)
d.send(payload)
while(True):
# See if any data is available
data = d.receive()
print('Received Payload: %r' % data)
# Send keyalive heartbeat
print(" > Send Heartbeat Ping < ")
payload = d.generate_payload(tinytuya.HEART_BEAT)
d.send(payload)
Hi @judester1
Did it report as being a 3.3 device when you ran python3 -m tinytuya scan
? Also, does your original code work when you change set_version() to 3.4?
Hi, thanks for your response.
Scan reported as 3.4 in devices.json file. Original code works if I drop the extra device22 parameter ... also works without the set_dpsused line.
import tinytuya
tinytuya.set_debug(True)
a = tinytuya.OutletDevice('bf3e7252097f07dbd5XXXX', '192.168.xx.xx', 'XXXXX')
a.set_version(3.4)
a.set_dpsUsed({"1": None}) # this line is optional/does not change data result
data = a.status()
print(data)
Thanks @judester1 - does tuyapower
still not work or should we close this issue?
As a note on tinytuya
, you can also specify the version in the class initialization:
import tinytuya
tinytuya.set_debug(True)
a = tinytuya.OutletDevice('bf3e7252097f07dbd5XXXX', '192.168.xx.xx', 'XXXXX', version=3.4)
data = a.status()
print(data)
Hi, could you please help as I am trying to access/record data from a smart energy meter I recently installed.
I have setup my Tuya IOT project to get client id and secret so I can run the wizard and and scan successfully to generate tuya-raw.json (includes a valid device status report) and devices.json to provide valid local key. API calls in IOT project for my device all work successfully.
However, when trying the following code to access device status locally (I use device id, IP address, local key) appears to get no response:
I'm getting the following error but can't tell if no data returned or data returned is not readable.