MQTT auth and improvements implemented
This commit is contained in:
parent
2c6cf94ce3
commit
c440b10bbe
16
.gitignore
vendored
16
.gitignore
vendored
@ -1,7 +1,7 @@
|
||||
# ---> powerplug-energenie
|
||||
#
|
||||
config.py
|
||||
|
||||
*.err
|
||||
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
@ -119,6 +119,20 @@ dmypy.json
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# ---> VirtualEnv
|
||||
# Virtualenv
|
||||
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
|
||||
.Python
|
||||
[Bb]in
|
||||
[Ii]nclude
|
||||
[Ll]ib
|
||||
[Ll]ib64
|
||||
[Ll]ocal
|
||||
[Ss]cripts
|
||||
pyvenv.cfg
|
||||
.venv
|
||||
pip-selfcheck.json
|
||||
|
||||
# ---> Linux
|
||||
*~
|
||||
|
||||
|
@ -3,8 +3,9 @@
|
||||
import os
|
||||
import report
|
||||
|
||||
|
||||
MQTT_SERVER = "multimedia"
|
||||
MQTT_USER = "user"
|
||||
MQTT_PASS = "pass"
|
||||
MQTT_SERVER = "localhost"
|
||||
MQTT_TOPIC = "hifi/powerplug"
|
||||
|
||||
#
|
||||
@ -12,10 +13,10 @@ MQTT_TOPIC = "hifi/powerplug"
|
||||
#
|
||||
__BASEPATH__ = os.path.abspath(os.path.dirname(__file__))
|
||||
APP_NAME = "powerplug"
|
||||
LOGTARGET = 'stdout' # possible choices are: 'logfile' or 'stdout'
|
||||
LOGTARGET = 'logfile' # possible choices are: 'logfile' or 'stdout'
|
||||
LOGLVL = 'DEBUG'
|
||||
|
||||
LOGHOST = 'localhost'
|
||||
LOGHOST = 'cutelog'
|
||||
LOGPORT = 19996
|
||||
|
||||
formatter = report.LONG_FMT
|
||||
|
@ -52,7 +52,8 @@ class mqtt_powerplug(object):
|
||||
def __init__(self):
|
||||
self.__client__ = mqtt.Client("mqtt_powerplug") # create client object
|
||||
self.__client__.on_message = self.__receive__ # attach function to callback
|
||||
self.__client__.connect("192.168.0.131", 1883) # establish connection
|
||||
self.__client__.username_pw_set(config.MQTT_USER, config.MQTT_PASS) # login with credentials
|
||||
self.__client__.connect(config.MQTT_SERVER, 1883) # establish connection
|
||||
self.__client__.loop_start() # start the loop
|
||||
self.__topics__ = []
|
||||
for subtopic in self.SUBTOPICS:
|
||||
|
Loading…
x
Reference in New Issue
Block a user