NEWS
Anwesenheitssimulation
-
Hallo Leute,
ich versuche soeben eine Anwesenheitssimulation mit NR zu realisieren. (Flow Anbei)Es wird überprüft ob mein/unser Handy auf der FB angemeldet sind und da hab ich dann ein true oder false zur Weiterverarbeitung. Die Anwesenheitssimulation soll auch nur von Sonnenuntergang bis 22:30 laufen.
Das Problem ist nur das ich einen Inject habe der alle Minuten ein true oder eben false sendet. Ich brauche das false jedoch nur einmal das wenn ich nach Hause komme die Simulation beendet wird und die Lichter ausgehen. Wenn jetzt dann trotzdem alle Minuten false auf die KNX Gruppenadressen gesendet wird schalten sich die Lichter alle Minuten aus. (Deshalb nur einmal false)
Wie könnte ich das besser Lösen als mit einer Filter Node?
Vlt hat jemand eine gute Idee für mich oder einen funktionierenden Flow?Lg
HP[ { "id": "cac9c01f3689eab9", "type": "tab", "label": "Flow 2", "disabled": false, "info": "", "env": [] }, { "id": "ffb8421f37229010", "type": "change", "z": "cac9c01f3689eab9", "name": "Licht ein", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 760, "y": 440, "wires": [ [ "0897f559d6f18d11", "adedd7a0a75c1729", "50d45a0118aebda2", "2c679b6eb2368dc9", "4bce95daedada66f", "a149cf552dc5ee3e" ] ] }, { "id": "b519da1e87c4d291", "type": "within-time-switch", "z": "cac9c01f3689eab9", "name": "", "nameInt": "", "positionConfig": "d836509a.67bc4", "startTime": "sunsetEnd", "startTimeType": "pdsTime", "startOffset": "-10", "startOffsetType": "num", "startOffsetMultiplier": 60000, "endTime": "22:30", "endTimeType": "entered", "endOffset": 0, "endOffsetType": "none", "endOffsetMultiplier": 60000, "timeRestrictions": 0, "timeRestrictionsType": "none", "timeDays": "*", "timeOnlyOddDays": false, "timeOnlyEvenDays": false, "timeOnlyOddWeeks": false, "timeOnlyEvenWeeks": false, "timeMonths": "*", "timedatestart": "", "timedateend": "", "propertyStart": "", "propertyStartType": "none", "propertyStartCompare": "true", "propertyStartThreshold": "", "propertyStartThresholdType": "num", "startTimeAlt": "", "startTimeAltType": "entered", "startOffsetAlt": 0, "startOffsetAltType": "none", "startOffsetAltMultiplier": 60000, "propertyEnd": "", "propertyEndType": "none", "propertyEndCompare": "true", "propertyEndThreshold": "", "propertyEndThresholdType": "num", "endTimeAlt": "", "endTimeAltType": "entered", "endOffsetAlt": 0, "endOffsetAltType": "none", "endOffsetAltMultiplier": 60000, "withinTimeValue": "true", "withinTimeValueType": "msgInput", "outOfTimeValue": "false", "outOfTimeValueType": "msgInput", "tsCompare": "0", "x": 540, "y": 440, "wires": [ [ "ffb8421f37229010" ], [] ] }, { "id": "0897f559d6f18d11", "type": "presence-faker", "z": "cac9c01f3689eab9", "name": "Licht 2", "onPayload": "true", "onPayloadType": "bool", "onTopic": "Licht ein", "offPayload": "false", "offPayloadType": "bool", "offTopic": "Licht aus", "windowBegin": "16:00", "windowEnd": "22:45", "minDurationHours": 0, "minDurationMinutes": "2", "minDurationSeconds": "10", "minDuration": "130", "maxDurationHours": "0", "maxDurationMinutes": "20", "maxDurationSeconds": "35", "maxDuration": "1235", "minCount": "3", "maxCount": "15", "startupBehavior": "onMsg", "actionOnDisable": "off", "firstBlockType": "off", "lastBlockType": "off", "isLoggingEnabled": false, "x": 1210, "y": 440, "wires": [ [ "c4ef22776a9aa592" ] ] }, { "id": "adedd7a0a75c1729", "type": "presence-faker", "z": "cac9c01f3689eab9", "name": "Licht 1", "onPayload": "true", "onPayloadType": "bool", "onTopic": "Licht ein", "offPayload": "false", "offPayloadType": "bool", "offTopic": "Licht aus", "windowBegin": "16:00", "windowEnd": "22:45", "minDurationHours": 0, "minDurationMinutes": "2", "minDurationSeconds": "10", "minDuration": "130", "maxDurationHours": "0", "maxDurationMinutes": "20", "maxDurationSeconds": "35", "maxDuration": "1235", "minCount": "3", "maxCount": "15", "startupBehavior": "onMsg", "actionOnDisable": "off", "firstBlockType": "off", "lastBlockType": "off", "isLoggingEnabled": false, "x": 1210, "y": 380, "wires": [ [ "c4ef22776a9aa592" ] ] }, { "id": "2c679b6eb2368dc9", "type": "presence-faker", "z": "cac9c01f3689eab9", "name": "Licht 4", "onPayload": "true", "onPayloadType": "bool", "onTopic": "Licht ein", "offPayload": "false", "offPayloadType": "bool", "offTopic": "Licht aus", "windowBegin": "16:00", "windowEnd": "22:45", "minDurationHours": 0, "minDurationMinutes": "2", "minDurationSeconds": "10", "minDuration": "130", "maxDurationHours": "0", "maxDurationMinutes": "20", "maxDurationSeconds": "35", "maxDuration": "1235", "minCount": "3", "maxCount": "15", "startupBehavior": "onMsg", "actionOnDisable": "off", "firstBlockType": "off", "lastBlockType": "off", "isLoggingEnabled": false, "x": 1210, "y": 560, "wires": [ [ "c4ef22776a9aa592" ] ] }, { "id": "50d45a0118aebda2", "type": "presence-faker", "z": "cac9c01f3689eab9", "name": "Licht 3", "onPayload": "true", "onPayloadType": "bool", "onTopic": "Licht ein", "offPayload": "false", "offPayloadType": "bool", "offTopic": "Licht aus", "windowBegin": "16:00", "windowEnd": "22:45", "minDurationHours": 0, "minDurationMinutes": "2", "minDurationSeconds": "10", "minDuration": "130", "maxDurationHours": "0", "maxDurationMinutes": "20", "maxDurationSeconds": "35", "maxDuration": "1235", "minCount": "3", "maxCount": "15", "startupBehavior": "onMsg", "actionOnDisable": "off", "firstBlockType": "off", "lastBlockType": "off", "isLoggingEnabled": false, "x": 1210, "y": 500, "wires": [ [ "c4ef22776a9aa592" ] ] }, { "id": "4bce95daedada66f", "type": "presence-faker", "z": "cac9c01f3689eab9", "name": "Licht 5", "onPayload": "true", "onPayloadType": "bool", "onTopic": "Licht ein", "offPayload": "false", "offPayloadType": "bool", "offTopic": "Licht aus", "windowBegin": "16:00", "windowEnd": "22:45", "minDurationHours": 0, "minDurationMinutes": "2", "minDurationSeconds": "10", "minDuration": "130", "maxDurationHours": "0", "maxDurationMinutes": "20", "maxDurationSeconds": "35", "maxDuration": "1235", "minCount": "3", "maxCount": "15", "startupBehavior": "onMsg", "actionOnDisable": "off", "firstBlockType": "off", "lastBlockType": "off", "isLoggingEnabled": false, "x": 1210, "y": 620, "wires": [ [ "c4ef22776a9aa592" ] ] }, { "id": "899a41c8b1b0a18d", "type": "switch", "z": "cac9c01f3689eab9", "name": "", "property": "payload", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 310, "y": 500, "wires": [ [ "b519da1e87c4d291" ], [ "02612007a11aeb92" ] ] }, { "id": "ddba37ee2c1c7e0f", "type": "inject", "z": "cac9c01f3689eab9", "name": "", "props": [ { "p": "payload" } ], "repeat": "5", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "true", "payloadType": "bool", "x": 150, "y": 440, "wires": [ [ "899a41c8b1b0a18d" ] ] }, { "id": "3e61d7a70545fa48", "type": "change", "z": "cac9c01f3689eab9", "name": "Licht aus", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 740, "y": 600, "wires": [ [ "4bce95daedada66f", "2c679b6eb2368dc9", "50d45a0118aebda2", "0897f559d6f18d11", "adedd7a0a75c1729" ] ] }, { "id": "02612007a11aeb92", "type": "rbe", "z": "cac9c01f3689eab9", "name": "", "func": "rbe", "gap": "", "start": "", "inout": "out", "septopics": true, "property": "payload", "topi": "topic", "x": 550, "y": 600, "wires": [ [ "3e61d7a70545fa48" ] ] }, { "id": "a149cf552dc5ee3e", "type": "change", "z": "cac9c01f3689eab9", "name": "filter reset", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "reset", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 560, "y": 540, "wires": [ [ "02612007a11aeb92", "7460d3fd2b45bfb5" ] ] }, { "id": "7460d3fd2b45bfb5", "type": "debug", "z": "cac9c01f3689eab9", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 750, "y": 540, "wires": [] }, { "id": "9bf427852e2c9dc8", "type": "inject", "z": "cac9c01f3689eab9", "name": "", "props": [ { "p": "payload" } ], "repeat": "5", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "false", "payloadType": "bool", "x": 150, "y": 560, "wires": [ [ "899a41c8b1b0a18d" ] ] }, { "id": "c4ef22776a9aa592", "type": "debug", "z": "cac9c01f3689eab9", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 1450, "y": 500, "wires": [] }, { "id": "d836509a.67bc4", "type": "position-config", "name": "Johnsdorf/Brunn", "isValide": "true", "longitude": "0", "latitude": "0", "angleType": "deg", "timeZoneOffset": "99", "timeZoneDST": "0", "stateTimeFormat": "3", "stateDateFormat": "3", "contextStore": "" } ]
-
@hpgo Solange Du pollst kannst Du es nicht anders als über die Filter-Node lösen. Soweit ich weiß pollen alle Nodes oder auch iobroker Adapter und Du musst alles wegfiltern, was identisch ist. Im Prinzip kann man den Filter auch gleich zu Anfang machen, weil ja auch true zum Einschalten nur einmal erfolgen muss.
-
Ok danke, dann geht es also eh nicht anders.
Danke! -
@hpgo Hi, wie bekommst du denn den Status, ob dein Handy angemeldet ist oder nicht in den Flow rein? Und wo zu das Minütliche triggern von true und false?
Die change Node für den Reset sollte übrigens so aussehen, die msg muss reset heißen und nicht payload. Im Prinzip könnte deine Version sogar funktionieren, weil du ja das payload änderst und die Nachricht dadurch geändert wird, aber damit triggerst du auch gleich wieder deine Change Licht aus und schaltest dadurch aus.
Leider habe ich die Nodes die du verwendest nicht alle, was ist denn dieser time-switch bzw. wie heißt die Node genau?Edit: Hi, habe den Node Inhalt noch mal geändert, du musst bei Reset auch das msg.payload löschen, sonst lässt die RBE das durch und du triggerst deine Change dahinter trotzdem.
Oder so, das sollte auch gehen:
-
@frankyboy73 sagte in Anwesenheitssimulation:
Leider habe ich die Nodes die du verwendest nicht alle, was ist denn dieser time-switch bzw. wie heißt die Node genau?
Ja das ist wieder mal so eine Node - die man eigentlich nicht braucht, aber liegt halt daran, dass die meisten nicht wissen, wie man eine switch NOde hier als Filter effizient einsetzt. Sprich, das man mit Hausmitteln auch einen validen Zeitraum bestimmen kann.
Im Prinzip machen diese time switches nichts anderes als das
-
@mickym Hi Micky, ich würde das mit dem Zeitraum ja mit einem function-node machen, habe mich aber bei Deinem Beispiel gefragt, wie das mit einem Switch-Node gehen soll. Inject liefert ja einen Timestamp. Wie bekomme ich dann im Function-Node eine tagesunabhängige Uhrzeit raus? Mit JSONata?
-
@kylo-ren JSONATA ist standardmässig nicht in function Nodes verfügbar - braucht man doch auch nicht. Gewöhnt euch doch das herkömmliche Programmieren ab - dann braucht man die Nodes nicht.
In einer function Node - kannst Du nur normales JS verwenden oder musst die Bibliotheken selbst einbinden. - Ich rate von Verwendung von function nodes wenn nicht unbedingt erforderlich ab. Meine Bereitschaft sich durch Spaghetti-Code in function Nodes zu quälen ist sehr niedrig.
Wenn Du mit einer Switch Node schon den Zeitraum geprüft hast, dann kannst Du es Dir je in Deinem Javascript sparen.
Die Inject Node ist nur zum Triggern da - und völlig unwichtig. Es wird nur geprüft, ob zum Zeitpunkt des Triggers, sich dieser innerhalb eines Zeitfenster befindet oder nicht: