Advertisement
dykandDK

HA - NR - Doorbell - Example

Jul 25th, 2020 (edited)
799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 10.77 KB | None | 0 0
  1. [
  2.     {
  3.         "id": "da5e8bfe.858508",
  4.         "type": "tab",
  5.         "label": "Doorbell",
  6.         "disabled": false,
  7.         "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"
  8.     },
  9.     {
  10.         "id": "d0854b4d.6ebe58",
  11.         "type": "server-events",
  12.         "z": "da5e8bfe.858508",
  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.                 "12a4c631.eb62ea"
  32.             ]
  33.         ]
  34.     },
  35.     {
  36.         "id": "12a4c631.eb62ea",
  37.         "type": "switch",
  38.         "z": "da5e8bfe.858508",
  39.         "name": "Doorbell?",
  40.         "property": "payload.event.id",
  41.         "propertyType": "msg",
  42.         "rules": [
  43.             {
  44.                 "t": "eq",
  45.                 "v": "hue_smart_button",
  46.                 "vt": "str"
  47.             }
  48.         ],
  49.         "checkall": "true",
  50.         "repair": false,
  51.         "outputs": 1,
  52.         "x": 260,
  53.         "y": 100,
  54.         "wires": [
  55.             [
  56.                 "4955a6e6.e84a18"
  57.             ]
  58.         ]
  59.     },
  60.     {
  61.         "id": "a36fccc2.f8d18",
  62.         "type": "switch",
  63.         "z": "da5e8bfe.858508",
  64.         "name": "Is home?",
  65.         "property": "payload",
  66.         "propertyType": "msg",
  67.         "rules": [
  68.             {
  69.                 "t": "eq",
  70.                 "v": "not_home",
  71.                 "vt": "str"
  72.             },
  73.             {
  74.                 "t": "eq",
  75.                 "v": "home",
  76.                 "vt": "str"
  77.             }
  78.         ],
  79.         "checkall": "true",
  80.         "repair": false,
  81.         "outputs": 2,
  82.         "x": 720,
  83.         "y": 100,
  84.         "wires": [
  85.             [
  86.                 "29d7333.434cecc"
  87.             ],
  88.             [
  89.                 "160276bc.7f0ab9"
  90.             ]
  91.         ]
  92.     },
  93.     {
  94.         "id": "38d00712.fdda48",
  95.         "type": "api-current-state",
  96.         "z": "da5e8bfe.858508",
  97.         "name": "Get home state",
  98.         "server": "3bebce79.1e0962",
  99.         "version": 1,
  100.         "outputs": 1,
  101.         "halt_if": "",
  102.         "halt_if_type": "str",
  103.         "halt_if_compare": "is",
  104.         "override_topic": false,
  105.         "entity_id": "group.alle_personer",
  106.         "state_type": "str",
  107.         "state_location": "payload",
  108.         "override_payload": "msg",
  109.         "entity_location": "data",
  110.         "override_data": "msg",
  111.         "blockInputOverrides": false,
  112.         "x": 560,
  113.         "y": 100,
  114.         "wires": [
  115.             [
  116.                 "a36fccc2.f8d18"
  117.             ]
  118.         ]
  119.     },
  120.     {
  121.         "id": "29d7333.434cecc",
  122.         "type": "api-call-service",
  123.         "z": "da5e8bfe.858508",
  124.         "name": "Notify when not home",
  125.         "server": "3bebce79.1e0962",
  126.         "version": 1,
  127.         "debugenabled": false,
  128.         "service_domain": "notify",
  129.         "service": "notify",
  130.         "entityId": "",
  131.         "data": "{\"message\":\"Det ringer på døren\"}",
  132.         "dataType": "json",
  133.         "mergecontext": "",
  134.         "output_location": "",
  135.         "output_location_type": "none",
  136.         "mustacheAltTags": false,
  137.         "x": 920,
  138.         "y": 40,
  139.         "wires": [
  140.             []
  141.         ]
  142.     },
  143.     {
  144.         "id": "4955a6e6.e84a18",
  145.         "type": "switch",
  146.         "z": "da5e8bfe.858508",
  147.         "name": "Pressed?",
  148.         "property": "payload.event.event",
  149.         "propertyType": "msg",
  150.         "rules": [
  151.             {
  152.                 "t": "eq",
  153.                 "v": "1002",
  154.                 "vt": "num"
  155.             }
  156.         ],
  157.         "checkall": "true",
  158.         "repair": false,
  159.         "outputs": 1,
  160.         "x": 400,
  161.         "y": 100,
  162.         "wires": [
  163.             [
  164.                 "38d00712.fdda48"
  165.             ]
  166.         ]
  167.     },
  168.     {
  169.         "id": "160276bc.7f0ab9",
  170.         "type": "time-range-switch",
  171.         "z": "da5e8bfe.858508",
  172.         "name": "Day time?",
  173.         "lat": "",
  174.         "lon": "",
  175.         "startTime": "07:00",
  176.         "endTime": "19:00",
  177.         "startOffset": 0,
  178.         "endOffset": 0,
  179.         "x": 880,
  180.         "y": 140,
  181.         "wires": [
  182.             [
  183.                 "53967f06.f2aa1"
  184.             ],
  185.             [
  186.                 "29d7333.434cecc"
  187.             ]
  188.         ]
  189.     },
  190.     {
  191.         "id": "53967f06.f2aa1",
  192.         "type": "template",
  193.         "z": "da5e8bfe.858508",
  194.         "name": "data_variables",
  195.         "field": "sonos_data",
  196.         "fieldType": "msg",
  197.         "format": "json",
  198.         "syntax": "mustache",
  199.         "template": "{\n    \"sonos_entity\": \"media_player.alrum\",\n    \"volume\": \"0.51\",\n    \"message\": \"Der er gæster\"\n}",
  200.         "output": "json",
  201.         "x": 1080,
  202.         "y": 140,
  203.         "wires": [
  204.             [
  205.                 "6eca7dcf.4620b4"
  206.             ]
  207.         ]
  208.     },
  209.     {
  210.         "id": "6eca7dcf.4620b4",
  211.         "type": "api-call-service",
  212.         "z": "da5e8bfe.858508",
  213.         "name": "Snapshot",
  214.         "server": "3bebce79.1e0962",
  215.         "version": 1,
  216.         "debugenabled": false,
  217.         "service_domain": "sonos",
  218.         "service": "snapshot",
  219.         "entityId": "{{ sonos_data.sonos_entity }}",
  220.         "data": "",
  221.         "dataType": "json",
  222.         "mergecontext": "",
  223.         "output_location": "",
  224.         "output_location_type": "none",
  225.         "mustacheAltTags": false,
  226.         "x": 100,
  227.         "y": 220,
  228.         "wires": [
  229.             [
  230.                 "9c085943.0c8218"
  231.             ]
  232.         ]
  233.     },
  234.     {
  235.         "id": "9c085943.0c8218",
  236.         "type": "api-call-service",
  237.         "z": "da5e8bfe.858508",
  238.         "name": "Unjoin",
  239.         "server": "3bebce79.1e0962",
  240.         "version": 1,
  241.         "debugenabled": false,
  242.         "service_domain": "media_player",
  243.         "service": "volume_set",
  244.         "entityId": "{{ sonos_data.sonos_entity }}",
  245.         "data": "{\"volume_level\":\"{{ sonos_data.volume }}\"}",
  246.         "dataType": "json",
  247.         "mergecontext": "",
  248.         "output_location": "",
  249.         "output_location_type": "none",
  250.         "mustacheAltTags": false,
  251.         "x": 230,
  252.         "y": 220,
  253.         "wires": [
  254.             [
  255.                 "96af54c9.4362a8"
  256.             ]
  257.         ]
  258.     },
  259.     {
  260.         "id": "96af54c9.4362a8",
  261.         "type": "api-call-service",
  262.         "z": "da5e8bfe.858508",
  263.         "name": "Volume",
  264.         "server": "3bebce79.1e0962",
  265.         "version": 1,
  266.         "debugenabled": false,
  267.         "service_domain": "media_player",
  268.         "service": "volume_set",
  269.         "entityId": "{{ sonos_data.sonos_entity }}",
  270.         "data": "{\"volume_level\":\"{{ sonos_data.volume }}\"}",
  271.         "dataType": "json",
  272.         "mergecontext": "",
  273.         "output_location": "",
  274.         "output_location_type": "none",
  275.         "mustacheAltTags": false,
  276.         "x": 360,
  277.         "y": 220,
  278.         "wires": [
  279.             [
  280.                 "ad24514f.598f1"
  281.             ]
  282.         ]
  283.     },
  284.     {
  285.         "id": "ad24514f.598f1",
  286.         "type": "api-call-service",
  287.         "z": "da5e8bfe.858508",
  288.         "name": "Doorbell",
  289.         "server": "3bebce79.1e0962",
  290.         "version": 1,
  291.         "debugenabled": false,
  292.         "service_domain": "media_player",
  293.         "service": "play_media",
  294.         "entityId": "{{ sonos_data.sonos_entity }}",
  295.         "data": "{\"media_content_id\":\"[URL]/local/assets/sound/doorbell-1.mp3\",\"media_content_type\":\"music\"}",
  296.         "dataType": "json",
  297.         "mergecontext": "",
  298.         "output_location": "",
  299.         "output_location_type": "none",
  300.         "mustacheAltTags": false,
  301.         "x": 500,
  302.         "y": 220,
  303.         "wires": [
  304.             [
  305.                 "be717fa7.a468a"
  306.             ]
  307.         ]
  308.     },
  309.     {
  310.         "id": "601f18b7.c7e298",
  311.         "type": "api-call-service",
  312.         "z": "da5e8bfe.858508",
  313.         "name": "TTS",
  314.         "server": "3bebce79.1e0962",
  315.         "version": 1,
  316.         "debugenabled": false,
  317.         "service_domain": "tts",
  318.         "service": "google_translate_say",
  319.         "entityId": "{{ sonos_data.sonos_entity }}",
  320.         "data": "{\"message\":\"{{ sonos_data.message }}\",\"language\":\"da\"}",
  321.         "dataType": "json",
  322.         "mergecontext": "",
  323.         "output_location": "",
  324.         "output_location_type": "none",
  325.         "mustacheAltTags": false,
  326.         "x": 770,
  327.         "y": 220,
  328.         "wires": [
  329.             [
  330.                 "f9fa8a69.894f98"
  331.             ]
  332.         ]
  333.     },
  334.     {
  335.         "id": "f9fa8a69.894f98",
  336.         "type": "delay",
  337.         "z": "da5e8bfe.858508",
  338.         "name": "",
  339.         "pauseType": "delay",
  340.         "timeout": "3",
  341.         "timeoutUnits": "seconds",
  342.         "rate": "1",
  343.         "nbRateUnits": "1",
  344.         "rateUnits": "second",
  345.         "randomFirst": "1",
  346.         "randomLast": "5",
  347.         "randomUnits": "seconds",
  348.         "drop": false,
  349.         "x": 900,
  350.         "y": 220,
  351.         "wires": [
  352.             [
  353.                 "943aae1c.2aa56"
  354.             ]
  355.         ]
  356.     },
  357.     {
  358.         "id": "943aae1c.2aa56",
  359.         "type": "api-call-service",
  360.         "z": "da5e8bfe.858508",
  361.         "name": "Restore",
  362.         "server": "3bebce79.1e0962",
  363.         "version": 1,
  364.         "debugenabled": false,
  365.         "service_domain": "sonos",
  366.         "service": "restore",
  367.         "entityId": "{{ sonos_data.sonos_entity }}",
  368.         "data": "",
  369.         "dataType": "json",
  370.         "mergecontext": "",
  371.         "output_location": "",
  372.         "output_location_type": "none",
  373.         "mustacheAltTags": false,
  374.         "x": 1040,
  375.         "y": 220,
  376.         "wires": [
  377.             []
  378.         ]
  379.     },
  380.     {
  381.         "id": "be717fa7.a468a",
  382.         "type": "delay",
  383.         "z": "da5e8bfe.858508",
  384.         "name": "",
  385.         "pauseType": "delay",
  386.         "timeout": "4",
  387.         "timeoutUnits": "seconds",
  388.         "rate": "1",
  389.         "nbRateUnits": "1",
  390.         "rateUnits": "second",
  391.         "randomFirst": "1",
  392.         "randomLast": "5",
  393.         "randomUnits": "seconds",
  394.         "drop": false,
  395.         "x": 640,
  396.         "y": 220,
  397.         "wires": [
  398.             [
  399.                 "601f18b7.c7e298"
  400.             ]
  401.         ]
  402.     },
  403.     {
  404.         "id": "3bebce79.1e0962",
  405.         "type": "server",
  406.         "name": "Home Assistant",
  407.         "addon": true
  408.     }
  409. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement