Merge branch '2-homeassistant-api-connection-is-broken' into 'master'

dumping out error

Closes #2

See merge request Bots/r0b3BOT!31
This commit was merged in pull request #41.
This commit is contained in:
rich committed 2019-11-27 15:27:59 -05:00
commit ce6ae512ca
1 file changed
+5 -2
+5 -2
View File
@@ -270,7 +270,9 @@ async def printstat(ctx):
print(f" - POST Response: {response.text}")
except:
# Do nothing if this fails
print(" ! Unable to turn on light")
e = sys.exc_info()[0]
print(f" ! Unable to turn on light; DUMP: {e}")
await ctx.send("Sorry, I was unable to turn on the light.")
pass
@@ -292,7 +294,8 @@ async def printstat(ctx):
#remote.call_service(hassapi, 'switch', 'turn_on', {'entity_id':'{}'.format(HASS_LIGHT)})
hassAPIRUL = HASS_IP_ADDRESS + "/api/services/switch/turn_off"
payload = f'service_data={{"entity_id": "{HASS_LIGHT}"}}'
requests.post(hassAPIURL, headers=hassHEADERS, data=payload)
response = requests.post(hassAPIURL, headers=hassHEADERS, data=payload)
except:
# Do nothing is this fails
print(" ! Unable to turn off light")