-
Notifications
You must be signed in to change notification settings - Fork 240
Open
Labels
duplicateThis issue or pull request already existsThis issue or pull request already existstuya_deviceSupport for specific Tuya DevicesSupport for specific Tuya Devices
Description
Hi,
I've been polling data from a WiFi enabled thermostat Inkbird ITC-308, but after a while the device keeps responding the following error.
{
"Error": "Check device key or version",
"Err": "914",
"Payload": null
}
I was initially sampling like this every second and I got this error quite frequently. When I changed to sample every 15s, this only happened after a day of testing.
When it gets to this stage, the only way to recover is to power it off and on again. The thing is, the device is still responsive in the Tuya App, so I don't know what the issue really is and if it is preventable.
Any thoughts?
Here is my sample code
import tinytuya
import json
import requests
# "dps": {
# "12": 0,
# "101": "C", // Units (C / F)
# "102": 0,
# "104": 236, // Temperature (C) reported x 10
# "106": 280, // Set-point (temperature) x 10
# "108": 0,
# "109": 1000,
# "110": -400,
# "111": false,
# "112": false,
# "113": false,
# "115": "3",
# "116": 745, // Temperature (F) reported (alternate) x 10
# "117": 5, // Hyst
# "118": 5 // hyst
# }
# To generate devices.json file, use python -m tinytuya wizard and input the Tuya Development Platform information
devices_filename = 'devices.json'
file_contents = ''
try:
with open(devices_filename, 'r') as f:
file_contents = f.read()
except:
print(f"File {devices_filename} not found. Exiting.")
exit()
try:
devices_info = json.loads(file_contents)
except:
print(f"Failed to parse contents of {devices_filename} to json format. Exiting.")
exit()
selected_device = 'Freezer'
selected_device_info = selected_device_info = next((d for d in devices_info if selected_device in d['name']), None)
# Connect to selected device
if (selected_device_info):
d = tinytuya.OutletDevice(
dev_id=selected_device_info['id'],
address=selected_device_info['ip'],
local_key=selected_device_info['key'],
version=3.4)
# Get Status
print(json.dumps(d.status() , indent=4))
# Set to C
d.set_value(101, "C")
# Set heating, then cooling histeresys
d.set_value(117, int(5))
d.set_value(118, int(5))
# Change setpoint
d.set_value(106, int(300))
exit()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
duplicateThis issue or pull request already existsThis issue or pull request already existstuya_deviceSupport for specific Tuya DevicesSupport for specific Tuya Devices