From d8a8fa896103bcc12f1ece8514a4157abc89783e Mon Sep 17 00:00:00 2001 From: Rich O Date: Wed, 27 Nov 2019 15:04:54 -0500 Subject: [PATCH] hopefully fixing this for the last time --- r0b3bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r0b3bot.py b/r0b3bot.py index 947011a..a5ea43e 100644 --- a/r0b3bot.py +++ b/r0b3bot.py @@ -264,7 +264,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_on" - payload = { "entity_id": HASS_LIGHT } + payload = f'service_data = {{ "entity_id": {HASS_LIGHT} }}' print(f" - Payload String: {payload}") requests.post(hassAPIURL, data=payload, headers=hassHEADERS) except: @@ -290,7 +290,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 = f'service_data = {{ "entity_id": {HASS_LIGHT} }}' requests.post(hassAPIURL, data=payload, headers=hassHEADERS) except: # Do nothing is this fails -- 2.39.5