Rauchmelder Beispiel mit Benachrichtigungen
Beschreibung:
Ein Rauchmelder Beispiel mit Stopp Benachrichtigung:
Es wurden zwei Rauchmelder definiert und jenachdem Weclher als erstes Auslöst gibt die Nachricht per TTS aus.
DIe States sind die Rauchmelder, diese triggern die Send Action Buttons, also die Nachricht die eingeblendet wird um den TTS wieder stoppen. Und sie setzten eine globale Variable mit dem Text des Rauchmelders.
Dann wird die abort false gesetzt. Dann gehts in die schleife die checkt ob abort true ist. Ist dies nicht der fall gehts an die nachricht sagen dann 10 sekunden warten und wieder zum check. solange bis auf dem button stopp gedrückt wurde.
Dann wird bort zu true und die schleife wird beendet.
Hier einmal der Komplette code als export:
[
{
"id": "33aa91b13f2ff68d",
"type": "tab",
"label": "Flow 5",
"disabled": false,
"info": "",
"env": []
},
{
"id": "f4a4c87d600c015a",
"type": "switch",
"z": "33aa91b13f2ff68d",
"name": "Check abort",
"property": "abort",
"propertyType": "global",
"rules": [
{
"t": "false"
},
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 870,
"y": 400,
"wires": [
[
"232277428e70aee4"
],
[
"2776727a1d4aac34"
]
]
},
{
"id": "8e2d783600670e8c",
"type": "api-call-service",
"z": "33aa91b13f2ff68d",
"name": "Send Actions Buttons",
"server": "0b5c0a092e06b662",
"version": 5,
"debugenabled": false,
"domain": "notify",
"service": "mobile_app_gm1913",
"areaId": [],
"deviceId": [],
"entityId": [],
"data": "{\"message\":\"Rauchmelder-Alarm! Bitte überprüfen!\",\"data\":{\"channel\":\"Alarm\",\"priority\":\"high\",\"ttl\":0,\"sticky\":true,\"persistent\":true,\"url\":null,\"clickAction\":\"noAction\",\"actions\":[{\"action\":\"SNOOZE\",\"title\":\"Rauchmelder Stoppen\"},{\"action\":\"IRGENDWAS\",\"title\":\"IRGENDWAS Stoppen\"}]}}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"x": 680,
"y": 80,
"wires": [
[]
]
},
{
"id": "5c1d1f8dbce67666",
"type": "delay",
"z": "33aa91b13f2ff68d",
"name": "",
"pauseType": "delay",
"timeout": "10",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "5",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 1330,
"y": 100,
"wires": [
[
"f4a4c87d600c015a"
]
]
},
{
"id": "232277428e70aee4",
"type": "api-call-service",
"z": "33aa91b13f2ff68d",
"name": "TTS Racuheraknnt auf dem Media Stream Alarm",
"server": "0b5c0a092e06b662",
"version": 5,
"debugenabled": true,
"domain": "notify",
"service": "mobile_app_gm1913",
"areaId": [],
"deviceId": [],
"entityId": [],
"data": "{\"message\":\"TTS\",\"data\":{\"priority\":\"high\",\"sticky\":true,\"persistent\":true,\"url\":null,\"clickAction\":\"noAction\",\"media_stream\":\"alarm_stream\",\"tts_text\":\"Rauch {{ global.rauchmeldertext }} erkannt\"}}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1000,
"y": 80,
"wires": [
[
"5c1d1f8dbce67666"
]
]
},
{
"id": "151f8a355756b7d7",
"type": "change",
"z": "33aa91b13f2ff68d",
"name": "Set abort faLSE",
"rules": [
{
"t": "set",
"p": "abort",
"pt": "global",
"to": "false",
"tot": "bool"
}
],
"x": 740,
"y": 460,
"wires": [
[
"f4a4c87d600c015a"
]
]
},
{
"id": "2776727a1d4aac34",
"type": "debug",
"z": "33aa91b13f2ff68d",
"name": "debug 8",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1260,
"y": 400,
"wires": []
},
{
"id": "c77a2963503c2a6e",
"type": "server-state-changed",
"z": "33aa91b13f2ff68d",
"name": "",
"server": "0b5c0a092e06b662",
"version": 4,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "binary_sensor.smoke_detected_1",
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "str",
"haltifstate": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 2,
"output_only_on_state_change": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 200,
"y": 60,
"wires": [
[
"8e2d783600670e8c",
"2f3dc346984c3bbd"
],
[]
]
},
{
"id": "2f3dc346984c3bbd",
"type": "change",
"z": "33aa91b13f2ff68d",
"name": "",
"rules": [
{
"t": "set",
"p": "rauchmeldertext",
"pt": "global",
"to": "Fahrradschuppen",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 240,
"y": 120,
"wires": [
[
"151f8a355756b7d7"
]
]
},
{
"id": "836de62531ac3c19",
"type": "server-state-changed",
"z": "33aa91b13f2ff68d",
"name": "",
"server": "0b5c0a092e06b662",
"version": 4,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "binary_sensor.smoke_detected_2",
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "str",
"haltifstate": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 2,
"output_only_on_state_change": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 180,
"y": 400,
"wires": [
[
"781bcb971dd68de7",
"8e2d783600670e8c"
],
[]
]
},
{
"id": "781bcb971dd68de7",
"type": "change",
"z": "33aa91b13f2ff68d",
"name": "",
"rules": [
{
"t": "set",
"p": "rauchmeldertext",
"pt": "global",
"to": "Wohnstube",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 460,
"y": 520,
"wires": [
[
"151f8a355756b7d7"
]
]
},
{
"id": "0b5c0a092e06b662",
"type": "server",
"name": "Home Assistant",
"version": 5,
"addon": true,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true,
"heartbeat": false,
"heartbeatInterval": "30",
"areaSelector": "friendlyName",
"deviceSelector": "friendlyName",
"entitySelector": "friendlyName",
"statusSeparator": ": ",
"statusYear": "hidden",
"statusMonth": "short",
"statusDay": "numeric",
"statusHourCycle": "default",
"statusTimeFormat": "h:m",
"enableGlobalContextStore": false
}
]
