Advertisement
dykandDK

HA - NR - Light Automation Examples

Oct 2nd, 2020 (edited)
1,091
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 13.65 KB | None | 0 0
  1. [
  2.     {
  3.         "id": "5f7364a8.b1069c",
  4.         "type": "tab",
  5.         "label": "Lights",
  6.         "disabled": false,
  7.         "info": "## Flow for automating lights\n**By Anders Lukic**\n\n---\n\nFlow for lights automation that:\n\n - Uses IKEA remote control to turn on/off or dim different lights\n -  Switches light on for 1 ½ minute when motion is detected in low light situations\n -  Uses sun position (elevation) to turn on/off lights"
  8.     },
  9.     {
  10.         "id": "3fa84325.374d2c",
  11.         "type": "server-events",
  12.         "z": "5f7364a8.b1069c",
  13.         "name": "Deconz events",
  14.         "server": "3bebce79.1e0962",
  15.         "event_type": "deconz_event",
  16.         "exposeToHomeAssistant": false,
  17.         "haConfig": [
  18.             {
  19.                 "property": "name",
  20.                 "value": ""
  21.             },
  22.             {
  23.                 "property": "icon",
  24.                 "value": ""
  25.             }
  26.         ],
  27.         "x": 100,
  28.         "y": 100,
  29.         "wires": [
  30.             [
  31.                 "71140b27.c62754"
  32.             ]
  33.         ]
  34.     },
  35.     {
  36.         "id": "b97223b3.98f69",
  37.         "type": "debug",
  38.         "z": "5f7364a8.b1069c",
  39.         "name": "",
  40.         "active": true,
  41.         "tosidebar": true,
  42.         "console": false,
  43.         "tostatus": false,
  44.         "complete": "false",
  45.         "statusVal": "",
  46.         "statusType": "auto",
  47.         "x": 490,
  48.         "y": 160,
  49.         "wires": []
  50.     },
  51.     {
  52.         "id": "a9d55c5e.7529b",
  53.         "type": "switch",
  54.         "z": "5f7364a8.b1069c",
  55.         "name": "Buttons",
  56.         "property": "payload.event.event",
  57.         "propertyType": "msg",
  58.         "rules": [
  59.             {
  60.                 "t": "eq",
  61.                 "v": "1002",
  62.                 "vt": "num"
  63.             },
  64.             {
  65.                 "t": "eq",
  66.                 "v": "2002",
  67.                 "vt": "num"
  68.             },
  69.             {
  70.                 "t": "eq",
  71.                 "v": "3002",
  72.                 "vt": "num"
  73.             },
  74.             {
  75.                 "t": "eq",
  76.                 "v": "4002",
  77.                 "vt": "num"
  78.             },
  79.             {
  80.                 "t": "eq",
  81.                 "v": "5002",
  82.                 "vt": "num"
  83.             }
  84.         ],
  85.         "checkall": "true",
  86.         "repair": false,
  87.         "outputs": 5,
  88.         "x": 480,
  89.         "y": 100,
  90.         "wires": [
  91.             [
  92.                 "64d7f2e9.7c32fc"
  93.             ],
  94.             [
  95.                 "7d208c88.4dabd4"
  96.             ],
  97.             [
  98.                 "5a12072e.c78bf8"
  99.             ],
  100.             [
  101.                 "9faf6b71.9c3748"
  102.             ],
  103.             [
  104.                 "9faf6b71.9c3748"
  105.             ]
  106.         ],
  107.         "outputLabels": [
  108.             "On off",
  109.             "Dim Up",
  110.             "Dim Down",
  111.             "Right",
  112.             "Left"
  113.         ]
  114.     },
  115.     {
  116.         "id": "64d7f2e9.7c32fc",
  117.         "type": "api-call-service",
  118.         "z": "5f7364a8.b1069c",
  119.         "name": "Toogle light 1",
  120.         "server": "3bebce79.1e0962",
  121.         "version": 1,
  122.         "debugenabled": false,
  123.         "service_domain": "light",
  124.         "service": "toggle",
  125.         "entityId": "light.stander_2_stue_paere_2",
  126.         "data": "",
  127.         "dataType": "json",
  128.         "mergecontext": "",
  129.         "output_location": "",
  130.         "output_location_type": "none",
  131.         "mustacheAltTags": false,
  132.         "x": 710,
  133.         "y": 40,
  134.         "wires": [
  135.             []
  136.         ]
  137.     },
  138.     {
  139.         "id": "5a12072e.c78bf8",
  140.         "type": "api-call-service",
  141.         "z": "5f7364a8.b1069c",
  142.         "name": "Dim light 1",
  143.         "server": "3bebce79.1e0962",
  144.         "version": 1,
  145.         "debugenabled": false,
  146.         "service_domain": "light",
  147.         "service": "turn_on",
  148.         "entityId": "light.stander_2_stue_paere_2",
  149.         "data": "{\"brightness_step_pct\":-10}",
  150.         "dataType": "json",
  151.         "mergecontext": "",
  152.         "output_location": "",
  153.         "output_location_type": "none",
  154.         "mustacheAltTags": false,
  155.         "x": 710,
  156.         "y": 120,
  157.         "wires": [
  158.             []
  159.         ]
  160.     },
  161.     {
  162.         "id": "7d208c88.4dabd4",
  163.         "type": "api-call-service",
  164.         "z": "5f7364a8.b1069c",
  165.         "name": "Dim Up Light 1",
  166.         "server": "3bebce79.1e0962",
  167.         "version": 1,
  168.         "debugenabled": false,
  169.         "service_domain": "light",
  170.         "service": "turn_on",
  171.         "entityId": "light.stander_2_stue_paere_2",
  172.         "data": "{\"brightness_step_pct\":10}",
  173.         "dataType": "json",
  174.         "mergecontext": "",
  175.         "output_location": "",
  176.         "output_location_type": "none",
  177.         "mustacheAltTags": false,
  178.         "x": 720,
  179.         "y": 80,
  180.         "wires": [
  181.             []
  182.         ]
  183.     },
  184.     {
  185.         "id": "9faf6b71.9c3748",
  186.         "type": "api-call-service",
  187.         "z": "5f7364a8.b1069c",
  188.         "name": "Toogle light",
  189.         "server": "3bebce79.1e0962",
  190.         "version": 1,
  191.         "debugenabled": false,
  192.         "service_domain": "switch",
  193.         "service": "toggle",
  194.         "entityId": "switch.on_off_plug_in_unit_4",
  195.         "data": "",
  196.         "dataType": "json",
  197.         "mergecontext": "",
  198.         "output_location": "",
  199.         "output_location_type": "none",
  200.         "mustacheAltTags": false,
  201.         "x": 710,
  202.         "y": 160,
  203.         "wires": [
  204.             []
  205.         ]
  206.     },
  207.     {
  208.         "id": "71140b27.c62754",
  209.         "type": "switch",
  210.         "z": "5f7364a8.b1069c",
  211.         "name": "IKEA Trådfri remote",
  212.         "property": "payload.event.id",
  213.         "propertyType": "msg",
  214.         "rules": [
  215.             {
  216.                 "t": "eq",
  217.                 "v": "tradfri_remote_control",
  218.                 "vt": "str"
  219.             }
  220.         ],
  221.         "checkall": "true",
  222.         "repair": false,
  223.         "outputs": 1,
  224.         "x": 290,
  225.         "y": 100,
  226.         "wires": [
  227.             [
  228.                 "a9d55c5e.7529b",
  229.                 "b97223b3.98f69"
  230.             ]
  231.         ]
  232.     },
  233.     {
  234.         "id": "58fafd6d.2ad9f4",
  235.         "type": "api-call-service",
  236.         "z": "5f7364a8.b1069c",
  237.         "name": "Turn lights on",
  238.         "server": "3bebce79.1e0962",
  239.         "version": 1,
  240.         "debugenabled": false,
  241.         "service_domain": "light",
  242.         "service": "turn_on",
  243.         "entityId": "light.bryggers",
  244.         "data": "",
  245.         "dataType": "json",
  246.         "mergecontext": "",
  247.         "output_location": "",
  248.         "output_location_type": "none",
  249.         "mustacheAltTags": false,
  250.         "x": 340,
  251.         "y": 240,
  252.         "wires": [
  253.             [
  254.                 "11d0104.7f1b1f"
  255.             ]
  256.         ]
  257.     },
  258.     {
  259.         "id": "10686073.fc9d5",
  260.         "type": "api-call-service",
  261.         "z": "5f7364a8.b1069c",
  262.         "name": "Turn lights off",
  263.         "server": "3bebce79.1e0962",
  264.         "version": 1,
  265.         "debugenabled": false,
  266.         "service_domain": "light",
  267.         "service": "turn_off",
  268.         "entityId": "light.bryggers",
  269.         "data": "",
  270.         "dataType": "json",
  271.         "mergecontext": "",
  272.         "output_location": "",
  273.         "output_location_type": "none",
  274.         "mustacheAltTags": false,
  275.         "x": 680,
  276.         "y": 240,
  277.         "wires": [
  278.             []
  279.         ]
  280.     },
  281.     {
  282.         "id": "ee91894c.17cea8",
  283.         "type": "comment",
  284.         "z": "5f7364a8.b1069c",
  285.         "name": "Control lights with IKEA remote",
  286.         "info": "",
  287.         "x": 150,
  288.         "y": 60,
  289.         "wires": []
  290.     },
  291.     {
  292.         "id": "39108b90.992b54",
  293.         "type": "comment",
  294.         "z": "5f7364a8.b1069c",
  295.         "name": "Turn on lights on motion when light is low",
  296.         "info": "",
  297.         "x": 180,
  298.         "y": 200,
  299.         "wires": []
  300.     },
  301.     {
  302.         "id": "b9cdd6dc.dfb1c8",
  303.         "type": "trigger-state",
  304.         "z": "5f7364a8.b1069c",
  305.         "name": "Motion sensor and low lux",
  306.         "server": "3bebce79.1e0962",
  307.         "exposeToHomeAssistant": false,
  308.         "haConfig": [
  309.             {
  310.                 "property": "name",
  311.                 "value": ""
  312.             },
  313.             {
  314.                 "property": "icon",
  315.                 "value": ""
  316.             }
  317.         ],
  318.         "entityid": "binary_sensor.presence_13",
  319.         "entityidfiltertype": "exact",
  320.         "debugenabled": false,
  321.         "constraints": [
  322.             {
  323.                 "targetType": "this_entity",
  324.                 "targetValue": "",
  325.                 "propertyType": "current_state",
  326.                 "comparatorType": "is",
  327.                 "comparatorValueDatatype": "str",
  328.                 "comparatorValue": "on",
  329.                 "propertyValue": "new_state.state"
  330.             },
  331.             {
  332.                 "targetType": "entity_id",
  333.                 "targetValue": "sensor.lightlevel_15",
  334.                 "propertyType": "current_state",
  335.                 "comparatorType": "<=",
  336.                 "comparatorValueDatatype": "num",
  337.                 "comparatorValue": "3",
  338.                 "propertyValue": "new_state.state"
  339.             }
  340.         ],
  341.         "outputs": 2,
  342.         "customoutputs": [],
  343.         "outputinitially": false,
  344.         "state_type": "str",
  345.         "x": 130,
  346.         "y": 240,
  347.         "wires": [
  348.             [
  349.                 "58fafd6d.2ad9f4"
  350.             ],
  351.             []
  352.         ]
  353.     },
  354.     {
  355.         "id": "11d0104.7f1b1f",
  356.         "type": "stoptimer",
  357.         "z": "5f7364a8.b1069c",
  358.         "duration": "90",
  359.         "units": "Second",
  360.         "payloadtype": "num",
  361.         "payloadval": "0",
  362.         "name": "Wait 1 ½ min",
  363.         "x": 510,
  364.         "y": 240,
  365.         "wires": [
  366.             [
  367.                 "10686073.fc9d5"
  368.             ],
  369.             []
  370.         ]
  371.     },
  372.     {
  373.         "id": "a6c79e46.d4382",
  374.         "type": "comment",
  375.         "z": "5f7364a8.b1069c",
  376.         "name": "Turn on/off lights on based on sun elevation",
  377.         "info": "",
  378.         "x": 190,
  379.         "y": 320,
  380.         "wires": []
  381.     },
  382.     {
  383.         "id": "2eebeb2d.2e2cd4",
  384.         "type": "trigger-state",
  385.         "z": "5f7364a8.b1069c",
  386.         "name": "Sun position",
  387.         "server": "3bebce79.1e0962",
  388.         "exposeToHomeAssistant": false,
  389.         "haConfig": [
  390.             {
  391.                 "property": "name",
  392.                 "value": ""
  393.             },
  394.             {
  395.                 "property": "icon",
  396.                 "value": ""
  397.             }
  398.         ],
  399.         "entityid": "sun.sun",
  400.         "entityidfiltertype": "exact",
  401.         "debugenabled": false,
  402.         "constraints": [
  403.             {
  404.                 "targetType": "this_entity",
  405.                 "targetValue": "",
  406.                 "propertyType": "property",
  407.                 "comparatorType": "<",
  408.                 "comparatorValueDatatype": "num",
  409.                 "comparatorValue": "-3",
  410.                 "propertyValue": "new_state.attributes.elevation"
  411.             },
  412.             {
  413.                 "targetType": "this_entity",
  414.                 "targetValue": "",
  415.                 "propertyType": "property",
  416.                 "comparatorType": ">=",
  417.                 "comparatorValueDatatype": "num",
  418.                 "comparatorValue": "-3",
  419.                 "propertyValue": "old_state.attributes.elevation"
  420.             }
  421.         ],
  422.         "outputs": 2,
  423.         "customoutputs": [],
  424.         "outputinitially": false,
  425.         "state_type": "str",
  426.         "x": 90,
  427.         "y": 360,
  428.         "wires": [
  429.             [
  430.                 "5622c773.d7bee8"
  431.             ],
  432.             [
  433.                 "c7855997.0d3e98"
  434.             ]
  435.         ],
  436.         "outputLabels": [
  437.             "Det er mørkt",
  438.             "Det er lyst"
  439.         ]
  440.     },
  441.     {
  442.         "id": "c7855997.0d3e98",
  443.         "type": "switch",
  444.         "z": "5f7364a8.b1069c",
  445.         "name": "Elevation > -3?",
  446.         "property": "data.event.new_state.attributes.elevation",
  447.         "propertyType": "msg",
  448.         "rules": [
  449.             {
  450.                 "t": "gt",
  451.                 "v": "-3",
  452.                 "vt": "str"
  453.             }
  454.         ],
  455.         "checkall": "true",
  456.         "repair": false,
  457.         "outputs": 1,
  458.         "x": 400,
  459.         "y": 400,
  460.         "wires": [
  461.             [
  462.                 "c01afb84.9cdca8"
  463.             ]
  464.         ]
  465.     },
  466.     {
  467.         "id": "c01afb84.9cdca8",
  468.         "type": "api-call-service",
  469.         "z": "5f7364a8.b1069c",
  470.         "name": "Turn lights off",
  471.         "server": "3bebce79.1e0962",
  472.         "version": 1,
  473.         "debugenabled": false,
  474.         "service_domain": "light",
  475.         "service": "turn_off",
  476.         "entityId": "",
  477.         "data": "{\"entity_id\": \"all\"}",
  478.         "dataType": "json",
  479.         "mergecontext": "",
  480.         "output_location": "",
  481.         "output_location_type": "none",
  482.         "mustacheAltTags": false,
  483.         "x": 680,
  484.         "y": 400,
  485.         "wires": [
  486.             []
  487.         ]
  488.     },
  489.     {
  490.         "id": "5622c773.d7bee8",
  491.         "type": "api-call-service",
  492.         "z": "5f7364a8.b1069c",
  493.         "name": "Turn lights off",
  494.         "server": "3bebce79.1e0962",
  495.         "version": 1,
  496.         "debugenabled": false,
  497.         "service_domain": "light",
  498.         "service": "turn_on",
  499.         "entityId": "",
  500.         "data": "{\"entity_id\": \"all\"}",
  501.         "dataType": "json",
  502.         "mergecontext": "",
  503.         "output_location": "",
  504.         "output_location_type": "none",
  505.         "mustacheAltTags": false,
  506.         "x": 680,
  507.         "y": 340,
  508.         "wires": [
  509.             []
  510.         ]
  511.     },
  512.     {
  513.         "id": "3bebce79.1e0962",
  514.         "type": "server",
  515.         "name": "Home Assistant",
  516.         "addon": true
  517.     }
  518. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement