Hi there,
I wanted to switch all my HA automation to nodered but im having trouble with a conditional. I have 2 lights. one of them turns on automatically in the morning (roomplug). I want the other light (desklight) to turn on only if the first light is on.
Using the setup i made, once the condition is made on the button press, it just keeps triggering the light to toggle even if the conditions are false.
Is there some sort of timing issue that i’m missing. ?
[
{
"id": "c2b1904b3b1b9d6d",
"type": "api-call-service",
"z": "acc47017a1dba1ec",
"name": "DeskLightToggle",
"server": "0b271414fe13557f",
"version": 5,
"debugenabled": false,
"domain": "switch",
"service": "toggle",
"areaId": [],
"deviceId": [
"5facf789a17433046fc25378a163a9c5"
],
"entityId": [],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1290,
"y": 520,
"wires": [
[]
]
},
{
"id": "0f9fd7ce21a51f44",
"type": "api-current-state",
"z": "acc47017a1dba1ec",
"name": "",
"server": "0b271414fe13557f",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "switch.roomplug",
"state_type": "str",
"blockInputOverrides": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "roomplugon",
"valueType": "str"
},
{
"property": "topic",
"propertyType": "msg",
"value": "roomplug",
"valueType": "str"
}
],
"for": "0.1",
"forType": "num",
"forUnits": "seconds",
"override_topic": false,
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 750,
"y": 560,
"wires": [
[
"154d0293b64e4e11"
],
[]
]
},
{
"id": "6c03a624ec7755d3",
"type": "api-current-state",
"z": "acc47017a1dba1ec",
"name": "",
"server": "0b271414fe13557f",
"version": 3,
"outputs": 2,
"halt_if": "off",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "switch.bedroom_desk_light",
"state_type": "str",
"blockInputOverrides": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "desklightoff",
"valueType": "str"
},
{
"property": "topic",
"propertyType": "msg",
"value": "desklight",
"valueType": "str"
}
],
"for": "0.1",
"forType": "num",
"forUnits": "seconds",
"override_topic": false,
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 780,
"y": 660,
"wires": [
[
"154d0293b64e4e11"
],
[
"0ea1313fd2cc5e52"
]
]
},
{
"id": "0ea1313fd2cc5e52",
"type": "debug",
"z": "acc47017a1dba1ec",
"name": "false",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1070,
"y": 740,
"wires": []
},
{
"id": "1133269ec86c5a7d",
"type": "debug",
"z": "acc47017a1dba1ec",
"name": "debugtrigger",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 690,
"y": 740,
"wires": []
},
{
"id": "154d0293b64e4e11",
"type": "and-gate",
"z": "acc47017a1dba1ec",
"name": "",
"rules": [
{
"t": "eq",
"v": "roomplugon",
"vt": "str",
"propertyType": "msg",
"property": "payload",
"topic": "roomplug"
},
{
"t": "eq",
"v": "desklightoff",
"vt": "str",
"propertyType": "msg",
"property": "payload",
"topic": "desklight"
}
],
"outputTopic": "andcheck1",
"gateType": "and",
"emitOnlyIfTrue": true,
"x": 1080,
"y": 580,
"wires": [
[
"c2b1904b3b1b9d6d",
"96cf9c319c0ae242"
]
]
},
{
"id": "96cf9c319c0ae242",
"type": "debug",
"z": "acc47017a1dba1ec",
"name": "debug 3",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1260,
"y": 640,
"wires": []
},
{
"id": "7835beb9628d7b65",
"type": "ha-device",
"z": "acc47017a1dba1ec",
"name": "",
"server": "0b271414fe13557f",
"version": 1,
"exposeAsEntityConfig": "",
"inputs": 0,
"deviceType": "trigger",
"device": "0895dc5ee3910896ba0d25f9662f6e4b",
"event": {
"device_id": "0895dc5ee3910896ba0d25f9662f6e4b",
"domain": "zha",
"platform": "device",
"type": "remote_button_long_press",
"subtype": "remote_button_long_press",
"metadata": {}
},
"capabilities": [],
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 370,
"y": 620,
"wires": [
[
"0f9fd7ce21a51f44",
"6c03a624ec7755d3",
"1133269ec86c5a7d"
]
]
},
{
"id": "0b271414fe13557f",
"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
}
]