From 08707368455093579bcc94f2d0cddea2f23db04c Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Thu, 30 Mar 2017 10:32:42 +0200 Subject: [PATCH] light: change mqtt broker Signed-off-by: Thomas Klaehn --- src/light.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/light.py b/src/light.py index 9e27d89..779b5cb 100644 --- a/src/light.py +++ b/src/light.py @@ -4,17 +4,15 @@ Created on Dec 24, 2016 @author: tkl ''' import sys -from time import time -import paho.mqtt.client as mqtt +import time from light_sensor.light_sensor import light_sensor +import mqtt def main(): - client = mqtt.Client() - client.connect("192.168.178.37", 1883, 60) - client.loop_start() + conn = mqtt.Mqtt(hostname='proxy') light = light_sensor(1, 0x23) - client.publish("chickenhouse/sensors/light", str(int(time())) + " " + \ - str(light.read()) + " lx") + conn.transmit("outdoor/chickenhouse/sensors/light", str(int(time.time())) + " " + \ + str(light.read()) + " lx") if __name__ == "__main__": sys.exit(main())