This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import thread, mosquitto, random, time | |
# mosquitto reference and download can be found here: http://mosquitto.org/documentation/python/ | |
class mqtt(): | |
def __init__(self, broker = "127.0.0.1", port = 1883, clientID = None): | |
self.__broker = broker | |
self.__port = port | |
self._client = None | |
self.__subscriptionsList = [] | |
self.__pendingSubscriptionsList = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
import mqtt, time | |
MQTT_HOST = "192.168.11.54" | |
WRs = {"dummy" : 0} | |
SMs = {"dummy" : 0} | |
def on_message(mosquitto, message): | |
device = message.topic.split("/")[4] | |
if device[0] == "3": # this means it in data from an inverter |