NEWS
2 Bewegungsmelder sollen 2 Lampen bei Dunkelheit schalten
-
Hallo,
ich versuche mich gerade an einen Flow zum schalten von zwei Lampen bei Dunkelheit.
Voraussetzung soll sein: Jemand ist Anwesend, es ist Dunkelheit und die Lampen wurden nicht manuell angeschaltet. Damit soll verhindert werden, dass die angeschalteten Lampen sich bei Bewegung nach dem Timeout wieder ausschalten.
Mir fehlt hier der Status der brennenden Lampen als Schalter.
Mit welchem Node kann ich den Status der Lampe an die weiteren Schritte durchreichen?Anbei mein Versuch:
[ { "id": "e87ae8e06d8cc056", "type": "ioBroker in", "z": "8d1a4520777a57aa", "name": "BWM_WZ_Nord", "attrname": "", "topic": "alias.0.Bewegungsmelder.Bewegungsmelder_Wohnzimmer_Nord", "payloadType": "value", "onlyack": "", "func": "all", "gap": "", "fireOnStart": "false", "outFormat": "MQTT", "x": 160, "y": 340, "wires": [ [ "eb229fdc9914efbf" ] ] }, { "id": "52e69f23c18fecb2", "type": "ioBroker in", "z": "8d1a4520777a57aa", "name": "BWM_WZ_Sued", "attrname": "", "topic": "alias.0.Bewegungsmelder.Bewegungsmelder_Wohnzimmer_Sued", "payloadType": "value", "onlyack": "", "func": "all", "gap": "", "fireOnStart": "false", "outFormat": "MQTT", "x": 160, "y": 400, "wires": [ [ "eb229fdc9914efbf" ] ] }, { "id": "eb229fdc9914efbf", "type": "ioBroker get", "z": "8d1a4520777a57aa", "name": "Anwesenheit", "topic": "0_userdata.0.Anwesenheit.Anwesenheit", "attrname": "switch", "payloadType": "value", "errOnInvalidState": "nothing", "x": 350, "y": 360, "wires": [ [ "1986d79e7800587c" ] ] }, { "id": "1986d79e7800587c", "type": "switch", "z": "8d1a4520777a57aa", "name": "Schalter = true?", "property": "switch", "propertyType": "msg", "rules": [ { "t": "true" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 540, "y": 360, "wires": [ [ "ef414c2695dc4131" ] ] }, { "id": "ef414c2695dc4131", "type": "light-scheduler-filter", "z": "8d1a4520777a57aa", "settings": "4e6feb37aae55ba5", "events": "[{\"start\":{\"dow\":1,\"mod\":0},\"end\":{\"dow\":1,\"mod\":540}},{\"start\":{\"dow\":2,\"mod\":0},\"end\":{\"dow\":2,\"mod\":540}},{\"start\":{\"dow\":3,\"mod\":0},\"end\":{\"dow\":3,\"mod\":540}},{\"start\":{\"dow\":4,\"mod\":0},\"end\":{\"dow\":4,\"mod\":540}},{\"start\":{\"dow\":5,\"mod\":0},\"end\":{\"dow\":5,\"mod\":540}},{\"start\":{\"dow\":6,\"mod\":0},\"end\":{\"dow\":6,\"mod\":540}},{\"start\":{\"dow\":0,\"mod\":0},\"end\":{\"dow\":0,\"mod\":540}},{\"start\":{\"dow\":1,\"mod\":960},\"end\":{\"dow\":2,\"mod\":0}},{\"start\":{\"dow\":2,\"mod\":960},\"end\":{\"dow\":3,\"mod\":0}},{\"start\":{\"dow\":3,\"mod\":960},\"end\":{\"dow\":4,\"mod\":0}},{\"start\":{\"dow\":4,\"mod\":960},\"end\":{\"dow\":5,\"mod\":0}},{\"start\":{\"dow\":5,\"mod\":960},\"end\":{\"dow\":6,\"mod\":0}},{\"start\":{\"dow\":6,\"mod\":960},\"end\":{\"dow\":0,\"mod\":0}},{\"start\":{\"dow\":0,\"mod\":960},\"end\":{\"dow\":1,\"mod\":0}}]", "name": "Wenn Dunkel", "onlyWhenDark": true, "scheduleRndMax": 0, "sunElevationThreshold": "0", "sunShowElevationInStatus": true, "x": 370, "y": 440, "wires": [ [ "e4a4a09770bf0d02" ], [ "1eb3035289bf8b2a" ] ] }, { "id": "e4a4a09770bf0d02", "type": "trigger", "z": "8d1a4520777a57aa", "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": 590, "y": 420, "wires": [ [ "19bf0e52758e70ba", "a9364262c187ceb8" ] ] }, { "id": "1eb3035289bf8b2a", "type": "change", "z": "8d1a4520777a57aa", "name": "setze false", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 590, "y": 480, "wires": [ [ "19bf0e52758e70ba", "a9364262c187ceb8" ] ] }, { "id": "19bf0e52758e70ba", "type": "ioBroker out", "z": "8d1a4520777a57aa", "name": "WZ_Tischlampe", "topic": "alias.0.Licht.Wohnzimmer_Tischlampe", "ack": "false", "autoCreate": "false", "stateName": "", "role": "", "payloadType": "", "readonly": "", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 820, "y": 420, "wires": [] }, { "id": "a9364262c187ceb8", "type": "ioBroker out", "z": "8d1a4520777a57aa", "name": "WZ_Schreibtischlampe", "topic": "alias.0.Licht.Wohnzimmer_Schreibtischlampe", "ack": "false", "autoCreate": "false", "stateName": "", "role": "", "payloadType": "", "readonly": "", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 850, "y": 480, "wires": [] }, { "id": "4e6feb37aae55ba5", "type": "light-scheduler-settings", "name": "Bergfelde", "latitude": "52.67027760", "longitude": "13.31318640" } ]
-
Nun mit der Anwesenheit hast Du aber keinen Schalter importiert. Da die Anwesenheit öfter gebraucht wird, würde ich diese in einem globalen Kontext speichern - dann hast Du den Status bei all Deinen Flows immer parat. Dann ist die Frage, wie erkennst Du, dass ein Schalter manuell betätigt wurde - ich würde diesen Status dann auch lieber zumindest in einer Flowvariablen speichern. Ich mach mal einen Vorschlag.
Den Inhalt der Variablen - kannst Du Dir im Kontexttab anschauen:
Ansonsten musst Du Dir halt das manuelle Schalten für das Aktivieren der Lichtautomatik die Inject Nodes gegen die entsprechenden Datenpunkte ersetzen:
-
@mickym
Ich habe den Flow mal angepasst. Ich setze die Lichtautomatik aus einen Datenpunkt
"0_userdata.0.Beleuchtung.Befehle.WZ_Licht_schalten".Die Bewegungsmelder sollen das Licht nur schalten, wenn dieser DP == false ist (das ist eigentlich eine Sperre).
Hier der Flow:
[ { "id": "f0c0e6d8c6532709", "type": "ioBroker in", "z": "ab2df974e10e2d2f", "name": "BWM_WZ_Nord", "attrname": "", "topic": "alias.0.Bewegungsmelder.Bewegungsmelder_Wohnzimmer_Nord", "payloadType": "value", "onlyack": "", "func": "all", "gap": "", "fireOnStart": "false", "outFormat": "MQTT", "x": 100, "y": 320, "wires": [ [ "6a56ffd2abd0d61c" ] ] }, { "id": "7057f4f55c44be29", "type": "ioBroker in", "z": "ab2df974e10e2d2f", "name": "BWM_WZ_Sued", "attrname": "", "topic": "alias.0.Bewegungsmelder.Bewegungsmelder_Wohnzimmer_Sued", "payloadType": "value", "onlyack": "", "func": "all", "gap": "", "fireOnStart": "false", "outFormat": "MQTT", "x": 100, "y": 360, "wires": [ [ "6a56ffd2abd0d61c" ] ] }, { "id": "6a56ffd2abd0d61c", "type": "switch", "z": "ab2df974e10e2d2f", "name": "Anwesend?", "property": "anwesend", "propertyType": "global", "rules": [ { "t": "true" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 310, "y": 340, "wires": [ [ "c4bc5c697c907711" ] ] }, { "id": "9d2a7b8cf34aef9c", "type": "light-scheduler-filter", "z": "ab2df974e10e2d2f", "settings": "4e6feb37aae55ba5", "events": "[{\"start\":{\"dow\":1,\"mod\":0},\"end\":{\"dow\":1,\"mod\":540}},{\"start\":{\"dow\":2,\"mod\":0},\"end\":{\"dow\":2,\"mod\":540}},{\"start\":{\"dow\":3,\"mod\":0},\"end\":{\"dow\":3,\"mod\":540}},{\"start\":{\"dow\":4,\"mod\":0},\"end\":{\"dow\":4,\"mod\":540}},{\"start\":{\"dow\":5,\"mod\":0},\"end\":{\"dow\":5,\"mod\":540}},{\"start\":{\"dow\":6,\"mod\":0},\"end\":{\"dow\":6,\"mod\":540}},{\"start\":{\"dow\":0,\"mod\":0},\"end\":{\"dow\":0,\"mod\":540}},{\"start\":{\"dow\":1,\"mod\":960},\"end\":{\"dow\":2,\"mod\":0}},{\"start\":{\"dow\":2,\"mod\":960},\"end\":{\"dow\":3,\"mod\":0}},{\"start\":{\"dow\":3,\"mod\":960},\"end\":{\"dow\":4,\"mod\":0}},{\"start\":{\"dow\":4,\"mod\":960},\"end\":{\"dow\":5,\"mod\":0}},{\"start\":{\"dow\":5,\"mod\":960},\"end\":{\"dow\":6,\"mod\":0}},{\"start\":{\"dow\":6,\"mod\":960},\"end\":{\"dow\":0,\"mod\":0}},{\"start\":{\"dow\":0,\"mod\":960},\"end\":{\"dow\":1,\"mod\":0}}]", "name": "Wenn Dunkel", "onlyWhenDark": true, "scheduleRndMax": 0, "sunElevationThreshold": "0", "sunShowElevationInStatus": true, "x": 700, "y": 340, "wires": [ [ "3b38965ed2c58064" ], [ "0428cc37965a2746" ] ] }, { "id": "3b38965ed2c58064", "type": "trigger", "z": "ab2df974e10e2d2f", "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": 890, "y": 320, "wires": [ [ "a5bc6995e36b224d", "5203279c8f741e8b" ] ] }, { "id": "0428cc37965a2746", "type": "change", "z": "ab2df974e10e2d2f", "name": "setze false", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 890, "y": 360, "wires": [ [ "a5bc6995e36b224d", "5203279c8f741e8b" ] ] }, { "id": "a5bc6995e36b224d", "type": "ioBroker out", "z": "ab2df974e10e2d2f", "name": "WZ_Tischlampe", "topic": "alias.0.Licht.Wohnzimmer_Tischlampe", "ack": "false", "autoCreate": "false", "stateName": "", "role": "", "payloadType": "", "readonly": "", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 1140, "y": 320, "wires": [] }, { "id": "5203279c8f741e8b", "type": "ioBroker out", "z": "ab2df974e10e2d2f", "name": "WZ_Schreibtischlampe", "topic": "alias.0.Licht.Wohnzimmer_Schreibtischlampe", "ack": "false", "autoCreate": "false", "stateName": "", "role": "", "payloadType": "", "readonly": "", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 1170, "y": 360, "wires": [] }, { "id": "988870c28837a321", "type": "ioBroker in", "z": "ab2df974e10e2d2f", "name": "", "attrname": "payload", "topic": "0_userdata.0.Anwesenheit.Anwesenheit", "payloadType": "value", "onlyack": "", "func": "all", "gap": "", "fireOnStart": "true", "outFormat": "MQTT", "x": 170, "y": 100, "wires": [ [ "8cf01a470e1adc89" ] ] }, { "id": "8cf01a470e1adc89", "type": "change", "z": "ab2df974e10e2d2f", "name": "Anwesenheit", "rules": [ { "t": "set", "p": "anwesend", "pt": "global", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 450, "y": 100, "wires": [ [] ] }, { "id": "356b58827ce791f4", "type": "change", "z": "ab2df974e10e2d2f", "name": "", "rules": [ { "t": "set", "p": "Lichtautomatik", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 570, "y": 220, "wires": [ [ "28f470db7644d702" ] ] }, { "id": "04353c692a6b2e99", "type": "inject", "z": "ab2df974e10e2d2f", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "true", "payloadType": "bool", "x": 130, "y": 180, "wires": [ [ "356b58827ce791f4" ] ] }, { "id": "658302b2fd63ce3b", "type": "inject", "z": "ab2df974e10e2d2f", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "false", "payloadType": "bool", "x": 130, "y": 220, "wires": [ [ "356b58827ce791f4" ] ] }, { "id": "c4bc5c697c907711", "type": "switch", "z": "ab2df974e10e2d2f", "name": "Lichtautomatik ?", "property": "Lichtautomatik", "propertyType": "flow", "rules": [ { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 500, "y": 340, "wires": [ [ "9d2a7b8cf34aef9c" ] ] }, { "id": "2a81b19b40354cbf", "type": "inject", "z": "ab2df974e10e2d2f", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "true", "payloadType": "bool", "x": 290, "y": 40, "wires": [ [ "8cf01a470e1adc89" ] ] }, { "id": "efe692bb55b719c2", "type": "ioBroker in", "z": "ab2df974e10e2d2f", "name": "", "attrname": "payload", "topic": "0_userdata.0.Beleuchtung.Befehle.WZ_Licht_schalten", "payloadType": "value", "onlyack": "", "func": "all", "gap": "", "fireOnStart": "true", "outFormat": "MQTT", "x": 220, "y": 260, "wires": [ [ "356b58827ce791f4" ] ] }, { "id": "28f470db7644d702", "type": "debug", "z": "ab2df974e10e2d2f", "name": "debug 1", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 640, "y": 160, "wires": [] }, { "id": "4e6feb37aae55ba5", "type": "light-scheduler-settings", "name": "Bergfelde", "latitude": "52.67027760", "longitude": "13.31318640" } ]
-
@martybr Du kannst den Status der Lichtautomatik über eine get-Node in den Flow holen - oder meinen Flow nutzen - der den Status des Datenpunktes in einer Flowvariablen speichert.
-
@mickym
Das war mir der falsche Screen untergerutscht:
Das sollte nun richtig sein.
Eine Frage noch:
Kann ich die Globale Deklaration auf eine eigene Karteikarte schieben oder muss sie auf der Karteikarte verbleiben, wo sie ausgewertet wird? -
@martybr Globalen Kontext kannst Du überall setzen und ist für alle Flows wirksam. Flowvariablen nur für den Flow, indem sie definiert sind und Nodevariablen nur für die entsprechende function Node, inder diese definiert sind. Alle 3 Klassen kannst Du im Kontexttab sehen.
-
@martybr Die Inject Nodes kannst Du wieder weg machen, wenn Du nichts mehr simulieren musst. Ich brauche die, da ich ja die originalen Datenpunkte bzw. Geräte nicht habe.
-
@mickym
Alles klar. Danke noch mal für die schnelle und kompetente Hilfe.