Mmwave trigger

Hello all
I’m using Node red on HAOS
I have a new mmwave sensor.I use this sensor to control temp, motion and light.

In the case of controlling lights, I can use the PIR to turn the light on fine.
And i want to keep the light on while i am there. so far do good

However i cannot seem to turn the light of

I have a binary sensor that detect movement and keep the light on.

I added a delay to the mix that connects to the current state node
And I would like to configure the binary sensor to cause the light to turn off
switch.everything_presence_one_761ef8_mmwave_sensor
if the sensor does not detect movement for 30 seconds i would like the light to turn off

I can not seem to configure the current state node to turn off the light
The entity tells me that it is a switch hence if the condition is off then it should turn of the light.

I do not know what I am missing to make this work

Thank you in advance for any help provided

Did you figure this out? I use Events: State. The top connector on the node is fired when the condition is true and bottom connector is for false - this alone was messing me up since I did not know that. So connect the top for turning on lights. And bottom to your wait until node before the turn off.

(in this example: the events state node is a single node not two)
Events state --(top)–> State filter → Light.turn_on
Events state --(bottom)–> wait until → light.turn_off

The “state filter” in my example is a current state check on the light. if the light is already on, I dont pass on the command - which really doesnt matter too much, I just wanted to be more precise with how I set mine up.

I use an apollo msr1 which gives me a state if something is moving in the radar target. So I set the Event State rules as If State is boolean true. State type is boolean. I like that the boolean operator converts all the various repsonses that could occur to true and false.

From the doc: State Typestring
Values: string|number|boolean
Default: string
Convert the state of the entity to the selected type. Boolean will be converted to true based on if the string is equal by default to (y|yes|true|on|home|open). Original value stored in msg.data.original_state

Thank you for this reply and your suggestion. I like very much your approach. I’m very illiterate in this field. Example i just figured out the difference between mmwave and presence. I

I still need to figure out when to use boolean

I will eventually learn this too

I solved it this way.

It is not as elegant as yours

Here’s a PIR sensor and timer which might help. It takes and input from a sensor and the output is gated based on a scheduler connected to the bottom left.

[
    {
        "id": "9e14513570739b4d",
        "type": "gate",
        "z": "837c7ac2f814d114",
        "name": "",
        "controlTopic": "control",
        "defaultState": "open",
        "openCmd": "open",
        "closeCmd": "close",
        "toggleCmd": "toggle",
        "defaultCmd": "default",
        "statusCmd": "status",
        "persist": false,
        "storeName": "memory",
        "x": 410,
        "y": 240,
        "wires": [
            [
                "1b2f1ccf20977f7b",
                "936c17174a4a0cff"
            ]
        ]
    },
    {
        "id": "284ab4f72dd957e2",
        "type": "change",
        "z": "837c7ac2f814d114",
        "name": "translate scheduler",
        "rules": [
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "ON",
                "fromt": "str",
                "to": "close",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "OFF",
                "fromt": "str",
                "to": "open",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 530,
        "y": 500,
        "wires": [
            [
                "071a721b4a6139b2"
            ]
        ]
    },
    {
        "id": "071a721b4a6139b2",
        "type": "function",
        "z": "837c7ac2f814d114",
        "name": "add gate control command",
        "func": "msg.topic=\"control\"\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 560,
        "y": 460,
        "wires": [
            [
                "9e14513570739b4d",
                "9acd1f0910122186"
            ]
        ]
    },
    {
        "id": "1b2f1ccf20977f7b",
        "type": "api-call-service",
        "z": "837c7ac2f814d114",
        "name": "",
        "server": "657645c6ebda1a8b",
        "version": 5,
        "debugenabled": false,
        "domain": "light",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [
            "3fbbd5115e7a6eb442eda3a036d6a86c"
        ],
        "entityId": [],
        "data": "{}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1070,
        "y": 240,
        "wires": [
            []
        ]
    },
    {
        "id": "281c2fd8d50c759c",
        "type": "inject",
        "z": "837c7ac2f814d114",
        "name": "Force Off",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "reset",
                "v": "",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 100,
        "y": 340,
        "wires": [
            [
                "9139c72539d4cf7b",
                "936c17174a4a0cff"
            ]
        ]
    },
    {
        "id": "9139c72539d4cf7b",
        "type": "api-call-service",
        "z": "837c7ac2f814d114",
        "name": "",
        "server": "657645c6ebda1a8b",
        "version": 5,
        "debugenabled": false,
        "domain": "light",
        "service": "turn_off",
        "areaId": [],
        "deviceId": [
            "3fbbd5115e7a6eb442eda3a036d6a86c"
        ],
        "entityId": [],
        "data": "{}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1070,
        "y": 300,
        "wires": [
            []
        ]
    },
    {
        "id": "604c83570e8d0274",
        "type": "switch",
        "z": "837c7ac2f814d114",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "ON",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "OFF",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 870,
        "y": 280,
        "wires": [
            [
                "1b2f1ccf20977f7b"
            ],
            [
                "9139c72539d4cf7b"
            ]
        ]
    },
    {
        "id": "936c17174a4a0cff",
        "type": "trigger",
        "z": "837c7ac2f814d114",
        "name": "",
        "op1": "1",
        "op2": "OFF",
        "op1type": "str",
        "op2type": "str",
        "duration": "180",
        "extend": true,
        "overrideDelay": true,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 570,
        "y": 280,
        "wires": [
            [
                "9acd1f0910122186"
            ]
        ]
    },
    {
        "id": "9acd1f0910122186",
        "type": "gate",
        "z": "837c7ac2f814d114",
        "name": "",
        "controlTopic": "control",
        "defaultState": "open",
        "openCmd": "open",
        "closeCmd": "close",
        "toggleCmd": "toggle",
        "defaultCmd": "default",
        "statusCmd": "status",
        "persist": false,
        "storeName": "memory",
        "x": 730,
        "y": 280,
        "wires": [
            [
                "604c83570e8d0274"
            ]
        ]
    },
    {
        "id": "3c970a8ab0fad0f3",
        "type": "link in",
        "z": "837c7ac2f814d114",
        "name": "Global dusk to 23:45",
        "links": [
            "ab3e3bbd31ed88cc"
        ],
        "x": 335,
        "y": 460,
        "wires": [
            [
                "604c83570e8d0274",
                "284ab4f72dd957e2"
            ]
        ]
    },
    {
        "id": "93bb3a954a4bb7f8",
        "type": "link in",
        "z": "837c7ac2f814d114",
        "name": "Office desk light",
        "links": [
            "cd6dabb4e648ea8e"
        ],
        "x": 125,
        "y": 40,
        "wires": [
            [
                "6c6073f6e0744f5c"
            ]
        ]
    },
    {
        "id": "54be4594d5c58e31",
        "type": "change",
        "z": "837c7ac2f814d114",
        "name": "Set delay 180s",
        "rules": [
            {
                "t": "set",
                "p": "delay",
                "pt": "msg",
                "to": "180000",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 420,
        "y": 80,
        "wires": [
            [
                "9e14513570739b4d"
            ]
        ]
    },
    {
        "id": "5e7bef2a4bfb3017",
        "type": "inject",
        "z": "837c7ac2f814d114",
        "name": "OFF (NP)",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "OFF",
        "payloadType": "str",
        "x": 100,
        "y": 260,
        "wires": [
            [
                "6c6073f6e0744f5c"
            ]
        ]
    },
    {
        "id": "52d238f0adf50908",
        "type": "inject",
        "z": "837c7ac2f814d114",
        "name": "ON",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "ON",
        "payloadType": "str",
        "x": 90,
        "y": 220,
        "wires": [
            [
                "6c6073f6e0744f5c"
            ]
        ]
    },
    {
        "id": "6c6073f6e0744f5c",
        "type": "switch",
        "z": "837c7ac2f814d114",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "on",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "OFF",
                "vt": "str"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 3,
        "x": 230,
        "y": 80,
        "wires": [
            [
                "54be4594d5c58e31"
            ],
            [],
            [
                "54be4594d5c58e31"
            ]
        ]
    },
    {
        "id": "bb978d3bc9349fbc",
        "type": "inject",
        "z": "837c7ac2f814d114",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 100,
        "y": 300,
        "wires": [
            [
                "6c6073f6e0744f5c"
            ]
        ]
    },
    {
        "id": "57642f5f563075a1",
        "type": "comment",
        "z": "837c7ac2f814d114",
        "name": "INPUT",
        "info": "payload - trigger\n-----------------\ntimestamp - On\nON command - On\nOFF command - dropped/ignored",
        "x": 90,
        "y": 80,
        "wires": []
    },
    {
        "id": "657645c6ebda1a8b",
        "type": "server",
        "name": "Home Assistant",
        "version": 4,
        "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"
    }
]