[ { "id": "da5e8bfe.858508", "type": "tab", "label": "Doorbell", "disabled": false, "info": "## Flow for automating doorbell\n**By Anders Lukic**\n\n---\n\nFlow for doorbell automation that:\n\n - plays doorbell sound and TTS over Sonos speaker when doorbell is pressed between 07.00 and 19.00 if somebody is home\n - sends notification to mobile if nobody is home or after 19.00" }, { "id": "d0854b4d.6ebe58", "type": "server-events", "z": "da5e8bfe.858508", "name": "Deconz events", "server": "3bebce79.1e0962", "event_type": "deconz_event", "exposeToHomeAssistant": false, "haConfig": [ { "property": "name", "value": "" }, { "property": "icon", "value": "" } ], "x": 100, "y": 100, "wires": [ [ "12a4c631.eb62ea" ] ] }, { "id": "12a4c631.eb62ea", "type": "switch", "z": "da5e8bfe.858508", "name": "Doorbell?", "property": "payload.event.id", "propertyType": "msg", "rules": [ { "t": "eq", "v": "hue_smart_button", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 260, "y": 100, "wires": [ [ "4955a6e6.e84a18" ] ] }, { "id": "a36fccc2.f8d18", "type": "switch", "z": "da5e8bfe.858508", "name": "Is home?", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "not_home", "vt": "str" }, { "t": "eq", "v": "home", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 720, "y": 100, "wires": [ [ "29d7333.434cecc" ], [ "160276bc.7f0ab9" ] ] }, { "id": "38d00712.fdda48", "type": "api-current-state", "z": "da5e8bfe.858508", "name": "Get home state", "server": "3bebce79.1e0962", "version": 1, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "override_topic": false, "entity_id": "group.alle_personer", "state_type": "str", "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "blockInputOverrides": false, "x": 560, "y": 100, "wires": [ [ "a36fccc2.f8d18" ] ] }, { "id": "29d7333.434cecc", "type": "api-call-service", "z": "da5e8bfe.858508", "name": "Notify when not home", "server": "3bebce79.1e0962", "version": 1, "debugenabled": false, "service_domain": "notify", "service": "notify", "entityId": "", "data": "{\"message\":\"Det ringer på døren\"}", "dataType": "json", "mergecontext": "", "output_location": "", "output_location_type": "none", "mustacheAltTags": false, "x": 920, "y": 40, "wires": [ [] ] }, { "id": "4955a6e6.e84a18", "type": "switch", "z": "da5e8bfe.858508", "name": "Pressed?", "property": "payload.event.event", "propertyType": "msg", "rules": [ { "t": "eq", "v": "1002", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 400, "y": 100, "wires": [ [ "38d00712.fdda48" ] ] }, { "id": "160276bc.7f0ab9", "type": "time-range-switch", "z": "da5e8bfe.858508", "name": "Day time?", "lat": "", "lon": "", "startTime": "07:00", "endTime": "19:00", "startOffset": 0, "endOffset": 0, "x": 880, "y": 140, "wires": [ [ "53967f06.f2aa1" ], [ "29d7333.434cecc" ] ] }, { "id": "53967f06.f2aa1", "type": "template", "z": "da5e8bfe.858508", "name": "data_variables", "field": "sonos_data", "fieldType": "msg", "format": "json", "syntax": "mustache", "template": "{\n \"sonos_entity\": \"media_player.alrum\",\n \"volume\": \"0.51\",\n \"message\": \"Der er gæster\"\n}", "output": "json", "x": 1080, "y": 140, "wires": [ [ "6eca7dcf.4620b4" ] ] }, { "id": "6eca7dcf.4620b4", "type": "api-call-service", "z": "da5e8bfe.858508", "name": "Snapshot", "server": "3bebce79.1e0962", "version": 1, "debugenabled": false, "service_domain": "sonos", "service": "snapshot", "entityId": "{{ sonos_data.sonos_entity }}", "data": "", "dataType": "json", "mergecontext": "", "output_location": "", "output_location_type": "none", "mustacheAltTags": false, "x": 100, "y": 220, "wires": [ [ "9c085943.0c8218" ] ] }, { "id": "9c085943.0c8218", "type": "api-call-service", "z": "da5e8bfe.858508", "name": "Unjoin", "server": "3bebce79.1e0962", "version": 1, "debugenabled": false, "service_domain": "media_player", "service": "volume_set", "entityId": "{{ sonos_data.sonos_entity }}", "data": "{\"volume_level\":\"{{ sonos_data.volume }}\"}", "dataType": "json", "mergecontext": "", "output_location": "", "output_location_type": "none", "mustacheAltTags": false, "x": 230, "y": 220, "wires": [ [ "96af54c9.4362a8" ] ] }, { "id": "96af54c9.4362a8", "type": "api-call-service", "z": "da5e8bfe.858508", "name": "Volume", "server": "3bebce79.1e0962", "version": 1, "debugenabled": false, "service_domain": "media_player", "service": "volume_set", "entityId": "{{ sonos_data.sonos_entity }}", "data": "{\"volume_level\":\"{{ sonos_data.volume }}\"}", "dataType": "json", "mergecontext": "", "output_location": "", "output_location_type": "none", "mustacheAltTags": false, "x": 360, "y": 220, "wires": [ [ "ad24514f.598f1" ] ] }, { "id": "ad24514f.598f1", "type": "api-call-service", "z": "da5e8bfe.858508", "name": "Doorbell", "server": "3bebce79.1e0962", "version": 1, "debugenabled": false, "service_domain": "media_player", "service": "play_media", "entityId": "{{ sonos_data.sonos_entity }}", "data": "{\"media_content_id\":\"[URL]/local/assets/sound/doorbell-1.mp3\",\"media_content_type\":\"music\"}", "dataType": "json", "mergecontext": "", "output_location": "", "output_location_type": "none", "mustacheAltTags": false, "x": 500, "y": 220, "wires": [ [ "be717fa7.a468a" ] ] }, { "id": "601f18b7.c7e298", "type": "api-call-service", "z": "da5e8bfe.858508", "name": "TTS", "server": "3bebce79.1e0962", "version": 1, "debugenabled": false, "service_domain": "tts", "service": "google_translate_say", "entityId": "{{ sonos_data.sonos_entity }}", "data": "{\"message\":\"{{ sonos_data.message }}\",\"language\":\"da\"}", "dataType": "json", "mergecontext": "", "output_location": "", "output_location_type": "none", "mustacheAltTags": false, "x": 770, "y": 220, "wires": [ [ "f9fa8a69.894f98" ] ] }, { "id": "f9fa8a69.894f98", "type": "delay", "z": "da5e8bfe.858508", "name": "", "pauseType": "delay", "timeout": "3", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "x": 900, "y": 220, "wires": [ [ "943aae1c.2aa56" ] ] }, { "id": "943aae1c.2aa56", "type": "api-call-service", "z": "da5e8bfe.858508", "name": "Restore", "server": "3bebce79.1e0962", "version": 1, "debugenabled": false, "service_domain": "sonos", "service": "restore", "entityId": "{{ sonos_data.sonos_entity }}", "data": "", "dataType": "json", "mergecontext": "", "output_location": "", "output_location_type": "none", "mustacheAltTags": false, "x": 1040, "y": 220, "wires": [ [] ] }, { "id": "be717fa7.a468a", "type": "delay", "z": "da5e8bfe.858508", "name": "", "pauseType": "delay", "timeout": "4", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "x": 640, "y": 220, "wires": [ [ "601f18b7.c7e298" ] ] }, { "id": "3bebce79.1e0962", "type": "server", "name": "Home Assistant", "addon": true } ]