Skip to content

Instantly share code, notes, and snippets.

@Just-Insane
Created August 26, 2017 22:00
Show Gist options
  • Save Just-Insane/ac1e7161b8eec02b02eb91a47600a930 to your computer and use it in GitHub Desktop.
Save Just-Insane/ac1e7161b8eec02b02eb91a47600a930 to your computer and use it in GitHub Desktop.
@commands.command()
async def on(self):
while self == self.bot.get_cog("Hass"):
url = "http://10.0.1.147:8123/api/services/light/turn_on"
headers = {
"x-ha-access": '[api_key]',
"Content-Type": "application/json"
}
data = {
"entity_id": "light.justin_bedroom",
"brightness": "255"
}
async with aiohttp.post(url, headers=headers, data=data) as resp:
time.sleep(10)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment