X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=inject_presence.py;fp=inject_presence.py;h=731469f17671ec369927d6f9dd5a10be624e4bbc;hb=271a99d6799d9da0cc567f03148ff1d71974e77c;hp=0000000000000000000000000000000000000000;hpb=50d8b89aad9fc4349fb277de9e5620ba27724057;p=svn42.git diff --git a/inject_presence.py b/inject_presence.py new file mode 100755 index 0000000..731469f --- /dev/null +++ b/inject_presence.py @@ -0,0 +1,25 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +from __future__ import with_statement +import zmq.utils.jsonapi as json +import zmq +import time + +######## r3 ZMQ ############ + +def sendR3Message(socket, structname, datadict): + socket.send_multipart([structname, json.dumps(datadict)]) + +#Start zmq connection to publish / forward sensor data +zmqctx = zmq.Context() +zmqctx.linger = 0 +zmqpub = zmqctx.socket(zmq.PUB) +zmqpub.connect("tcp://wuzzler.realraum.at:4243") + +#listen for sensor data and forward them +sendR3Message(zmqpub,"PresenceUpdate",{"Presence":True,"Ts":int(time.time())}) + +zmqpub.close() +zmqctx.destroy() + +