Created
May 11, 2023 00:03
-
-
Save danjperron/5ca1656017ab7c6d1bc054934171793f to your computer and use it in GitHub Desktop.
python test using tinytuya with 3 plug gosund
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tinytuya | |
import time | |
# Connect to Device | |
# set dev_id and local of your devec | |
gosund = tinytuya.OutletDevice( | |
dev_id='eb8bla8a7blad387bla5xc', | |
address='10.11.12.133', # Or set to 'Auto' to auto-discover IP address | |
local_key='#]X[blablablaX~V^$eZ~RI`V', | |
version=3.3) | |
teckin1 = tinytuya.OutletDevice( | |
dev_id='eb29bla422bla9804blafp', | |
address='10.11.12.140', # Or set to 'Auto' to auto-discover IP address | |
local_key='sO`blablabla@-3)', | |
version=3.3) | |
# Get Status | |
#data = gosund.status() | |
#print('gosund set_status() result %r' % data) | |
#data = teckin1.status() | |
#print('teckin1 set_status() result %r' % data) | |
#simple plug (1 relais) | |
teckin1.turn_off() | |
time.sleep(1) | |
teckin1.turn_on() | |
time.sleep(1) | |
teckin1.turn_off() | |
time.sleep(2) | |
#gosund 3 relais + usb power | |
#relais 1 ON | |
gosund.set_status(True,1) | |
time.sleep(1) | |
#relais 2 ON | |
gosund.set_status(True,2) | |
time.sleep(1) | |
#relais 3 ON | |
gosund.set_status(True,3) | |
time.sleep(1) | |
#relais USB | |
gosund.set_status(True,7) | |
time.sleep(1) | |
#all off | |
gosund.set_multiple_values({'1': False,'2': False,'3': False,'7':False}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment