3 Commits
0.0.4 ... 0.0.7

3 changed files with 6 additions and 4 deletions

View File

@ -27,5 +27,5 @@ WORKDIR ${APP_DIR}
VOLUME ${CONF_DIR}
CMD "python digitaltwin1.py -f ./config/config.ini"
CMD [ "/usr/local/bin/python", "digitaltwin1.py", "-f", "./config/config.ini" ]

View File

@ -15,7 +15,7 @@ class MqttCoilSubscriber(AbstractMqttPublisher):
def localLoop(self):
while True:
sleep(self.config["analogInputPublishPeriod"])
sleep(float(self.config["analogInputPublishPeriod"]))
def onMessage(self, topic, payload):
logger.warning("mqtt message received: {} -> {}".format(topic, str(payload)))

View File

@ -27,7 +27,8 @@ class MqttEventPublisher(AbstractMqttPublisher):
discreteInputChangeItem[1][1],
discreteInputChangeItem[1][0]))
self.client.publish("{}/{}".format(self.config["digitalInputTopicPrefix"], str(discreteInputChangeItem[0])),
str(discreteInputChangeItem[1][0]))
str(discreteInputChangeItem[1][0]),
retain=True)
for analogInputChangeItem in analogInputChangeset:
logger.debug("Analog input {} changed from {} to {}"
@ -36,6 +37,7 @@ class MqttEventPublisher(AbstractMqttPublisher):
analogInputChangeItem[1][0]))
self.client.publish("{}/{}".format(self.config["analogInputEventTopicPrefix"], str(analogInputChangeItem[0])),
str(analogInputChangeItem[1][0]))
str(analogInputChangeItem[1][0]),
retain=True)