3 Commits
0.1.0 ... 0.1.3

Author SHA1 Message Date
25f6a1f43f read coils 5
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2025-12-15 11:35:52 +01:00
a5f9527f4d read coils 4
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2025-12-15 11:20:46 +01:00
08c1faf606 read coils 3
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2025-12-15 11:09:21 +01:00
3 changed files with 10 additions and 9 deletions

View File

@@ -16,9 +16,9 @@ steps:
deploy: deploy:
image: portainer/kubectl-shell:latest image: portainer/kubectl-shell:latest
secrets: environment:
- source: kube_config KUBE_CONFIG_CONTENT:
target: KUBE_CONFIG_CONTENT from_secret: kube_config
commands: commands:
- export IMAGE_TAG=$CI_COMMIT_TAG - export IMAGE_TAG=$CI_COMMIT_TAG
- printf "$KUBE_CONFIG_CONTENT" > /tmp/kubeconfig - printf "$KUBE_CONFIG_CONTENT" > /tmp/kubeconfig

View File

@@ -11,7 +11,7 @@ ARG CONF_DIR="${APP_DIR}/config"
RUN \ RUN \
apt update && \ apt update && \
pip3 install loguru && \ pip3 install loguru && \
pip3 install pymodbus && \ pip3 install pymodbus==3.6.3 && \
pip3 install paho-mqtt pip3 install paho-mqtt
RUN \ RUN \

View File

@@ -39,17 +39,17 @@ class ModbusHandler(threading.Thread):
self.processImage.init(digitalOutputBits, digitalInputBits, analogInputBits) self.processImage.init(digitalOutputBits, digitalInputBits, analogInputBits)
reg = client.read_coils(0, digitalOutputBits)
if isinstance(reg, ModbusIOException):
raise Exception(reg)
with self.processImage:
self.processImage.setCoils(reg.bits)
while not self.killBill: while not self.killBill:
try: try:
if not client.is_socket_open(): if not client.is_socket_open():
client.connect() client.connect()
reg = client.read_coils(0, digitalOutputBits)
if isinstance(reg, ModbusIOException):
raise Exception(reg)
readCoils = reg.bits
reg = client.read_input_registers(0, analogInputBits // 8) reg = client.read_input_registers(0, analogInputBits // 8)
if isinstance(reg, ModbusIOException): if isinstance(reg, ModbusIOException):
raise Exception(reg) raise Exception(reg)
@@ -64,6 +64,7 @@ class ModbusHandler(threading.Thread):
with self.processImage: with self.processImage:
self.processImage.setAnalogsInputs(analogInputs) self.processImage.setAnalogsInputs(analogInputs)
self.processImage.setDiscreteInputs(discreteInputs) self.processImage.setDiscreteInputs(discreteInputs)
self.processImage.setCoils(readCoils)
if self.processImage.hasPendingInputChanges(): if self.processImage.hasPendingInputChanges():
self.processImage.notify() self.processImage.notify()
if self.processImage.hasPendingOutputChanges(): if self.processImage.hasPendingOutputChanges():