Websocket filter
-
I am trying to filter only the "temp" message out of the websocket application.
Unfortunately it does not work. please have a look at my little test program:#!/usr/bin/python # -*- coding: utf-8 -*- import websocket import json from time import * from datetime import * def on_message(ws, message): obj = json.loads(message) print(str(obj)) def on_error(ws, error): now = datetime.now().strftime('%H:%M:%S') print (error + ": " + now) def on_close(ws): now = datetime.now().strftime('%H:%M:%S') print ("WS-Connection closed: " + now) #ws.send('{"cmd":"filter","devices":["ai","input"]}') def ws_receive(): global ws global url ws = websocket.WebSocketApp(url, on_message = on_message, on_error = on_error, on_close = on_close) ws.run_forever() def ws_filter(): global url ws = websocket.WebSocket() ws.connect(url) #ws.send('{"cmd":"filter","devices":["ai","input"]}') ws.send('{"cmd":"filter","devices":"temp"}') ws.close() #-------------------------------------------------------------------------------------- def main(): global url host = "localhost" url = "ws://%s/ws" %(host) ws_filter() ws_receive() if __name__ == "__main__": main()
-
-
sorry, but does it mean, that there is a bug in evok?
I don't quite understand what I should do to filter temp devices.
What is wrong with my test program?
Please have another look.
thanks -
@juntiedt please try it with
ws.send('{"cmd":"filter","devices":"[temp]"}')
-
no success with the command you send :-(
-
@juntiedt ok, then please wait until @tomas_knot gets back after Christmas or try to investigate the issue in the code of Evok
-
ok. In which directory should I look for the evok software?