Skip to content

Commit 683248c

Browse files
committed
Changed the input of tedge operation template
1 parent e8304e2 commit 683248c

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

operations/c8y_SetCoil.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
[exec.workflow]
66
operation = "modbus_SetCoil"
7-
input.c8y_SetCoil = "${.payload}"
7+
input = "${.payload}"

operations/c8y_SetRegister.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
[exec.workflow]
66
operation = "modbus_SetRegister"
7-
input.c8y_SetRegister = "${.payload}"
7+
input = "${.payload}"

tedge_modbus/reader/reader.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,8 @@ def _handle_subscribed_message(self, topic, payload):
469469
try:
470470
payload_data = json.loads(payload)
471471
except json.JSONDecodeError as e:
472-
self.logger.error("Failed to parse JSON payload: %s", e)
472+
if payload != '':
473+
self.logger.error("Failed to parse JSON payload: %s", e)
473474
return
474475

475476
if payload_data["status"] == "init":
@@ -489,7 +490,7 @@ def _handle_subscribed_message(self, topic, payload):
489490
"c8y_SetRegister" in payload_data
490491
and payload_data["status"] == "executing"
491492
):
492-
register_data = payload_data["c8y_SetRegister"]["c8y_SetRegister"]
493+
register_data = payload_data["c8y_SetRegister"]
493494
self.logger.debug("Register data: %s", register_data)
494495

495496
# Convert to JSON string for update_register.run
@@ -525,7 +526,7 @@ def _handle_subscribed_message(self, topic, payload):
525526
try:
526527
# Extract c8y_SetCoil data from payload
527528
if "c8y_SetCoil" in payload_data:
528-
coil_data = payload_data["c8y_SetCoil"]["c8y_SetCoil"]
529+
coil_data = payload_data["c8y_SetCoil"]
529530
self.logger.debug("Coil data: %s", coil_data)
530531

531532
# Convert to JSON string for update_coil.run

0 commit comments

Comments
 (0)