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