Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
92aeb8efdf
|
|||
8120df60ac
|
|||
3d97536b9b
|
|||
220d1e0ef9
|
@ -11,7 +11,8 @@ ARG CONF_DIR="${APP_DIR}/config"
|
||||
RUN \
|
||||
apt update && \
|
||||
pip3 install loguru && \
|
||||
pip3 install pymodbus
|
||||
pip3 install pymodbus && \
|
||||
pip3 install paho-mqtt
|
||||
|
||||
RUN \
|
||||
mkdir -p ${APP_DIR} && \
|
||||
@ -26,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" ]
|
||||
|
||||
|
@ -12,7 +12,7 @@ def modbusStart(config, processImage):
|
||||
|
||||
def modbusHandler(config, processImage):
|
||||
modbusClient = config["modbus"]["client"]
|
||||
modbusRefreshPeriod = config["modbus"]["scanrate"]
|
||||
modbusRefreshPeriod = float(config["modbus"]["scanrate"])
|
||||
|
||||
|
||||
client = ModbusClient(modbusClient)
|
||||
|
@ -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)))
|
||||
|
@ -28,5 +28,5 @@ class MqttPeriodPublisher(AbstractMqttPublisher):
|
||||
self.client.publish("{}/{}".format(self.config["analogInputPeriodicTopicPrefix"], str(analogInputItem[0])),
|
||||
str(analogInputItem[1]))
|
||||
|
||||
sleep(self.config["analogInputPublishPeriod"])
|
||||
sleep(float(self.config["analogInputPublishPeriod"]))
|
||||
|
||||
|
Reference in New Issue
Block a user