diff --git a/workflow/n8n/workflows/Pelletheizung_ Abfrage Verbrauch.json b/workflow/n8n/workflows/Pelletheizung_ Abfrage Verbrauch.json new file mode 100644 index 0000000..d6a872b --- /dev/null +++ b/workflow/n8n/workflows/Pelletheizung_ Abfrage Verbrauch.json @@ -0,0 +1,461 @@ +{ + "name": "Pelletheizung: Abfrage Verbrauch", + "nodes": [ + { + "parameters": { + "url": "https://stokercloud.dk/v16bckbeta/dataout2/controllerdata2.php?screen=b1,0,b2,5,b3,4,b4,6,b5,12,b6,14,b7,15,b8,16,b9,9,b10,0,d1,3,d2,4,d3,0,d4,0,d5,0,d6,0,d7,0,d8,0,d9,0,d10,0,h1,2,h2,3,h3,4,h4,7,h5,8,h6,1,h7,5,h8,13,h9,0,h10,0,w1,2,w2,3,w3,9,w4,0,w5,0&token=958f4bcf6d8251da548e773176ca0925ff7840bdce7daeb8bcf72f00cf5201087fd760aeae882f66729695445feb8bbd55307f9279da03ae211ce9e4dd5229f7e950b3008574b55ea095001693fa7765fe09a1ab6553a3a8d8e70a4cb1916d43", + "options": {} + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.2, + "position": [ + -224, + 288 + ], + "id": "c09de7e8-760d-4716-a908-382d43c2258a", + "name": "HTTP Request" + }, + { + "parameters": { + "chatId": "749279624", + "text": "=Der aktuelle Füllstand des Pelletsilos beträgt {{ $('HTTP Request').item.json.hopperdata[5].value }} kg. Der heutige Verbrauch liegt bei {{ $('HTTP Request').item.json.hopperdata[1].value }} kg.", + "additionalFields": {} + }, + "type": "n8n-nodes-base.telegram", + "typeVersion": 1.2, + "position": [ + 224, + 576 + ], + "id": "953efaeb-f1e5-4515-b58a-46cbc6b72fbc", + "name": "Telegram", + "webhookId": "ddd87e24-21a8-4037-a549-8991f0c31d97", + "credentials": { + "telegramApi": { + "id": "EUy2hT71fSdnEr2w", + "name": "Telegram account" + } + }, + "disabled": true + }, + { + "parameters": { + "operation": "upsert", + "table": { + "__rl": true, + "value": "Pellets", + "mode": "list", + "cachedResultName": "Pellets" + }, + "dataMode": "defineBelow", + "columnToMatchOn": "Datum", + "valueToMatchOn": "={{ $now.toFormat('yyyy-MM-dd')}}", + "valuesToSend": { + "values": [ + { + "column": "Datum", + "value": "={{ $now.toFormat('yyyy-MM-dd')}}" + }, + { + "column": "Fuellstand", + "value": "={{ $json.hopperdata[5].value }}" + }, + { + "column": "Pellets Verbrauch [kg]", + "value": "={{ $json.hopperdata[1].value }}" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.mySql", + "typeVersion": 2.4, + "position": [ + 0, + 576 + ], + "id": "25651cad-8917-4aff-a0e7-9aff0dd9352f", + "name": "MySQL", + "credentials": { + "mySql": { + "id": "GvOnFzLTFlbKtgUM", + "name": "MySQL account - homelab" + } + } + }, + { + "parameters": { + "url": "http://192.168.2.68:8093/v1/state/0_userdata.0.haus.heizung.pelletheizung.pellet_fuellstand_silo", + "sendQuery": true, + "queryParameters": { + "parameters": [ + { + "name": "value", + "value": "={{ $json.hopperdata[5].value }}" + } + ] + }, + "sendHeaders": true, + "headerParameters": { + "parameters": [ + { + "name": "value", + "value": "={{ $json.hopperdata[5].value }}" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.2, + "position": [ + 0, + 384 + ], + "id": "d365485b-573f-4a41-b139-81d64160cd58", + "name": "schreibe Füllstand Silo" + }, + { + "parameters": { + "url": "http://192.168.2.68:8093/v1/state/0_userdata.0.haus.heizung.pelletheizung.pellet_verbrauch_tag", + "sendQuery": true, + "queryParameters": { + "parameters": [ + { + "name": "value", + "value": "={{ $json.hopperdata[1].value }}" + } + ] + }, + "sendHeaders": true, + "headerParameters": { + "parameters": [ + { + "name": "value", + "value": "={{ $json.hopperdata[5].value }}" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.2, + "position": [ + 0, + 192 + ], + "id": "2111a02b-c534-4d47-85c2-0df590f91cb4", + "name": "schreibe Verbrauch 24h" + }, + { + "parameters": { + "rule": { + "interval": [ + { + "triggerAtHour": 23, + "triggerAtMinute": 59 + } + ] + } + }, + "type": "n8n-nodes-base.scheduleTrigger", + "typeVersion": 1.2, + "position": [ + -448, + 384 + ], + "id": "6aa9d692-e5c7-488e-a9cd-c9999852fa59", + "name": "Trigger 23:59" + }, + { + "parameters": { + "rule": { + "interval": [ + { + "field": "minutes", + "minutesInterval": 30 + } + ] + } + }, + "type": "n8n-nodes-base.scheduleTrigger", + "typeVersion": 1.2, + "position": [ + -448, + 192 + ], + "id": "9f19dd5b-d172-4668-9325-829f8278fdec", + "name": "Trigger 30 minutes" + }, + { + "parameters": { + "conditions": { + "options": { + "caseSensitive": true, + "leftValue": "", + "typeValidation": "loose", + "version": 2 + }, + "conditions": [ + { + "id": "b00d73a4-b3aa-496e-9730-fb3110944925", + "leftValue": "={{ $('HTTP Request').item.json.hopperdata[5].value }}", + "rightValue": 1000, + "operator": { + "type": "number", + "operation": "lt" + } + } + ], + "combinator": "and" + }, + "looseTypeValidation": true, + "options": {} + }, + "type": "n8n-nodes-base.if", + "typeVersion": 2.2, + "position": [ + 224, + 384 + ], + "id": "a091b1e3-bad8-4e2a-9fa5-3892fa8eb3d9", + "name": "If1" + }, + { + "parameters": { + "fromEmail": "pelletlager@scheidel.biz", + "toEmail": "michael.scheidel@scheidel.biz", + "subject": "=Es ist Zeit Pellets nachzubestellen. Stand: {{ $('HTTP Request').item.json.hopperdata[5].value }} kg", + "html": "=Der aktuelle Silostand liegt bei {{ $('HTTP Request').item.json.hopperdata[5].value }} kg. Es ist Zeit nachzubestllen", + "options": {} + }, + "type": "n8n-nodes-base.emailSend", + "typeVersion": 2.1, + "position": [ + 448, + 384 + ], + "id": "7f87bdc8-a659-401a-9d92-8751587aded2", + "name": "Send email", + "webhookId": "3ea799df-e2df-4291-a530-7534fd6edd34", + "credentials": { + "smtp": { + "id": "wgI3pOhkySCL5ngP", + "name": "SMTP account" + } + } + }, + { + "parameters": { + "url": "http://192.168.2.68:8093/v1/state/0_userdata.0.haus.heizung.pelletheizung.connection_status", + "sendQuery": true, + "queryParameters": { + "parameters": [ + { + "name": "value", + "value": "={{ $json.notconnected }}" + } + ] + }, + "sendHeaders": true, + "headerParameters": { + "parameters": [ + { + "name": "value", + "value": "={{ $json.notconnected }}" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.2, + "position": [ + 0, + 0 + ], + "id": "3859cbb8-e79d-4852-8dec-735d725e5c8e", + "name": "schreibe connection_staus" + }, + { + "parameters": { + "conditions": { + "options": { + "caseSensitive": true, + "leftValue": "", + "typeValidation": "loose", + "version": 2 + }, + "conditions": [ + { + "id": "d887854d-7feb-480e-8adc-d8352db92ef2", + "leftValue": "={{ $json.val }}", + "rightValue": 0, + "operator": { + "type": "number", + "operation": "notEquals" + } + } + ], + "combinator": "and" + }, + "looseTypeValidation": true, + "options": {} + }, + "type": "n8n-nodes-base.if", + "typeVersion": 2.2, + "position": [ + 224, + 0 + ], + "id": "4668bc29-c9f1-4820-980f-f0f999887da9", + "name": "If2" + }, + { + "parameters": { + "chatId": "749279624", + "text": "=Die Netzverbindung zur Heizung ist unterbrochen!", + "additionalFields": {} + }, + "type": "n8n-nodes-base.telegram", + "typeVersion": 1.2, + "position": [ + 448, + 0 + ], + "id": "741ca3bb-f78c-4027-ac72-4f9220b1bd91", + "name": "Telegram1", + "webhookId": "ddd87e24-21a8-4037-a549-8991f0c31d97", + "credentials": { + "telegramApi": { + "id": "EUy2hT71fSdnEr2w", + "name": "Telegram account" + } + } + } + ], + "pinData": {}, + "connections": { + "HTTP Request": { + "main": [ + [ + { + "node": "MySQL", + "type": "main", + "index": 0 + }, + { + "node": "schreibe Füllstand Silo", + "type": "main", + "index": 0 + }, + { + "node": "schreibe Verbrauch 24h", + "type": "main", + "index": 0 + }, + { + "node": "schreibe connection_staus", + "type": "main", + "index": 0 + } + ] + ] + }, + "MySQL": { + "main": [ + [ + { + "node": "Telegram", + "type": "main", + "index": 0 + } + ] + ] + }, + "schreibe Füllstand Silo": { + "main": [ + [ + { + "node": "If1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Trigger 23:59": { + "main": [ + [ + { + "node": "HTTP Request", + "type": "main", + "index": 0 + } + ] + ] + }, + "Trigger 30 minutes": { + "main": [ + [ + { + "node": "HTTP Request", + "type": "main", + "index": 0 + } + ] + ] + }, + "If1": { + "main": [ + [ + { + "node": "Send email", + "type": "main", + "index": 0 + } + ] + ] + }, + "schreibe connection_staus": { + "main": [ + [ + { + "node": "If2", + "type": "main", + "index": 0 + } + ] + ] + }, + "If2": { + "main": [ + [ + { + "node": "Telegram1", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "active": true, + "settings": { + "executionOrder": "v1" + }, + "versionId": "ef221069-21a2-4c44-b925-b20fb23cf4a4", + "meta": { + "templateCredsSetupCompleted": true, + "instanceId": "3cc6c4256e2bbdec1b3708c49dc3889c7266357f3e239651c157c2de760e6c65" + }, + "id": "t3q9pyWyzAdiHiyl", + "tags": [ + { + "updatedAt": "2025-12-20T19:56:59.512Z", + "createdAt": "2025-12-20T19:56:59.512Z", + "id": "9G8OthZJpXo6BPbV", + "name": "Smart Home" + } + ] +} \ No newline at end of file