From 583a164a33a352d43a909beddbcaace43c598eff Mon Sep 17 00:00:00 2001 From: Rich Oberholtzer Date: Fri, 22 Nov 2019 16:09:14 -0500 Subject: [PATCH] added code to cahnge light status. dont think it will work , will prob get error 403 --- r0b3bot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/r0b3bot.py b/r0b3bot.py index fc23fe4..ad7e4af 100644 --- a/r0b3bot.py +++ b/r0b3bot.py @@ -253,7 +253,11 @@ async def printstat(ctx): turned_on_light = True try: # REST API call to home assistant to turn the light off. - remote.call_service(hassapi, 'switch', 'turn_on', {'entity_id':'{}'.format(HASS_LIGHT)}) + #remote.call_service(hassapi, 'switch', 'turn_on', {'entity_id':'{}'.format(HASS_LIGHT)}) + payload = { + "state":"on" + } + requests.post(hassURL, data=payload, headers=hassHEADERS) except: # Do nothing is this fails print(" ! Unable to turn on light") -- 2.39.5