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 über überpüfe Tab bzw dem danachfolgendem Switch (werte aus) und wenn das passt, dann durch ein change das abort abort false zu true und die schleife wird beendet.
Tipp, wenn auf verschiednenen Geräten Buttons Ausgewertet werden sollen, die in verschiedenen Flows drin sind.
Macht es sinn die Werte der Buttons unique für jedes Gerät zu machen. Sprich beim Send button den Button unique definieren und beim Auswerten diesen wieder zu nehmen.
Bei den anderen Flows würde man dann andere namen nehmen.
fertig
Hier einmal der Komplette code als export:
[
{
"id": "72f8bbccc156abc9",
"type": "tab",
"label": "Flow 78",
"disabled": false,
"info": "",
"env": []
},
{
"id": "fd846045ce203fdb",
"type": "switch",
"z": "72f8bbccc156abc9",
"name": "Check abort",
"property": "abort",
"propertyType": "global",
"rules": [
{
"t": "false"
},
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1110,
"y": 380,
"wires": [
[
"b2b1641da0ae4e50"
],
[
"4189cd5f02c60a22",
"75cb06568f31df0d"
]
]
},
{
"id": "bd0cc484a47ac218",
"type": "api-call-service",
"z": "72f8bbccc156abc9",
"name": "Send Actions Buttons",
"server": "0b5c0a092e06b662",
"version": 5,
"debugenabled": true,
"domain": "notify",
"service": "mobile_app_gm1913",
"areaId": [],
"deviceId": [],
"entityId": [],
"data": "{\"message\":\"Rauchmelder-Alarm! Bitte überprüfen!\",\"data\":{\"channel\":\"alarm_stream_max\",\"priority\":\"high\",\"ttl\":0,\"sticky\":true,\"persistent\":true,\"importance\":\"high\",\"tag\":\"{{ global.message_tag }}\",\"presentation_options\":\"alert\",\"url\":null,\"clickAction\":\"noAction\",\"actions\":[{\"action\":\"SNOOZE_SMARTPHONE_STEFAN\",\"title\":\"Rauchmelder Stoppen\"}]}}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"x": 940,
"y": 40,
"wires": [
[]
]
},
{
"id": "7a2df04207532b6e",
"type": "delay",
"z": "72f8bbccc156abc9",
"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": 1590,
"y": 180,
"wires": [
[
"fd846045ce203fdb"
]
]
},
{
"id": "b2b1641da0ae4e50",
"type": "api-call-service",
"z": "72f8bbccc156abc9",
"name": "TTS Raucherkannt 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\",\"media_stream\":\"alarm_stream\",\"tts_text\":\"Rauch {{ global.rauchmeldertext }} erkannt\"}}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 1360,
"y": 40,
"wires": [
[
"7a2df04207532b6e"
]
]
},
{
"id": "20fc249d39285d23",
"type": "change",
"z": "72f8bbccc156abc9",
"name": "Set abort faLSE",
"rules": [
{
"t": "set",
"p": "abort",
"pt": "global",
"to": "false",
"tot": "bool"
}
],
"x": 980,
"y": 240,
"wires": [
[
"fd846045ce203fdb"
]
]
},
{
"id": "4189cd5f02c60a22",
"type": "debug",
"z": "72f8bbccc156abc9",
"name": "debug 8",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1480,
"y": 380,
"wires": []
},
{
"id": "4c344c4831e5fcac",
"type": "server-state-changed",
"z": "72f8bbccc156abc9",
"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": 240,
"y": 200,
"wires": [
[
"41e0d6ee2b5907b9",
"650bd1c892f800a0"
],
[]
]
},
{
"id": "41e0d6ee2b5907b9",
"type": "change",
"z": "72f8bbccc156abc9",
"name": "",
"rules": [
{
"t": "set",
"p": "rauchmeldertext",
"pt": "global",
"to": "Fahrradschuppen",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 680,
"y": 240,
"wires": [
[
"20fc249d39285d23"
]
]
},
{
"id": "4dcffc1f5cb9e580",
"type": "server-state-changed",
"z": "72f8bbccc156abc9",
"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": 200,
"y": 440,
"wires": [
[
"15bcfcc2b81baf03",
"650bd1c892f800a0"
],
[]
]
},
{
"id": "15bcfcc2b81baf03",
"type": "change",
"z": "72f8bbccc156abc9",
"name": "",
"rules": [
{
"t": "set",
"p": "rauchmeldertext",
"pt": "global",
"to": "Wohnstube",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 680,
"y": 440,
"wires": [
[
"20fc249d39285d23"
]
]
},
{
"id": "75cb06568f31df0d",
"type": "api-call-service",
"z": "72f8bbccc156abc9",
"name": "Clear Actions Buttons",
"server": "0b5c0a092e06b662",
"version": 5,
"debugenabled": false,
"domain": "notify",
"service": "mobile_app_gm1913",
"areaId": [],
"deviceId": [],
"entityId": [],
"data": "{\"message\":\"clear_notification\",\"data\":{\"tag\":\"{{ global.message_tag }}\"}}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"x": 1520,
"y": 460,
"wires": [
[]
]
},
{
"id": "47d0e3399b240284",
"type": "inject",
"z": "72f8bbccc156abc9",
"name": "manuell starten",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 160,
"y": 140,
"wires": [
[
"41e0d6ee2b5907b9",
"650bd1c892f800a0"
]
]
},
{
"id": "faf2cf47f8a2e467",
"type": "inject",
"z": "72f8bbccc156abc9",
"name": "manuell starten",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 380,
"wires": [
[
"15bcfcc2b81baf03",
"650bd1c892f800a0"
]
]
},
{
"id": "650bd1c892f800a0",
"type": "change",
"z": "72f8bbccc156abc9",
"name": "",
"rules": [
{
"t": "set",
"p": "message_tag",
"pt": "global",
"to": "benachrichtung_stefan",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 690,
"y": 40,
"wires": [
[
"bd0cc484a47ac218"
]
]
},
{
"id": "f5e75181e7417fe2",
"type": "change",
"z": "72f8bbccc156abc9",
"name": "Set abort true",
"rules": [
{
"t": "set",
"p": "abort",
"pt": "global",
"to": "true",
"tot": "bool"
}
],
"x": 800,
"y": 600,
"wires": [
[]
]
},
{
"id": "8f5bb3abc51be77f",
"type": "server-events",
"z": "72f8bbccc156abc9",
"name": "überpüfe tap",
"server": "0b5c0a092e06b662",
"version": 2,
"eventType": "mobile_app_notification_action",
"exposeToHomeAssistant": false,
"eventData": "",
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"waitForRunning": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
}
],
"event_type": "",
"x": 90,
"y": 600,
"wires": [
[
"765be5afb170835b",
"24ebd151429c0ffb"
]
]
},
{
"id": "765be5afb170835b",
"type": "switch",
"z": "72f8bbccc156abc9",
"name": "werte aus",
"property": "payload.event.action",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "SNOOZE_SMARTPHONE_STEFAN",
"vt": "str"
},
{
"t": "eq",
"v": "IRGENDWAS",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 420,
"y": 600,
"wires": [
[
"f5e75181e7417fe2",
"14956e7bf6034ba7"
],
[]
]
},
{
"id": "24ebd151429c0ffb",
"type": "debug",
"z": "72f8bbccc156abc9",
"name": "debug 10",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 420,
"y": 520,
"wires": []
},
{
"id": "14956e7bf6034ba7",
"type": "debug",
"z": "72f8bbccc156abc9",
"name": "debug 11",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload.event.action",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 660,
"y": 720,
"wires": []
},
{
"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
}
]


