spidertyler2005

printLight.cgi

Apr 30th, 2020
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. #!usr/bin/python3
  2.  
  3. from smartThingy import *
  4. import aiohttp
  5. import asyncio
  6. import pysmartthings
  7.  
  8. async def run(loop):
  9.     api = await getApi(token,session)
  10.     locations = await getLocations(api)
  11.     devices = await getDevices(api)
  12.     closet = await getDeviceByName(devices,"Print Light")
  13.     print(f" \r\r\n\n{api} \n\r connected to SmartThings! \r\n {locations} \r\n Recieved all locations \r\n Receieved all Devices")
  14.     print("------------------------------------- \r\n")
  15.  
  16.     await toggleSwitch(closet)
  17.     await session.close() #have in all files!
  18.     return None
  19.  
  20. token = "TOKEN THAT HAS BEEN REMOVED FOR SECURITY"
  21. session= aiohttp.ClientSession()
  22. loop = asyncio.get_event_loop()
  23. loop.run_until_complete(run(loop))
Add Comment
Please, Sign In to add comment