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?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login