Supergiovane / node-red-contrib-knx-ultimate

Control your KNX intallation via Node-Red! A bunch of KNX nodes, with integrated Philips HUE control and ETS group address importer.
https://youtu.be/egRbR_KwP9I
MIT License
141 stars 34 forks source link

setConfig issues #363

Closed Alloc86 closed 4 weeks ago

Alloc86 commented 1 month ago

Hi Massimo,

haven't written in a long time ;) I was trying to clean up my shit a bit and stumbled upon this issue:

Describe the bug When sending a setConfig message to a device node it's state says "Invalid address format: Only 3 level addresses are allowed". The input definitely has a 3 level address though. As not being able to test how it works yet due to this bug I'm also not sure whether I need to set the DPT (either by a config message or in the inspector of the node) or if the node would automatically get the DPT from the ETS import, like it does for e.g. sending to a universal node. Besides this bug it would also be nice if setConfig also allowed setting the output message topic for the node.

To Reproduce Write here the steps to reproduce the behavior, for example:

  1. Import this flow:
    [
    {
        "id": "60b2e9789756365d",
        "type": "knxUltimate",
        "z": "488ff9336498d7ff",
        "server": "3490cbfd.0b01f4",
        "topic": "",
        "outputtopic": "StatusSchalten",
        "dpt": "1.011",
        "initialread": 0,
        "notifyreadrequest": false,
        "notifyresponse": true,
        "notifywrite": true,
        "notifyreadrequestalsorespondtobus": false,
        "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
        "listenallga": false,
        "name": "",
        "outputtype": "update",
        "outputRBE": false,
        "inputRBE": false,
        "formatmultiplyvalue": 1,
        "formatnegativevalue": "leave",
        "formatdecimalsvalue": 999,
        "passthrough": "no",
        "x": 770,
        "y": 920,
        "wires": [
            [
                "a9c3c4d1eaad0133"
            ]
        ]
    },
    {
        "id": "f35adb249d95d80e",
        "type": "inject",
        "z": "488ff9336498d7ff",
        "name": "Init GAs",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "1",
        "topic": "Init",
        "payload": "",
        "payloadType": "date",
        "x": 280,
        "y": 940,
        "wires": [
            [
                "5c54bc689b3ece11"
            ]
        ]
    },
    {
        "id": "5c54bc689b3ece11",
        "type": "function",
        "z": "488ff9336498d7ff",
        "name": "Init Msgs",
        "func": "var msgs = [];\nmsgs.push({ setConfig: { setGroupAddress: \"3/2/12\" } });\nmsgs.push ({ setConfig: { setGroupAddress: \"5/2/152\" } });\nmsgs.push ({ setConfig: { setGroupAddress: \"5/2/155\" } });\nmsgs.push ({ setConfig: { setGroupAddress: \"5/2/156\" } });\n\nreturn msgs;",
        "outputs": 4,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 440,
        "y": 940,
        "wires": [
            [
                "5414ebe0a57eace4",
                "60b2e9789756365d"
            ],
            [
                "718956c048fe14b1"
            ],
            [
                "3a93b3cc6c9727bd"
            ],
            [
                "9b972df0afb58c81"
            ]
        ]
    },
    {
        "id": "5414ebe0a57eace4",
        "type": "debug",
        "z": "488ff9336498d7ff",
        "name": "Init Msgs",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 780,
        "y": 860,
        "wires": []
    },
    {
        "id": "a9c3c4d1eaad0133",
        "type": "debug",
        "z": "488ff9336498d7ff",
        "name": "Status",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1070,
        "y": 920,
        "wires": []
    }
    ]
  2. Set the KNX node to have a KNX config
  3. Click the inject trigger
  4. Look at the debug node output to verify message validity
  5. See that the KNX node's status says invalid address

Expected behavior Address should be accepted.

Screenshots image Output of the "Init Msgs" debug node: image

Knx-Ultimate Version

Are you running node-red behind homematic, docker or anything similar? Native installation on a Debian host.

If you need any more details please let me know :)

Supergiovane commented 1 month ago

Hi! That’s strange. I’ll take a look ASAP

Supergiovane commented 1 month ago

Fixed in v. 3.0.0 Such version will have the knx engine rewrote in typescript, so it will be out a little late. In the meantime, please set any group address to the "KNX Device" of your sample, instead of leaving it empty. This fixes the issue as well.

Alloc86 commented 4 weeks ago

Thanks, this works as a workaround :)

One thing I noticed: It seems like it indeed does not automatically fetch the DPT from the ETS import when only setting the GA. That would be a nice addition when you get around to this later on.

Supergiovane commented 4 weeks ago

Noted. Thanks

Supergiovane commented 4 weeks ago

Done in 3.0.0

Supergiovane commented 4 weeks ago

PS: you must pass the setDPT = 'auto' to automatically retrieve the datapoint.