From f7993b536d01957e5e9cfc91af01617d7e48704c Mon Sep 17 00:00:00 2001 From: Nat Lasseter Date: Thu, 27 Jul 2017 16:44:56 +0100 Subject: Initial commit --- ring.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 ring.rb (limited to 'ring.rb') diff --git a/ring.rb b/ring.rb new file mode 100644 index 0000000..b355075 --- /dev/null +++ b/ring.rb @@ -0,0 +1,14 @@ +require "rubygems" +require "mqtt" + +IAM = ARGV.shift +TO = ARGV.shift + +MQTT::Client.connect("server.flashinglightprize.nathan.uk0.bigv.io") do |c| + c.get("ring/#{IAM}") do |topic, message| + if message == IAM then + sleep 0.1 + c.publish("ring/#{TO}", TO) + end + end +end -- cgit v1.2.1