From 6b9cf63ae0757123eeedbfabcb499a2233a74a2b Mon Sep 17 00:00:00 2001 From: Rich O Date: Wed, 27 Nov 2019 14:49:52 -0500 Subject: [PATCH] is it a syntax problem? --- r0b3bot.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/r0b3bot.py b/r0b3bot.py index c964c65..d0704b5 100644 --- a/r0b3bot.py +++ b/r0b3bot.py @@ -254,13 +254,12 @@ async def printstat(ctx): # REST API call to home assistant to turn the light off. #remote.call_service(hassapi, 'switch', 'turn_on', {'entity_id':'{}'.format(HASS_LIGHT)}) hassAPIRUL = HASS_IP_ADDRESS + "/api/services/switch/turn_on" - payload = { - "entity_id": HASS_LIGHT - } + payload = { "entity_id": '"' + HASS_LIGHT + '"' } requests.post(hassAPIURL, data=payload, headers=hassHEADERS) except: - # Do nothing is this fails + # Do nothing if this fails print(" ! Unable to turn on light") + await ctx.send("Sorry, I was unable to turn on the light.") pass lightMessages = ["Woah, it's pretty dark in R0b3's Basement... Give me a couple seconds to turn on a light.", \ @@ -288,9 +287,7 @@ async def printstat(ctx): # REST API call to home assistant to turn the light off. #remote.call_service(hassapi, 'switch', 'turn_on', {'entity_id':'{}'.format(HASS_LIGHT)}) hassAPIRUL = HASS_IP_ADDRESS + "/api/services/switch/turn_off" - payload = { - "entity_id": HASS_LIGHT - } + payload = { "entity_id": '"' + HASS_LIGHT +'"' } requests.post(hassAPIURL, data=payload, headers=hassHEADERS) except: # Do nothing is this fails -- 2.39.5