Skip to content

How can get statistic from Smart Plug? #107

Answered by jasonacox
EugeneRymarev asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @EugeneRymarev -

  • LAN access: To get the statistics (status) of those Tuya smartplugs over LAN you will need the device LocalKey.
  • Cloud API access: To get statistics via the Tuya Cloud you will need to set up an IoT account.

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
#…

Replies: 4 comments 15 replies

Comment options

You must be logged in to vote
1 reply
@EugeneRymarev
Comment options

Answer selected by EugeneRymarev
Comment options

You must be logged in to vote
7 replies
@EugeneRymarev
Comment options

@EugeneRymarev
Comment options

@jasonacox
Comment options

@EugeneRymarev
Comment options

@EugeneRymarev
Comment options

Comment options

You must be logged in to vote
6 replies
@EugeneRymarev
Comment options

@jasonacox
Comment options

@EugeneRymarev
Comment options

@jasonacox
Comment options

@EugeneRymarev
Comment options

Comment options

You must be logged in to vote
1 reply
@peterodro
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants