Foddy / node-red-contrib-huemagic

Philips Hue node to control bridges, lights, groups, motion sensors, temperature sensors and Lux sensors using Node-RED.
https://flows.nodered.org/node/node-red-contrib-huemagic
Apache License 2.0
201 stars 67 forks source link

Not possible to retrieve light status without subscribing to all light events? #248

Closed adams-family closed 2 years ago

adams-family commented 3 years ago

Describe the bug I'd like to retrieve the status of a light at a certain point in time. Currently it seems to me impossible as dropping a light object to the flow either subscribes to all events that happens to the light or doesn't return any output.

I'd like to retrieve the light status only once.

Flow to Reproduce

[
    {
        "id": "8f530250.bbbae",
        "type": "inject",
        "z": "fbe344ef.9fc498",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 140,
        "y": 1120,
        "wires": [
            [
                "e67fc9.e804f838"
            ]
        ]
    },
    {
        "id": "e67fc9.e804f838",
        "type": "function",
        "z": "fbe344ef.9fc498",
        "name": "get status",
        "func": "return {\n    payload: {\n        status: true\n    }\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 320,
        "y": 1120,
        "wires": [
            [
                "a07565a6.4550f8"
            ]
        ]
    },
    {
        "id": "a07565a6.4550f8",
        "type": "hue-light",
        "z": "fbe344ef.9fc498",
        "name": "Light",
        "bridge": "93b0c51a.9c98f8",
        "lightid": "10",
        "colornamer": true,
        "skipevents": false,
        "universalevents": false,
        "x": 490,
        "y": 1120,
        "wires": [
            [
                "9a090223.9389a8"
            ]
        ]
    },
    {
        "id": "9a090223.9389a8",
        "type": "debug",
        "z": "fbe344ef.9fc498",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 650,
        "y": 1120,
        "wires": []
    },
    {
        "id": "93b0c51a.9c98f8",
        "type": "hue-bridge",
        "z": "",
        "name": "***************",
        "bridge": "*************************",
        "key": "******************************",
        "interval": "1500",
        "disableupdates": false
    }
]

Expected behavior I expect to see a debug message whenever I inject the timpestamp into the flow:

image

What happens: the debug message is printed every time the status of the light changes in addition to when the timestamp is injected.

By turning off "events" the light node is never returning any output, not even when the timestamp is injected.

image

Please complete the following information:

Additional context nodered-contrib-huemagic version: 3.0.0

Foddy commented 2 years ago

Fixed with the latest release