Cleanups and improvements

This commit is contained in:
zewelor
2017-11-22 21:59:47 +01:00
parent fb836891b5
commit 1fa48fc778
3 changed files with 46 additions and 20 deletions
+15 -16
View File
@@ -1,23 +1,22 @@
from config import settings
import paho.mqtt.publish as publish
class MqttClient:
def __init__(self):
self._connected = False
self._config = settings['mqtt']
def __init__(self, config):
self._config = config
def publish(self, messages):
print(messages)
publish.multiple(messages, hostname=self.hostname, auth = {'username':self.username, 'password':self.password})
def publish(self, messages):
publish.multiple(messages,
hostname=self.hostname,
auth={'username': self.username, 'password': self.password})
@property
def hostname(self):
return self._config['host']
@property
def hostname(self):
return self._config['host']
@property
def username(self):
return self._config['username']
@property
def username(self):
return self._config['username']
@property
def password(self):
return self._config['password']
@property
def password(self):
return self._config['password']