[ { "id": "5f7364a8.b1069c", "type": "tab", "label": "Lights", "disabled": false, "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" }, { "id": "3fa84325.374d2c", "type": "server-events", "z": "5f7364a8.b1069c", "name": "Deconz events", "server": "3bebce79.1e0962", "event_type": "deconz_event", "exposeToHomeAssistant": false, "haConfig": [ { "property": "name", "value": "" }, { "property": "icon", "value": "" } ], "x": 100, "y": 100, "wires": [ [ "71140b27.c62754" ] ] }, { "id": "b97223b3.98f69", "type": "debug", "z": "5f7364a8.b1069c", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 490, "y": 160, "wires": [] }, { "id": "a9d55c5e.7529b", "type": "switch", "z": "5f7364a8.b1069c", "name": "Buttons", "property": "payload.event.event", "propertyType": "msg", "rules": [ { "t": "eq", "v": "1002", "vt": "num" }, { "t": "eq", "v": "2002", "vt": "num" }, { "t": "eq", "v": "3002", "vt": "num" }, { "t": "eq", "v": "4002", "vt": "num" }, { "t": "eq", "v": "5002", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 5, "x": 480, "y": 100, "wires": [ [ "64d7f2e9.7c32fc" ], [ "7d208c88.4dabd4" ], [ "5a12072e.c78bf8" ], [ "9faf6b71.9c3748" ], [ "9faf6b71.9c3748" ] ], "outputLabels": [ "On off", "Dim Up", "Dim Down", "Right", "Left" ] }, { "id": "64d7f2e9.7c32fc", "type": "api-call-service", "z": "5f7364a8.b1069c", "name": "Toogle light 1", "server": "3bebce79.1e0962", "version": 1, "debugenabled": false, "service_domain": "light", "service": "toggle", "entityId": "light.stander_2_stue_paere_2", "data": "", "dataType": "json", "mergecontext": "", "output_location": "", "output_location_type": "none", "mustacheAltTags": false, "x": 710, "y": 40, "wires": [ [] ] }, { "id": "5a12072e.c78bf8", "type": "api-call-service", "z": "5f7364a8.b1069c", "name": "Dim light 1", "server": "3bebce79.1e0962", "version": 1, "debugenabled": false, "service_domain": "light", "service": "turn_on", "entityId": "light.stander_2_stue_paere_2", "data": "{\"brightness_step_pct\":-10}", "dataType": "json", "mergecontext": "", "output_location": "", "output_location_type": "none", "mustacheAltTags": false, "x": 710, "y": 120, "wires": [ [] ] }, { "id": "7d208c88.4dabd4", "type": "api-call-service", "z": "5f7364a8.b1069c", "name": "Dim Up Light 1", "server": "3bebce79.1e0962", "version": 1, "debugenabled": false, "service_domain": "light", "service": "turn_on", "entityId": "light.stander_2_stue_paere_2", "data": "{\"brightness_step_pct\":10}", "dataType": "json", "mergecontext": "", "output_location": "", "output_location_type": "none", "mustacheAltTags": false, "x": 720, "y": 80, "wires": [ [] ] }, { "id": "9faf6b71.9c3748", "type": "api-call-service", "z": "5f7364a8.b1069c", "name": "Toogle light", "server": "3bebce79.1e0962", "version": 1, "debugenabled": false, "service_domain": "switch", "service": "toggle", "entityId": "switch.on_off_plug_in_unit_4", "data": "", "dataType": "json", "mergecontext": "", "output_location": "", "output_location_type": "none", "mustacheAltTags": false, "x": 710, "y": 160, "wires": [ [] ] }, { "id": "71140b27.c62754", "type": "switch", "z": "5f7364a8.b1069c", "name": "IKEA Trådfri remote", "property": "payload.event.id", "propertyType": "msg", "rules": [ { "t": "eq", "v": "tradfri_remote_control", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 290, "y": 100, "wires": [ [ "a9d55c5e.7529b", "b97223b3.98f69" ] ] }, { "id": "58fafd6d.2ad9f4", "type": "api-call-service", "z": "5f7364a8.b1069c", "name": "Turn lights on", "server": "3bebce79.1e0962", "version": 1, "debugenabled": false, "service_domain": "light", "service": "turn_on", "entityId": "light.bryggers", "data": "", "dataType": "json", "mergecontext": "", "output_location": "", "output_location_type": "none", "mustacheAltTags": false, "x": 340, "y": 240, "wires": [ [ "11d0104.7f1b1f" ] ] }, { "id": "10686073.fc9d5", "type": "api-call-service", "z": "5f7364a8.b1069c", "name": "Turn lights off", "server": "3bebce79.1e0962", "version": 1, "debugenabled": false, "service_domain": "light", "service": "turn_off", "entityId": "light.bryggers", "data": "", "dataType": "json", "mergecontext": "", "output_location": "", "output_location_type": "none", "mustacheAltTags": false, "x": 680, "y": 240, "wires": [ [] ] }, { "id": "ee91894c.17cea8", "type": "comment", "z": "5f7364a8.b1069c", "name": "Control lights with IKEA remote", "info": "", "x": 150, "y": 60, "wires": [] }, { "id": "39108b90.992b54", "type": "comment", "z": "5f7364a8.b1069c", "name": "Turn on lights on motion when light is low", "info": "", "x": 180, "y": 200, "wires": [] }, { "id": "b9cdd6dc.dfb1c8", "type": "trigger-state", "z": "5f7364a8.b1069c", "name": "Motion sensor and low lux", "server": "3bebce79.1e0962", "exposeToHomeAssistant": false, "haConfig": [ { "property": "name", "value": "" }, { "property": "icon", "value": "" } ], "entityid": "binary_sensor.presence_13", "entityidfiltertype": "exact", "debugenabled": false, "constraints": [ { "targetType": "this_entity", "targetValue": "", "propertyType": "current_state", "comparatorType": "is", "comparatorValueDatatype": "str", "comparatorValue": "on", "propertyValue": "new_state.state" }, { "targetType": "entity_id", "targetValue": "sensor.lightlevel_15", "propertyType": "current_state", "comparatorType": "<=", "comparatorValueDatatype": "num", "comparatorValue": "3", "propertyValue": "new_state.state" } ], "outputs": 2, "customoutputs": [], "outputinitially": false, "state_type": "str", "x": 130, "y": 240, "wires": [ [ "58fafd6d.2ad9f4" ], [] ] }, { "id": "11d0104.7f1b1f", "type": "stoptimer", "z": "5f7364a8.b1069c", "duration": "90", "units": "Second", "payloadtype": "num", "payloadval": "0", "name": "Wait 1 ½ min", "x": 510, "y": 240, "wires": [ [ "10686073.fc9d5" ], [] ] }, { "id": "a6c79e46.d4382", "type": "comment", "z": "5f7364a8.b1069c", "name": "Turn on/off lights on based on sun elevation", "info": "", "x": 190, "y": 320, "wires": [] }, { "id": "2eebeb2d.2e2cd4", "type": "trigger-state", "z": "5f7364a8.b1069c", "name": "Sun position", "server": "3bebce79.1e0962", "exposeToHomeAssistant": false, "haConfig": [ { "property": "name", "value": "" }, { "property": "icon", "value": "" } ], "entityid": "sun.sun", "entityidfiltertype": "exact", "debugenabled": false, "constraints": [ { "targetType": "this_entity", "targetValue": "", "propertyType": "property", "comparatorType": "<", "comparatorValueDatatype": "num", "comparatorValue": "-3", "propertyValue": "new_state.attributes.elevation" }, { "targetType": "this_entity", "targetValue": "", "propertyType": "property", "comparatorType": ">=", "comparatorValueDatatype": "num", "comparatorValue": "-3", "propertyValue": "old_state.attributes.elevation" } ], "outputs": 2, "customoutputs": [], "outputinitially": false, "state_type": "str", "x": 90, "y": 360, "wires": [ [ "5622c773.d7bee8" ], [ "c7855997.0d3e98" ] ], "outputLabels": [ "Det er mørkt", "Det er lyst" ] }, { "id": "c7855997.0d3e98", "type": "switch", "z": "5f7364a8.b1069c", "name": "Elevation > -3?", "property": "data.event.new_state.attributes.elevation", "propertyType": "msg", "rules": [ { "t": "gt", "v": "-3", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 400, "y": 400, "wires": [ [ "c01afb84.9cdca8" ] ] }, { "id": "c01afb84.9cdca8", "type": "api-call-service", "z": "5f7364a8.b1069c", "name": "Turn lights off", "server": "3bebce79.1e0962", "version": 1, "debugenabled": false, "service_domain": "light", "service": "turn_off", "entityId": "", "data": "{\"entity_id\": \"all\"}", "dataType": "json", "mergecontext": "", "output_location": "", "output_location_type": "none", "mustacheAltTags": false, "x": 680, "y": 400, "wires": [ [] ] }, { "id": "5622c773.d7bee8", "type": "api-call-service", "z": "5f7364a8.b1069c", "name": "Turn lights off", "server": "3bebce79.1e0962", "version": 1, "debugenabled": false, "service_domain": "light", "service": "turn_on", "entityId": "", "data": "{\"entity_id\": \"all\"}", "dataType": "json", "mergecontext": "", "output_location": "", "output_location_type": "none", "mustacheAltTags": false, "x": 680, "y": 340, "wires": [ [] ] }, { "id": "3bebce79.1e0962", "type": "server", "name": "Home Assistant", "addon": true } ]