How can get statistic from Smart Plug? #107
-
Hello everyone! Do I need to connect my Smart Plugs to a Developer Account? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 15 replies
-
Hi @EugeneRymarev -
For both, that requires that you register them with the Smart Life App or Tuya Smart App and to set up an IoT account with Tuya.. See the setup instructions: https://github.com/jasonacox/tinytuya#tuya-device-preparation LAN import tinytuya
d = tinytuya.OutletDevice('DEVICE_ID_HERE', 'IP_ADDRESS_HERE', 'LOCAL_KEY_HERE')
d.set_version(3.3)
data = d.status()
print('set_status() result %r' % data) CloudAPI import tinytuya
# Connect to Tuya Cloud
# c = tinytuya.Cloud() # uses tinytuya.json
c = tinytuya.Cloud(
apiRegion="us",
apiKey="xxxxxxxxxxxxxxxxxxxx",
apiSecret="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
apiDeviceID="xxxxxxxxxxxxxxxxxxID")
# Display list of devices
devices = c.getdevices()
print("Device List: %r" % devices)
# Select a Device ID to Test
id = "xxxxxxxxxxxxxxxxxxID"
# Display Status of Device
result = c.getstatus(id)
print("Status of device:\n", result) |
Beta Was this translation helpful? Give feedback.
-
Hi @EugeneRymarev - You should not need the Device Manager APK. You should be able to connect your devices and link your IoT account with the "Smart Life" App - Here: https://play.google.com/store/apps/details?id=com.tuya.smartlife You will use that app to scan the QR code on the iot.tuya.com website per STEP 3 on the instructions which will connect your devices to the IoT account you create. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the information. When you set it up, did you select the free API option? I created a PDF of the screenshots to set up... is this similar to what you did? |
Beta Was this translation helpful? Give feedback.
-
I'm sorry, I misunderstood. If you are looking for current state, voltage (V), current (amps) and power (W), that data you got from getstatus(id) should work. If you are wanting to access historical power data (kWh), I'm afraid I haven't figured that out. You can look at https://iot.tuya.com/cloud/explorer to see if you can find the right API call that would have that payload. Let me know if you find it and I can add that to TinyTuya. |
Beta Was this translation helpful? Give feedback.
Hi @EugeneRymarev -
For both, that requires that you register them with the Smart Life App or Tuya Smart App and to set up an IoT account with Tuya.. See the setup instructions: https://github.com/jasonacox/tinytuya#tuya-device-preparation
LAN
CloudAPI