I have been trying to get a simple python script up and running as a command line sensor
If I put a simple print command, then the sensor works. However, if I use my actual script it says command failed and does not provide additional details at any log level.
Here’s my script. Is the use of websockets in my script causing the problem ?
from websocket import create_connection
import json
ws = create_connection("ws://<WS_URL>")
result = ws.recv()
parsed_result = json.loads(result)
almond_mode = (parsed_result['Mode'])
#print("Received '%s'" % result)
if almond_mode == '2':
almond_mode="Home"
if almond_mode == '3':
almond_mode="Away"
ws.close()
print(str(almond_mode))