3 Commits

Author SHA1 Message Date
3a4cd499a5 add raw output
All checks were successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2025-12-05 14:44:24 +01:00
6e50654d00 lower case
All checks were successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2025-12-05 13:45:00 +01:00
e820aa2000 fix in ci 2025-12-05 13:36:19 +01:00
4 changed files with 7 additions and 3 deletions

View File

@@ -23,7 +23,6 @@ steps:
exclude: exclude:
- refs/tags/*-configchange - refs/tags/*-configchange
namespace: namespace:
image: quay.io/wollud1969/k8s-admin-helper:0.3.4 image: quay.io/wollud1969/k8s-admin-helper:0.3.4
environment: environment:
@@ -34,6 +33,10 @@ steps:
- printf "$KUBE_CONFIG_CONTENT" > /tmp/kubeconfig - printf "$KUBE_CONFIG_CONTENT" > /tmp/kubeconfig
- export KUBECONFIG=/tmp/kubeconfig - export KUBECONFIG=/tmp/kubeconfig
- kubectl create namespace $NAMESPACE || echo "Namespace $NAMESPACE already exists" - kubectl create namespace $NAMESPACE || echo "Namespace $NAMESPACE already exists"
when:
ref:
exclude:
- refs/tags/*-configchange
configuration: configuration:
image: quay.io/wollud1969/k8s-admin-helper:0.3.4 image: quay.io/wollud1969/k8s-admin-helper:0.3.4

View File

@@ -53,7 +53,7 @@ class FromDevices(AbstractMqttPublisher):
logger.error(f"Caught exception: {str(e)}") logger.error(f"Caught exception: {str(e)}")
payload['cnt'] = cnt payload['cnt'] = cnt
payloadStr = json.dumps(payload) payloadStr = json.dumps(payload) if not device.raw_output else str(payload)
self.client.publish(device.publish_topic, payloadStr) self.client.publish(device.publish_topic, payloadStr)
logger.debug(f"mqtt message sent: {device.publish_topic} -> {payloadStr}") logger.debug(f"mqtt message sent: {device.publish_topic} -> {payloadStr}")

View File

@@ -24,7 +24,7 @@ class ToDevices(AbstractMqttPublisher):
continue continue
if device.register_type != 'coil': if device.register_type != 'coil':
raise Exception(f"Unsupported register type {device.register_type} for input device {device.name}") raise Exception(f"Unsupported register type {device.register_type} for input device {device.name}")
value = payload == b'On' value = payload == b'on'
self.modbusHandler.writeCoil(device.slave_id, device.address, value) self.modbusHandler.writeCoil(device.slave_id, device.address, value)
except Exception as e: except Exception as e:
logger.error(f"Caught exception in onMessage: {str(e)}") logger.error(f"Caught exception in onMessage: {str(e)}")

View File

@@ -24,6 +24,7 @@ class OutputConfig(BaseModel):
enabled: bool = Field(default=True) enabled: bool = Field(default=True)
scan_rate: Optional[int] = Field(default=60) scan_rate: Optional[int] = Field(default=60)
publish_topic: str publish_topic: str
raw_output: Optional[bool] = Field(default=False)
slave_id: int slave_id: int
registers: List[RegisterConfig] registers: List[RegisterConfig]