TuyaOS Link SDK for Python - reading problem
Hello,
I am developing a device that will send values from a Deye solar inverter (modbus) to the RPI and the RPI will simulate the Tuya device and send the values to the Smart Life application.
I want to use TuyaOS Link SDK for Python to send values to Smart Life app. https://developer.tuya.com/en/docs/iot- ... xpt3d2flds
The problem is that the SDK link works for sending values from the device but not for sending values to the device.
I created a simple program where I send values from the device (DP ID 102) and read the values on the device (DP ID 101).
Code: Select all
import time
import coloredlogs
from tuyalinksdk.client import TuyaClient
from tuyalinksdk.console_qrcode import qrcode_generate
coloredlogs.install(level='DEBUG')
client = TuyaClient(productid='kxxks5h9t0le5huz',
uuid='uuidf18276900e5fb2ec',
authkey='4hrLl3acdBlEoRMKrLoAPDutzCpmbc2J')
def on_connected():
print('Connected.')
def on_qrcode(url):
qrcode_generate(url)
def on_reset(data):
print('Reset:', data)
read_values=1
send_values=1
def on_dps(dps):
print('DataPoints:', dps)
global read_values
global send_values
read_values=dps['102']
dps['101']=send_values
client.push_dps(dps)
client.on_connected = on_connected
client.on_qrcode = on_qrcode
client.on_reset = on_reset
client.on_dps = on_dps
client.connect()
client.loop_start()
while True:
send_values=read_values
print(send_values,read_values)
time.sleep(10)
device tuya development
pythonapp
smatlife device panel