NEWS
Licht schalten mit BWM abhängig von Helligkeit
-
Hallo,
veruche mich gerade in NodeRed (Redmatic) einzuarbeiten, und das ein oder andere klappt schon ganz gut.
Zum Thema:
Ich möchte im Flur das Licht in Abhängigkeit vom Bewegung und Helligkeit schalten.
Er soll aber auch triggern, wenn das Licht bereits an ist, und der BWM eine Bewegung erkennt, wenn man zum Beispiel bissl länger braucht um sich die Schuhe anzuziehen.
HIer triggert ein Aqara BWM einen Shelly Aktor.
Das funktioniert mittel Boolean Node sehr gut.
Jedoch sendet der BWM im Abstand von 55min ein object in dem die Helligkeit, Batterie etc. stehen.
Und plötzlich geht das Licht an, obwohl der BWM keine Bewegung erkannt hat. Ich denke, dass hier im Boolean-Node der Cash vom topic-Bewegung immer noch auf true steht.
Wie würdet ihr den Status nach erkanntet Bewegung wieder auf false setzen?
Hab grad einen Knoten im Kopf :-)!
Danke schon mal!
[{"id":"bdea6c96.7d5c7","type":"zigbee-converter","z":"e3428479.9fb998","shepherd":"267282eb.316f36","name":"BWM Flur","topic":"zigbee/${name}","settopic":"zigbee/${name}/set","gettopic":"zigbee/${name}/get","device":"0x00158d0002b71ff2","attribute":"","payload":"json","x":80,"y":760,"wires":[["b025b071.98d848","99ff734.09d259","1624318b.89947e"]]},{"id":"b025b071.98d848","type":"change","z":"e3428479.9fb998","name":"Bewegung","rules":[{"t":"move","p":"payload.occupancy","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":720,"wires":[["e2bbf107.22b61","426ccd93.fd584c"]]},{"id":"99ff734.09d259","type":"change","z":"e3428479.9fb998","name":"Helligkeit","rules":[{"t":"move","p":"payload.illuminance","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":240,"y":800,"wires":[["8ff86d1b.94bda8","8c2c6554.4d962"]]},{"id":"8ff86d1b.94bda8","type":"switch","z":"e3428479.9fb998","name":"Tag/Nacht","property":"payload","propertyType":"msg","rules":[{"t":"lte","v":"5","vt":"num"},{"t":"gt","v":"5","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":480,"y":800,"wires":[["292ebafe.c848ce"],["a4f78f11.69aac"]]},{"id":"292ebafe.c848ce","type":"change","z":"e3428479.9fb998","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"topic","pt":"msg","to":"Helligkeit","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":760,"wires":[["d5bf6109.ab6ca"]]},{"id":"a4f78f11.69aac","type":"change","z":"e3428479.9fb998","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"topic","pt":"msg","to":"Helligkeit","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":800,"wires":[["d5bf6109.ab6ca"]]},{"id":"941a128e.870478","type":"switch","z":"e3428479.9fb998","name":"true","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":510,"y":680,"wires":[["1f05a247.b41f96"]]},{"id":"fce69563.95f97","type":"switch","z":"e3428479.9fb998","name":"false","property":"payload","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":510,"y":720,"wires":[["75f17746.2ee6a"]]},{"id":"d5bf6109.ab6ca","type":"BooleanLogicUltimate","z":"e3428479.9fb998","name":"","filtertrue":"onlytrue","persist":true,"sInitializeWith":"WaitForPayload","triggertopic":"trigger","outputtriggeredby":"all","inputCount":2,"topic":"result","x":810,"y":740,"wires":[["73c1bfdc.90377"],[],[]]},{"id":"4d94f215.1c35bc","type":"debug","z":"e3428479.9fb998","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1210,"y":760,"wires":[]},{"id":"75f17746.2ee6a","type":"change","z":"e3428479.9fb998","name":"false","rules":[{"t":"set","p":"topic","pt":"msg","to":"Motion","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":720,"wires":[["d5bf6109.ab6ca","2a8c6e8e.0e48d2"]]},{"id":"1f05a247.b41f96","type":"change","z":"e3428479.9fb998","name":"true","rules":[{"t":"set","p":"topic","pt":"msg","to":"Motion","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":680,"wires":[["d5bf6109.ab6ca","2a8c6e8e.0e48d2"]]},{"id":"73c1bfdc.90377","type":"trigger","z":"e3428479.9fb998","name":"","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"3","extend":true,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1020,"y":740,"wires":[["4d94f215.1c35bc","ff7a0978.295158"]]},{"id":"1624318b.89947e","type":"debug","z":"e3428479.9fb998","name":"Zigbee","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":170,"y":860,"wires":[]},{"id":"e2bbf107.22b61","type":"delay","z":"e3428479.9fb998","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":270,"y":660,"wires":[["941a128e.870478","fce69563.95f97"]]},{"id":"ff7a0978.295158","type":"ccu-value","z":"e3428479.9fb998","name":"","iface":"CUxD","channel":"CUX2801009:1 Shelly_Studio:1","datapoint":"STATE","mode":"","start":true,"change":true,"cache":false,"queue":false,"on":0,"onType":"undefined","ramp":0,"rampType":"undefined","working":false,"ccuConfig":"38263145.35ea0e","topic":"${CCU}/${Interface}/${channel}/${datapoint}","x":1230,"y":680,"wires":[["578e043d.b5ec7c"]]},{"id":"2a8c6e8e.0e48d2","type":"BooleanLogicUltimate","z":"e3428479.9fb998","name":"","filtertrue":"onlytrue","persist":true,"sInitializeWith":"WaitForPayload","triggertopic":"trigger","outputtriggeredby":"all","inputCount":2,"topic":"result","x":810,"y":660,"wires":[["73c1bfdc.90377"],[],[]]},{"id":"578e043d.b5ec7c","type":"change","z":"e3428479.9fb998","name":"Licht ist noch an","rules":[{"t":"set","p":"topic","pt":"msg","to":"Licht","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":600,"wires":[["2a8c6e8e.0e48d2"]]},{"id":"426ccd93.fd584c","type":"debug","z":"e3428479.9fb998","name":"Bewegung","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":410,"y":760,"wires":[]},{"id":"8c2c6554.4d962","type":"debug","z":"e3428479.9fb998","name":"Helligkeit","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":410,"y":860,"wires":[]},{"id":"267282eb.316f36","type":"zigbee-shepherd","name":"Zigbee","path":"/dev/ttyUSB0","baudRate":"115200","rtscts":true,"channelList":[11],"led":"disabled","adapter":"zstack"},{"id":"38263145.35ea0e","type":"ccu-connection","name":"localhost","host":"localhost","regaEnabled":true,"bcrfEnabled":true,"iprfEnabled":true,"virtEnabled":true,"bcwiEnabled":false,"cuxdEnabled":true,"regaPoll":true,"regaInterval":"30","rpcPingTimeout":"60","rpcInitAddress":"127.0.0.1","rpcServerHost":"127.0.0.1","rpcBinPort":"2047","rpcXmlPort":"2048","queueTimeout":"5000","queuePause":"250","contextStore":""}]
-
@nousefor82 Hi, du kriegst wahrscheinlich über deinen Zigbee ein payload true rein, der wird durchgereicht, trotz der change Node, du changed ja nur payload.occupancy zu payload: Kommt ein payload rein wird es ja weitergeleitet.
Ich würde die change Nodes weglassen und in den switches die msg payload.occupancy und payload.illuminance abfragen.[ { "id": "bdea6c96.7d5c7", "type": "zigbee-converter", "z": "9e1c0edb.e6d2d", "shepherd": "267282eb.316f36", "name": "BWM Flur", "topic": "zigbee/${name}", "settopic": "zigbee/${name}/set", "gettopic": "zigbee/${name}/get", "device": "0x00158d0002b71ff2", "attribute": "", "payload": "json", "x": 170, "y": 580, "wires": [ [ "1624318b.89947e", "e2bbf107.22b61", "8ff86d1b.94bda8" ] ] }, { "id": "8ff86d1b.94bda8", "type": "switch", "z": "9e1c0edb.e6d2d", "name": "Tag/Nacht", "property": "payload.illuminance", "propertyType": "msg", "rules": [ { "t": "lte", "v": "5", "vt": "num" }, { "t": "gt", "v": "5", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 670, "y": 620, "wires": [ [ "292ebafe.c848ce" ], [ "a4f78f11.69aac" ] ] }, { "id": "292ebafe.c848ce", "type": "change", "z": "9e1c0edb.e6d2d", "name": "true", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "true", "tot": "bool" }, { "t": "set", "p": "topic", "pt": "msg", "to": "Helligkeit", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 820, "y": 580, "wires": [ [ "d5bf6109.ab6ca" ] ] }, { "id": "a4f78f11.69aac", "type": "change", "z": "9e1c0edb.e6d2d", "name": "false", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "false", "tot": "bool" }, { "t": "set", "p": "topic", "pt": "msg", "to": "Helligkeit", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 820, "y": 620, "wires": [ [ "d5bf6109.ab6ca" ] ] }, { "id": "941a128e.870478", "type": "switch", "z": "9e1c0edb.e6d2d", "name": "if", "property": "payload.occupancy", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 700, "y": 500, "wires": [ [ "1f05a247.b41f96" ], [ "75f17746.2ee6a" ] ] }, { "id": "d5bf6109.ab6ca", "type": "BooleanLogicUltimate", "z": "9e1c0edb.e6d2d", "name": "", "filtertrue": "onlytrue", "persist": true, "sInitializeWith": "WaitForPayload", "triggertopic": "trigger", "outputtriggeredby": "all", "inputCount": 2, "topic": "result", "x": 1130, "y": 800, "wires": [ [ "73c1bfdc.90377" ], [], [] ] }, { "id": "4d94f215.1c35bc", "type": "debug", "z": "9e1c0edb.e6d2d", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 1400, "y": 580, "wires": [] }, { "id": "75f17746.2ee6a", "type": "change", "z": "9e1c0edb.e6d2d", "name": "false", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Motion", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 820, "y": 540, "wires": [ [ "d5bf6109.ab6ca", "2a8c6e8e.0e48d2" ] ] }, { "id": "1f05a247.b41f96", "type": "change", "z": "9e1c0edb.e6d2d", "name": "true", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Motion", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 820, "y": 500, "wires": [ [ "d5bf6109.ab6ca", "2a8c6e8e.0e48d2" ] ] }, { "id": "73c1bfdc.90377", "type": "trigger", "z": "9e1c0edb.e6d2d", "name": "", "op1": "true", "op2": "false", "op1type": "bool", "op2type": "bool", "duration": "3", "extend": true, "overrideDelay": false, "units": "min", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 1240, "y": 660, "wires": [ [ "4d94f215.1c35bc", "ff7a0978.295158" ] ] }, { "id": "1624318b.89947e", "type": "debug", "z": "9e1c0edb.e6d2d", "name": "Zigbee", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 360, "y": 680, "wires": [] }, { "id": "e2bbf107.22b61", "type": "delay", "z": "9e1c0edb.e6d2d", "name": "", "pauseType": "delay", "timeout": "50", "timeoutUnits": "milliseconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "x": 460, "y": 480, "wires": [ [ "941a128e.870478" ] ] }, { "id": "ff7a0978.295158", "type": "ccu-value", "z": "9e1c0edb.e6d2d", "name": "", "iface": "CUxD", "channel": "CUX2801009:1 Shelly_Studio:1", "datapoint": "STATE", "mode": "", "start": true, "change": true, "cache": false, "queue": false, "on": 0, "onType": "undefined", "ramp": 0, "rampType": "undefined", "working": false, "ccuConfig": "38263145.35ea0e", "topic": "${CCU}/${Interface}/${channel}/${datapoint}", "x": 1420, "y": 500, "wires": [ [ "578e043d.b5ec7c" ] ] }, { "id": "2a8c6e8e.0e48d2", "type": "BooleanLogicUltimate", "z": "9e1c0edb.e6d2d", "name": "", "filtertrue": "onlytrue", "persist": true, "sInitializeWith": "WaitForPayload", "triggertopic": "trigger", "outputtriggeredby": "all", "inputCount": 2, "topic": "result", "x": 1110, "y": 520, "wires": [ [ "73c1bfdc.90377" ], [], [] ] }, { "id": "578e043d.b5ec7c", "type": "change", "z": "9e1c0edb.e6d2d", "name": "Licht ist noch an", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "Licht", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1210, "y": 420, "wires": [ [ "2a8c6e8e.0e48d2" ] ] } ]
-
@nousefor82 Der Bewegungsmelder sendet doch von sich aus in occupancy ein "false" wenn keine Bewegung mehr erkannt wird und verlängert das true, wenn innerhalb einer Zeitspanne erkannt wird.
Diese Zeitspanne setzt Du mit der occupancy_timeout.
Und wie @frankyboy73 richtig gesagt hat vorher mit einem switch filtern. Ich weiß halt nicht, wie Dein BWM angeschlossen ist, jedenfalls nicht über den zigbee Adapter, sonst hättest Du hier bereits getrennte Datenpunkte. Nichtsdestotrotz solltest Du auch den occumpancy_timeout Parameter konfigurieren können.
Diesen Parameter occupancy_timeout kann man auch on-fly-nutzen, um zum Beispiel die Abwesenheitserkennung in Abhängigkeit von anderen Faktoren zu steuern. So kann man z. Bsp. über das Schalten von bestimmten Lichtern eine noch feinere Abstimmung hinbekommen.