Are 'areas' available in Node-Red?

It’s possible to turn_off light in an area in HA, but it doesn’t seem to be doable in Node-Red yet?

You can create a group in Home Assistant and turn it on or off in Node Red using a Call Service Node. I just did this today to turn all lights on or off from Alexa.

The delays are probably not necessary, but some of the downstairs lights wouldn’t respond without a delay.

[{“id”:“843213c8.3155a”,“type”:“alexa-local”,“z”:“eb64de9a.f978e”,“devicename”:“All Lights”,“inputtrigger”:false,“x”:140,“y”:800,“wires”:[[“a39f6780b785b835”]]},{“id”:“d6bff3bc8c0eeb43”,“type”:“api-call-service”,“z”:“eb64de9a.f978e”,“name”:“All Upstairs Lights ON”,“server”:“cc0d1734.6963a8”,“version”:5,“debugenabled”:false,“domain”:“homeassistant”,“service”:“turn_on”,“areaId”:[],“deviceId”:[],“entityId”:[“group.upstairs”],“data”:"",“dataType”:“jsonata”,“mergeContext”:"",“mustacheAltTags”:false,“outputProperties”:[],“queue”:“none”,“x”:600,“y”:720,“wires”:[[]]},{“id”:“06b4b3ce5f121b28”,“type”:“api-call-service”,“z”:“eb64de9a.f978e”,“name”:“All Downstairs Lights ON”,“server”:“cc0d1734.6963a8”,“version”:5,“debugenabled”:false,“domain”:“homeassistant”,“service”:“turn_on”,“areaId”:[],“deviceId”:[],“entityId”:[“group.downstairs”],“data”:"",“dataType”:“jsonata”,“mergeContext”:"",“mustacheAltTags”:false,“outputProperties”:[],“queue”:“none”,“x”:750,“y”:760,“wires”:[[]]},{“id”:“6148c8bc62940e65”,“type”:“delay”,“z”:“eb64de9a.f978e”,“name”:"",“pauseType”:“delay”,“timeout”:“2”,“timeoutUnits”:“seconds”,“rate”:“1”,“nbRateUnits”:“1”,“rateUnits”:“second”,“randomFirst”:“1”,“randomLast”:“5”,“randomUnits”:“seconds”,“drop”:false,“allowrate”:false,“outputs”:1,“x”:560,“y”:760,“wires”:[[“06b4b3ce5f121b28”]]},{“id”:“a39f6780b785b835”,“type”:“switch”,“z”:“eb64de9a.f978e”,“name”:“ON or OFF”,“property”:“payload”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“on”,“vt”:“str”},{“t”:“eq”,“v”:“off”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:2,“x”:330,“y”:800,“wires”:[[“d6bff3bc8c0eeb43”,“6148c8bc62940e65”],[“e6990a94c11b1fdc”,“885621010560a48f”]]},{“id”:“e6990a94c11b1fdc”,“type”:“api-call-service”,“z”:“eb64de9a.f978e”,“name”:“All Upstairs Lights OFF”,“server”:“cc0d1734.6963a8”,“version”:5,“debugenabled”:false,“domain”:“homeassistant”,“service”:“turn_off”,“areaId”:[],“deviceId”:[],“entityId”:[“group.upstairs”],“data”:"",“dataType”:“jsonata”,“mergeContext”:"",“mustacheAltTags”:false,“outputProperties”:[],“queue”:“none”,“x”:610,“y”:880,“wires”:[[]]},{“id”:“1f66a37c5165c1d8”,“type”:“api-call-service”,“z”:“eb64de9a.f978e”,“name”:“All Downstairs Lights OFF”,“server”:“cc0d1734.6963a8”,“version”:5,“debugenabled”:false,“domain”:“homeassistant”,“service”:“turn_off”,“areaId”:[],“deviceId”:[],“entityId”:[“group.downstairs”],“data”:"",“dataType”:“jsonata”,“mergeContext”:"",“mustacheAltTags”:false,“outputProperties”:[],“queue”:“none”,“x”:750,“y”:920,“wires”:[[]]},{“id”:“885621010560a48f”,“type”:“delay”,“z”:“eb64de9a.f978e”,“name”:"",“pauseType”:“delay”,“timeout”:“2”,“timeoutUnits”:“seconds”,“rate”:“1”,“nbRateUnits”:“1”,“rateUnits”:“second”,“randomFirst”:“1”,“randomLast”:“5”,“randomUnits”:“seconds”,“drop”:false,“allowrate”:false,“outputs”:1,“x”:560,“y”:920,“wires”:[[“1f66a37c5165c1d8”]]},{“id”:“cc0d1734.6963a8”,“type”:“server”,“name”:“Home Assistant- Raspberry”,“version”:2,“addon”:true,“rejectUnauthorizedCerts”:true,“ha_boolean”:“y|yes|true|on|home|open”,“connectionDelay”:true,“cacheJson”:true,“heartbeat”:false,“heartbeatInterval”:30}]

Yes, I know, I’ve currently created light groups, but it would be nice to have the area in node-red as well.

The call-service node has an area field.

image

And, it works!

Huh? I don’t see that in my call-service node? Is that a stand-alone NR, or the HA addon?

Sounds like you need to update the HA nodes.

1 Like

You are absolutely right, I had completely forgotten about that part, so it IS there, GREAT!

Hi guys,

Does anyone know how to get the AREA from the device_id in Node Red?

I’m using inovelli switches, and I would like 2X up/down to toggle the lights in the area that they are triggered from. For example, if I want to turn all the lights on in the kitchen, I should be able to go to any switch in the kitchen, and 2x click on it. I don’t want to create a flow for each area and each switch.

In node red, when you’re listening for z-wave events, you can capture the device_id and node_id from a switch that has been tapped. I would like to use that information to get the area, so that the area can be toggled.

Strangely, this template works:

{{ area_id('5897334658b0719fcfa8d7a9fc203e88')}}

But this doesn’t:

{{ area_id('{{msg.payload.event.device_id}}')}} 

Thoughts?

I don’t use node red and this isn’t quite what you’re looking for but, since you’re not getting any other responses, you might check out: Control LEDs and LED Effects on Inovelli Dimmers, Switches, and Combo Fan / Lights by Area, Device, or Entity

Thank you, Kevin. There may be a script in that link that will move me closer to what I’m looking for. I appreciate it.

This thread helped me:

Thanks, jellelle. I haven’t been successful in getting this little flow to work. I’m assuming the ‘xxxx’ needs to be replace with the payload, but I can’t get it working. Have you got it working?

Yes, I found the area using that thread

[
    {
        "id": "232b60081f1e2976",
        "type": "function",
        "z": "d38e7ee93b0ccd72",
        "name": "function 4",
        "func": "var smokeDetectorId = \"binary_sensor.fibaro_fgsd002_006_smoke_detected\";\nvar template = \"{{area_id('\" + smokeDetectorId + \"')}}\";\n\nmsg.template = template;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 520,
        "y": 1060,
        "wires": [
            [
                "9252d41859fee091"
            ]
        ]
    },
    {
        "id": "9252d41859fee091",
        "type": "api-render-template",
        "z": "d38e7ee93b0ccd72",
        "name": "",
        "server": "2787f8eb66ddfc4a",
        "version": 0,
        "template": "",
        "resultsLocation": "payload",
        "resultsLocationType": "msg",
        "templateLocation": "template",
        "templateLocationType": "msg",
        "x": 680,
        "y": 1060,
        "wires": [
            [
                "47a5496ed151ee4f"
            ]
        ]
    },
    {
        "id": "47a5496ed151ee4f",
        "type": "debug",
        "z": "d38e7ee93b0ccd72",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 830,
        "y": 1060,
        "wires": []
    },
    {
        "id": "7b8303b99e0f7998",
        "type": "inject",
        "z": "d38e7ee93b0ccd72",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 360,
        "y": 1060,
        "wires": [
            [
                "232b60081f1e2976"
            ]
        ]
    },
    {
        "id": "2787f8eb66ddfc4a",
        "type": "server",
        "name": "Home Assistant",
        "version": 5,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": ": ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "default",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": false
    }
]