In this guide we will go through how to setup a custom flow for motion as displayed above.
The source code will be available at the bottom of this document.
Start with importing the flow. If you dont know how to import a flow you can check out this guide: [Guide will come]
This flow have a trigger for motion, conditions for which mode the household is in, and then filters if the trigger node sent a message that there is detected motion or not, and different action based on the filtering.
The timer for turning off the lights is not started before the sensor sends
a message that there is not detected any motion anymore. This varies from
product to product: A Fibaro motion sensor sends after 30 seconds of no
motion, and a Aeotec MS6 (battery) will send after 4 minutes.
The setup necessary to get this flow working in your household is changing the sensor's and lights' addresses.
Start off with clicking into the trigger node. Under Advanced service binding
you can change to the address of your motion sensor.
If you have multiple motion sensors in a room you can use the clone button on the popup window, then move the cloned node, connect wires from the new node's green dot to the blue dot of the if home
node. This newly cloned node will have the same address as before the node was cloned, and needs to be changed for the other motion sensor.
The same goes for the action nodes. In this scenario there is 4 action nodes, and all of them needs to be changed to the right address of the light.
If you have multiple lights in a room you can use the clone button on the popup window, then move the cloned node, connect wires from last node's green dot to the new node's blue dot. This newly cloned node will have the same address as before the node was cloned, and needs to be changed for the other light zone.
This flow is setup to turn on the light at last known value in home mode. But is of course customizable if you want other settings. In sleep mode there is an option to set a specific dimmer level. Click on the action node after "If presence = true" in Sleep mode. Under the section Payload configuration
you can type the dimmer level.
Tips; change the name of the flow so it's easier to find the flow if you want to customize it later.
When everything is setup remember to click the Save
button in the lower left corner.
If saved successfully this message Flow is saved
message will appear on the bottom.
-
Source code
{ "Id": "Nqo6aLFaaFoKgW7", "ClassId": "B4sjTgAvS5zhq6C", "Author": "espenh.no", "Version": 0, "CreatedAt": "2020-08-01T11:08:13.558902118+02:00", "UpdatedAt": "2020-08-01T11:34:07.119965608+02:00", "Name": "sensor_presence automations", "Group": "sensor_presence", "Description": "", "Nodes": [ { "Id": "1", "Type": "trigger", "Label": "sensor_presence", "SuccessTransition": "8", "TimeoutTransition": "", "ErrorTransition": "", "Address": "pt:j1/mt:evt/rt:dev/rn:zw/ad:1/sv:sensor_presence/ad:49_0", "Service": "sensor_presence", "ServiceInterface": "evt.presence.report", "Config": { "InputVariableType": "", "IsValueFilterEnabled": false, "LookupServiceNameAndLocation": false, "PropFilterName": "", "PropFilterValue": "", "RegisterAsVirtualService": false, "Timeout": 0, "ValueFilter": { "Value": true, "ValueType": "" }, "ValueJPath": "", "ValueJPathResultType": "", "VirtualServiceGroup": "", "VirtualServiceProps": null }, "Ui": { "nodeType": "", "x": 454, "y": 112 } }, { "Id": "2", "Type": "action", "Label": "out_lvl_switch ON (Last known value)", "SuccessTransition": "", "TimeoutTransition": "", "ErrorTransition": "", "Address": "pt:j1/mt:cmd/rt:dev/rn:zw/ad:1/sv:out_lvl_switch/ad:32_1", "Service": "out_lvl_switch", "ServiceInterface": "cmd.binary.set", "Config": { "DefaultValue": { "Value": true, "ValueType": "bool" }, "IsVariableGlobal": false, "Props": {}, "RegisterAsVirtualService": false, "ResponseToTopic": "", "VariableName": "", "VirtualServiceGroup": "", "VirtualServiceProps": {} }, "Ui": { "nodeType": "", "x": 58, "y": 731 } }, { "Id": "4", "Type": "wait", "Label": "wait 10 min", "SuccessTransition": "5", "TimeoutTransition": "", "ErrorTransition": "", "Address": "", "Service": "", "ServiceInterface": "", "Config": 600000, "Ui": { "nodeType": "", "x": 343, "y": 716 } }, { "Id": "5", "Type": "action", "Label": "out_lvl_switch OFF", "SuccessTransition": "", "TimeoutTransition": "", "ErrorTransition": "", "Address": "pt:j1/mt:cmd/rt:dev/rn:zw/ad:1/sv:out_lvl_switch/ad:32_1", "Service": "out_lvl_switch", "ServiceInterface": "cmd.binary.set", "Config": { "DefaultValue": { "Value": false, "ValueType": "bool" }, "IsVariableGlobal": false, "Props": {}, "RegisterAsVirtualService": false, "ResponseToTopic": "", "VariableName": "", "VirtualServiceGroup": "", "VirtualServiceProps": {} }, "Ui": { "nodeType": "", "x": 340, "y": 871 } }, { "Id": "6", "Type": "if", "Label": "if presence = true", "SuccessTransition": "", "TimeoutTransition": "", "ErrorTransition": "", "Address": "", "Service": "", "ServiceInterface": "", "Config": { "Expression": [ { "BooleanOperator": "", "LeftVariableIsGlobal": false, "LeftVariableName": "", "Operand": "eq", "RightVariable": { "Value": true, "ValueType": "bool" } } ], "FalseTransition": "7", "TrueTransition": "2" }, "Ui": { "nodeType": "", "x": 73, "y": 554 } }, { "Id": "7", "Type": "if", "Label": "if presence = false", "SuccessTransition": "", "TimeoutTransition": "", "ErrorTransition": "", "Address": "", "Service": "", "ServiceInterface": "", "Config": { "Expression": [ { "BooleanOperator": "", "LeftVariableIsGlobal": false, "LeftVariableName": "", "Operand": "eq", "RightVariable": { "Value": false, "ValueType": "bool" } } ], "FalseTransition": "", "TrueTransition": "4" }, "Ui": { "nodeType": "", "x": 342, "y": 552 } }, { "Id": "8", "Type": "if", "Label": "if home", "SuccessTransition": "", "TimeoutTransition": "", "ErrorTransition": "", "Address": "", "Service": "", "ServiceInterface": "", "Config": { "Expression": [ { "BooleanOperator": "", "LeftVariableIsGlobal": true, "LeftVariableName": "fh.home.mode", "Operand": "eq", "RightVariable": { "Value": "home", "ValueType": "string" } } ], "FalseTransition": "9", "TrueTransition": "6" }, "Ui": { "nodeType": "", "x": 220, "y": 316 } }, { "Id": "9", "Type": "if", "Label": "if sleep", "SuccessTransition": "", "TimeoutTransition": "", "ErrorTransition": "", "Address": "", "Service": "", "ServiceInterface": "", "Config": { "Expression": [ { "BooleanOperator": "", "LeftVariableIsGlobal": true, "LeftVariableName": "fh.home.mode", "Operand": "eq", "RightVariable": { "Value": "sleep", "ValueType": "string" } } ], "FalseTransition": "", "TrueTransition": "10" }, "Ui": { "nodeType": "", "x": 697, "y": 329 } }, { "Id": "10", "Type": "if", "Label": "if presence = true", "SuccessTransition": "", "TimeoutTransition": "", "ErrorTransition": "", "Address": "", "Service": "", "ServiceInterface": "", "Config": { "Expression": [ { "BooleanOperator": "", "LeftVariableIsGlobal": false, "LeftVariableName": "", "Operand": "eq", "RightVariable": { "Value": true, "ValueType": "bool" } } ], "FalseTransition": "13", "TrueTransition": "12" }, "Ui": { "nodeType": "", "x": 616, "y": 551 } }, { "Id": "12", "Type": "action", "Label": "out_lvl_switch cmd.lvl.set 10%", "SuccessTransition": "", "TimeoutTransition": "", "ErrorTransition": "", "Address": "pt:j1/mt:cmd/rt:dev/rn:zw/ad:1/sv:out_lvl_switch/ad:32_1", "Service": "out_lvl_switch", "ServiceInterface": "cmd.lvl.set", "Config": { "DefaultValue": { "Value": 10, "ValueType": "int" }, "IsVariableGlobal": false, "Props": {}, "RegisterAsVirtualService": false, "ResponseToTopic": "", "VariableName": "", "VirtualServiceGroup": "", "VirtualServiceProps": {} }, "Ui": { "nodeType": "", "x": 613, "y": 719 } }, { "Id": "13", "Type": "if", "Label": "if presence = false", "SuccessTransition": "", "TimeoutTransition": "", "ErrorTransition": "", "Address": "", "Service": "", "ServiceInterface": "", "Config": { "Expression": [ { "BooleanOperator": "", "LeftVariableIsGlobal": false, "LeftVariableName": "", "Operand": "eq", "RightVariable": { "Value": false, "ValueType": "bool" } } ], "FalseTransition": "", "TrueTransition": "14" }, "Ui": { "nodeType": "", "x": 860, "y": 556 } }, { "Id": "14", "Type": "wait", "Label": "wait 2 min", "SuccessTransition": "15", "TimeoutTransition": "", "ErrorTransition": "", "Address": "", "Service": "", "ServiceInterface": "", "Config": 120000, "Ui": { "nodeType": "", "x": 857, "y": 721 } }, { "Id": "15", "Type": "action", "Label": "out_lvl_switch OFF", "SuccessTransition": "", "TimeoutTransition": "", "ErrorTransition": "", "Address": "pt:j1/mt:cmd/rt:dev/rn:zw/ad:1/sv:out_lvl_switch/ad:32_1", "Service": "out_lvl_switch", "ServiceInterface": "cmd.binary.set", "Config": { "DefaultValue": { "Value": false, "ValueType": "bool" }, "IsVariableGlobal": false, "Props": {}, "RegisterAsVirtualService": false, "ResponseToTopic": "", "VariableName": "", "VirtualServiceGroup": "", "VirtualServiceProps": {} }, "Ui": { "nodeType": "", "x": 862, "y": 890 } } ], "Settings": null, "IsDisabled": false, "IsDefault": false, "ParallelExecution": "keep_last" }
Comments
0 comments
Please sign in to leave a comment.