ioBroker.javascript icon indicating copy to clipboard operation
ioBroker.javascript copied to clipboard

[Bug]: After changing a trigger at Rules and saving i got a compile error and rule is not working anymore

Open wendy2702 opened this issue 10 months ago • 2 comments

I'm sure that

  • [x] This issue is still present in the current beta version of this adapter
  • [x] There is no other (open) issue with the same topic (use the search!)
  • [x] This issue is not described in the adapter documentation / FAQ (read the docs!)

Script type

Rules

The problem

I changed a trigger at a Rule(script). While saving i got this error:

javascript.0 | 20:41:21.122 | error | script.js.common.Ansagen.Voice_Feedback_Garagentor_Rechts_Rules compile failed:  at script.js.common.Ansagen.Voice_Feedback_Garagentor_Rechts_Rules:10

If the rule is triggered i get this:

2025-03-25 20:41:21.122  - error: javascript.0 (399) script.js.common.Ansagen.Voice_Feedback_Garagentor_Rechts_Rules compile failed:
at script.js.common.Ansagen.Voice_Feedback_Garagentor_Rechts_Rules:10
2025-03-25 20:41:21.122  - error: javascript.0 (399)     const _cond = ((subCond1688657308886)) || (());
2025-03-25 20:41:21.122  - error: javascript.0 (399)                                                 ^
2025-03-25 20:41:21.122  - error: javascript.0 (399) SyntaxError: Unexpected token ')'
2025-03-25 20:41:21.122  - error: javascript.0 (399)     at new Script (node:vm:117:7)
2025-03-25 20:41:21.122  - error: javascript.0 (399)     at createVM (/opt/iobroker/node_modules/iobroker.javascript/main.js:1956:21)
2025-03-25 20:41:21.122  - error: javascript.0 (399)     at prepareScript (/opt/iobroker/node_modules/iobroker.javascript/main.js:2224:37)
2025-03-25 20:41:21.122  - error: javascript.0 (399)     at /opt/iobroker/node_modules/iobroker.javascript/main.js:2322:17
2025-03-25 20:41:21.122  - error: javascript.0 (399)     at Immediate._onImmediate (/opt/iobroker/node_modules/iobroker.javascript/main.js:1732:17)
2025-03-25 20:41:21.122  - error: javascript.0 (399)     at process.processImmediate (node:internal/timers:485:21)

iobroker.current.log (in debug mode!)

No response

Version of nodejs

v20.19.0

Version of ioBroker js-controller

7.0.6

Version of adapter

8.9.1

wendy2702 avatar Mar 25 '25 19:03 wendy2702

Can you provide the rule that generates the code above?

GermanBluefox avatar Jul 27 '25 05:07 GermanBluefox

Please find below:

{
  "triggers": [
    {
      "id": "TriggerState",
      "acceptedBy": "triggers",
      "_id": 1688649159665,
      "tagCard": "on change",
      "oid": "hm-rpc.0.NEQ0529935.3.STATE",
      "oidRole": "sensor.window",
      "oidType": "boolean",
      "oidDef": false,
      "oidWrite": false,
      "oidRead": true
    }
  ],
  "conditions": [
    [
      {
        "id": "ConditionState",
        "acceptedBy": "conditions",
        "_id": 1688657308886,
        "tagCard": "=",
        "oid": "hm-rpc.0.REQ0571844.1.STATE",
        "value": false,
        "oidRole": "sensor.window",
        "oidType": "boolean",
        "oidDef": false,
        "oidWrite": false,
        "oidRead": true,
        "useTrigger": true
      }
    ],
    []
  ],
  "justCheck": false,
  "actions": {
    "then": [
      {
        "id": "ActionSayText",
        "acceptedBy": "actions",
        "_id": 1688649250057,
        "instance": "sayit.2",
        "language": "_",
        "textVol": "Volume",
        "volume": 100,
        "text": "Garagentor rechts zu"
      },
      {
        "id": "ActionPrintText",
        "acceptedBy": "actions",
        "_id": 1688649275246,
        "text": "Garage rechts zu"
      },
      {
        "id": "ActionSetState",
        "acceptedBy": "actions",
        "_id": 1716293721563,
        "tagCard": "control",
        "oid": "hass.0.entities.input_text.input_text_tts_text.set_value",
        "value": "Garagentor rechts zu",
        "oidType": "mixed",
        "oidWrite": true,
        "oidRead": false
      }
    ],
    "else": [
      {
        "id": "ActionSayText",
        "acceptedBy": "actions",
        "_id": 1688657531936,
        "instance": "sayit.2",
        "language": "_",
        "textVol": "Volume",
        "volume": 100,
        "text": "Garagentor rechts auf"
      },
      {
        "id": "ActionPrintText",
        "acceptedBy": "actions",
        "_id": 1688658103726,
        "text": "Garage rechts auf"
      },
      {
        "id": "ActionSetState",
        "acceptedBy": "actions",
        "_id": 1716293819842,
        "tagCard": "control",
        "oid": "hass.0.entities.input_text.input_text_tts_text.set_value",
        "value": "Garagentor rechts auf",
        "oidType": "mixed",
        "oidWrite": true,
        "oidRead": false
      }
    ]
  }
}

wendy2702 avatar Jul 28 '25 12:07 wendy2702