{
  "updatedAt": "2026-02-15T22:16:31.754Z",
  "createdAt": "2025-03-30T13:45:55.100Z",
  "id": "PgcWZStiOuLupudm",
  "name": "Alarm",
  "description": null,
  "active": true,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "alarm",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "id": "c6658ddc-dfa1-4aa4-87ba-90327964a377",
      "name": "Webhook"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "046c7bd1-72f2-4f19-b520-cc8c3192007b",
              "leftValue": "={{ $json.body.alarm }}",
              "rightValue": "no scheduled alarm",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        224,
        0
      ],
      "id": "95d5c741-926e-4831-94c5-cd5c4fa8d34b",
      "name": "If"
    },
    {
      "parameters": {
        "resource": "service",
        "operation": "call",
        "domain": "script",
        "service": "turn_off_alarm"
      },
      "type": "n8n-nodes-base.homeAssistant",
      "typeVersion": 1,
      "position": [
        448,
        -96
      ],
      "id": "33390e41-2661-4b8b-a961-b3c9a81c4d9b",
      "name": "Home Assistant",
      "credentials": {
        "homeAssistantApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "service",
        "operation": "call",
        "domain": "automation",
        "service": "turn_on"
      },
      "type": "n8n-nodes-base.homeAssistant",
      "typeVersion": 1,
      "position": [
        448,
        112
      ],
      "id": "51a83130-853a-4593-983c-adfdd37f46e7",
      "name": "Home Assistant1",
      "executeOnce": true,
      "credentials": {
        "homeAssistantApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "state",
        "operation": "upsert",
        "entityId": "input_datetime.alarm",
        "state": "={{ $('If').item.json.body.alarm }} - 5m"
      },
      "type": "n8n-nodes-base.homeAssistant",
      "typeVersion": 1,
      "position": [
        672,
        112
      ],
      "id": "45af9566-9bd3-4df6-b0d5-ac12e1426a08",
      "name": "Home Assistant2",
      "executeOnce": true,
      "credentials": {
        "homeAssistantApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "subtractFromDate",
        "magnitude": "={{ $json.newDate }}",
        "timeUnit": "minutes",
        "duration": "={{ parseInt( $('Webhook').item.json.body.alarm.split(':')[1])*-1}}",
        "options": {
          "includeInputFields": false
        }
      },
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        1104,
        112
      ],
      "id": "af37068e-af7b-45e0-b980-1e3153f7eeba",
      "name": "Date & Time1"
    },
    {
      "parameters": {
        "operation": "subtractFromDate",
        "magnitude": "={{$today}}",
        "timeUnit": "hours",
        "duration": "={{ parseInt( $('Webhook').item.json.body.alarm.split(':')[0])*-1}}",
        "options": {}
      },
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        880,
        112
      ],
      "id": "181e9452-bf70-4c8a-bcee-dc39921538d0",
      "name": "Date & Time"
    },
    {
      "parameters": {
        "resource": "state",
        "operation": "upsert",
        "entityId": "input_number.n8n_communicator",
        "state": "={{ (new Date($json.newDate).getTime() / 1000).toFixed(0) }}\n"
      },
      "type": "n8n-nodes-base.homeAssistant",
      "typeVersion": 1,
      "position": [
        1536,
        112
      ],
      "id": "9d3d475c-233f-4faf-aff5-87c0f11ec587",
      "name": "Home Assistant3",
      "credentials": {
        "homeAssistantApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "service",
        "operation": "call",
        "domain": "script",
        "service": "1743407877695"
      },
      "type": "n8n-nodes-base.homeAssistant",
      "typeVersion": 1,
      "position": [
        1760,
        112
      ],
      "id": "bda42df9-84e1-403c-b726-1a9e84c53049",
      "name": "Home Assistant4",
      "credentials": {
        "homeAssistantApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "addToDate",
        "magnitude": "={{ $json.newDate }}",
        "timeUnit": "minutes",
        "duration": -5,
        "options": {}
      },
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        1312,
        112
      ],
      "id": "a207cb84-7968-4e26-8a68-d46144e1f407",
      "name": "Date & Time2"
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Home Assistant",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Home Assistant1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Home Assistant1": {
      "main": [
        [
          {
            "node": "Home Assistant2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Home Assistant2": {
      "main": [
        [
          {
            "node": "Date & Time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Date & Time1": {
      "main": [
        [
          {
            "node": "Date & Time2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Date & Time": {
      "main": [
        [
          {
            "node": "Date & Time1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Home Assistant3": {
      "main": [
        [
          {
            "node": "Home Assistant4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Date & Time2": {
      "main": [
        [
          {
            "node": "Home Assistant3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "HSzWI1GrRqzS4mra",
    "executionTimeout": 3600,
    "availableInMCP": false,
    "timeSavedPerExecution": 60
  },
  "staticData": null,
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "versionId": "4f9e21ff-eff8-435d-84a3-cde7e11a1246",
  "activeVersionId": "20286d16-39bd-4d20-bef6-61411d0da355",
  "versionCounter": 33,
  "triggerCount": 1,
  "tags": [],
  "shared": [
    {
      "updatedAt": "2025-03-30T13:45:55.100Z",
      "createdAt": "2025-03-30T13:45:55.100Z",
      "role": "workflow:owner",
      "workflowId": "PgcWZStiOuLupudm",
      "projectId": "jKUmWjF06DKNXlFU",
      "project": {
        "updatedAt": "2024-11-03T18:52:12.752Z",
        "createdAt": "2024-11-03T18:46:00.929Z",
        "id": "jKUmWjF06DKNXlFU",
        "name": "Bence Daniel <bence.daniel99@gmail.com>",
        "type": "personal",
        "icon": null,
        "description": null,
        "creatorId": "cb9c5e06-042d-4f46-9622-b87c0e97c834"
      }
    }
  ]
}