Update flow files
This commit is contained in:
-412
@@ -22193,417 +22193,5 @@
|
|||||||
"output_location_type": "none",
|
"output_location_type": "none",
|
||||||
"x": 520,
|
"x": 520,
|
||||||
"y": 500
|
"y": 500
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ap_hdr_001",
|
|
||||||
"type": "comment",
|
|
||||||
"z": "1f4d4622.7490ca",
|
|
||||||
"name": "Air Purifier - Preset Mode Sync",
|
|
||||||
"wires": [],
|
|
||||||
"info": "",
|
|
||||||
"x": 150,
|
|
||||||
"y": 580
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ap_cmt_a_001",
|
|
||||||
"type": "comment",
|
|
||||||
"z": "1f4d4622.7490ca",
|
|
||||||
"name": "Flow A: Dashboard → Fan",
|
|
||||||
"wires": [],
|
|
||||||
"info": "",
|
|
||||||
"x": 130,
|
|
||||||
"y": 620
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ap_ssc_is_001",
|
|
||||||
"type": "server-state-changed",
|
|
||||||
"z": "1f4d4622.7490ca",
|
|
||||||
"name": "Air Purifier Mode (input_select)",
|
|
||||||
"wires": [
|
|
||||||
[
|
|
||||||
"ap_func_a_001"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"server": "657c7463.48e1e4",
|
|
||||||
"version": 6,
|
|
||||||
"outputs": 1,
|
|
||||||
"exposeAsEntityConfig": "",
|
|
||||||
"entities": {
|
|
||||||
"entity": [
|
|
||||||
"input_select.air_purifier_mode"
|
|
||||||
],
|
|
||||||
"substring": [],
|
|
||||||
"regex": []
|
|
||||||
},
|
|
||||||
"outputInitially": false,
|
|
||||||
"stateType": "str",
|
|
||||||
"ifState": "",
|
|
||||||
"ifStateType": "str",
|
|
||||||
"ifStateOperator": "is",
|
|
||||||
"outputOnlyOnStateChange": true,
|
|
||||||
"for": "0",
|
|
||||||
"forType": "num",
|
|
||||||
"forUnits": "minutes",
|
|
||||||
"ignorePrevStateNull": false,
|
|
||||||
"ignorePrevStateUnknown": false,
|
|
||||||
"ignorePrevStateUnavailable": false,
|
|
||||||
"ignoreCurrentStateUnknown": true,
|
|
||||||
"ignoreCurrentStateUnavailable": true,
|
|
||||||
"outputProperties": [
|
|
||||||
{
|
|
||||||
"property": "payload",
|
|
||||||
"propertyType": "msg",
|
|
||||||
"value": "",
|
|
||||||
"valueType": "entityState"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"property": "data",
|
|
||||||
"propertyType": "msg",
|
|
||||||
"value": "",
|
|
||||||
"valueType": "eventData"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"x": 150,
|
|
||||||
"y": 660
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ap_func_a_001",
|
|
||||||
"type": "function",
|
|
||||||
"z": "1f4d4622.7490ca",
|
|
||||||
"name": "Check/set flag",
|
|
||||||
"wires": [
|
|
||||||
[
|
|
||||||
"ap_slug_001"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"ap_acs_off_001"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"func": "if (flow.get('purifier_updating') === true) {\n return [null, null];\n}\nflow.set('purifier_updating', true);\nif (msg.payload === 'Off') {\n return [null, msg];\n}\nreturn [msg, null];",
|
|
||||||
"outputs": 2,
|
|
||||||
"timeout": 0,
|
|
||||||
"noerr": 0,
|
|
||||||
"initialize": "",
|
|
||||||
"finalize": "",
|
|
||||||
"libs": [],
|
|
||||||
"x": 390,
|
|
||||||
"y": 660
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ap_slug_001",
|
|
||||||
"type": "string",
|
|
||||||
"z": "1f4d4622.7490ca",
|
|
||||||
"name": "Slugify to preset ID",
|
|
||||||
"wires": [
|
|
||||||
[
|
|
||||||
"ap_acs_fan_001"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"methods": [
|
|
||||||
{
|
|
||||||
"name": "slugify",
|
|
||||||
"params": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "replaceAll",
|
|
||||||
"params": [
|
|
||||||
{
|
|
||||||
"type": "str",
|
|
||||||
"value": "-"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "str",
|
|
||||||
"value": "_"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"prop": "payload",
|
|
||||||
"propout": "payload",
|
|
||||||
"object": "msg",
|
|
||||||
"objectout": "msg",
|
|
||||||
"x": 610,
|
|
||||||
"y": 660
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ap_acs_fan_001",
|
|
||||||
"type": "api-call-service",
|
|
||||||
"z": "1f4d4622.7490ca",
|
|
||||||
"name": "Set fan preset mode",
|
|
||||||
"wires": [
|
|
||||||
[
|
|
||||||
"ap_dly_a_001"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"server": "657c7463.48e1e4",
|
|
||||||
"version": 7,
|
|
||||||
"debugenabled": false,
|
|
||||||
"action": "fan.set_preset_mode",
|
|
||||||
"floorId": [],
|
|
||||||
"areaId": [],
|
|
||||||
"deviceId": [],
|
|
||||||
"entityId": [
|
|
||||||
"fan.philips_ac2729_10"
|
|
||||||
],
|
|
||||||
"labelId": [],
|
|
||||||
"data": "{\"preset_mode\": msg.payload}",
|
|
||||||
"dataType": "jsonata",
|
|
||||||
"mergeContext": "",
|
|
||||||
"mustacheAltTags": false,
|
|
||||||
"outputProperties": [],
|
|
||||||
"queue": "all",
|
|
||||||
"blockInputOverrides": false,
|
|
||||||
"domain": "fan",
|
|
||||||
"service": "set_preset_mode",
|
|
||||||
"x": 850,
|
|
||||||
"y": 660
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ap_dly_a_001",
|
|
||||||
"type": "delay",
|
|
||||||
"z": "1f4d4622.7490ca",
|
|
||||||
"name": "Wait 1s",
|
|
||||||
"wires": [
|
|
||||||
[
|
|
||||||
"ap_rst_a_001"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"pauseType": "delay",
|
|
||||||
"timeout": "1",
|
|
||||||
"timeoutUnits": "seconds",
|
|
||||||
"rate": "1",
|
|
||||||
"nbRateUnits": "1",
|
|
||||||
"rateUnits": "second",
|
|
||||||
"randomFirst": "1",
|
|
||||||
"randomLast": "5",
|
|
||||||
"randomUnits": "seconds",
|
|
||||||
"drop": false,
|
|
||||||
"allowrate": false,
|
|
||||||
"outputs": 1,
|
|
||||||
"x": 1070,
|
|
||||||
"y": 660
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ap_rst_a_001",
|
|
||||||
"type": "change",
|
|
||||||
"z": "1f4d4622.7490ca",
|
|
||||||
"name": "Reset flag",
|
|
||||||
"wires": [
|
|
||||||
[]
|
|
||||||
],
|
|
||||||
"rules": [
|
|
||||||
{
|
|
||||||
"t": "set",
|
|
||||||
"p": "purifier_updating",
|
|
||||||
"pt": "flow",
|
|
||||||
"to": "false",
|
|
||||||
"tot": "bool"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "",
|
|
||||||
"property": "",
|
|
||||||
"from": "",
|
|
||||||
"to": "",
|
|
||||||
"reg": false,
|
|
||||||
"x": 1220,
|
|
||||||
"y": 660
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ap_cmt_b_001",
|
|
||||||
"type": "comment",
|
|
||||||
"z": "1f4d4622.7490ca",
|
|
||||||
"name": "Flow B: Fan → Dashboard",
|
|
||||||
"wires": [],
|
|
||||||
"info": "",
|
|
||||||
"x": 130,
|
|
||||||
"y": 780
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ap_ssc_fan_001",
|
|
||||||
"type": "server-state-changed",
|
|
||||||
"z": "1f4d4622.7490ca",
|
|
||||||
"name": "Air Purifier (fan)",
|
|
||||||
"wires": [
|
|
||||||
[
|
|
||||||
"ap_func_b_001"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"server": "657c7463.48e1e4",
|
|
||||||
"version": 6,
|
|
||||||
"outputs": 1,
|
|
||||||
"exposeAsEntityConfig": "",
|
|
||||||
"entities": {
|
|
||||||
"entity": [
|
|
||||||
"fan.philips_ac2729_10"
|
|
||||||
],
|
|
||||||
"substring": [],
|
|
||||||
"regex": []
|
|
||||||
},
|
|
||||||
"outputInitially": false,
|
|
||||||
"stateType": "str",
|
|
||||||
"ifState": "",
|
|
||||||
"ifStateType": "str",
|
|
||||||
"ifStateOperator": "is",
|
|
||||||
"outputOnlyOnStateChange": false,
|
|
||||||
"for": "0",
|
|
||||||
"forType": "num",
|
|
||||||
"forUnits": "minutes",
|
|
||||||
"ignorePrevStateNull": false,
|
|
||||||
"ignorePrevStateUnknown": false,
|
|
||||||
"ignorePrevStateUnavailable": false,
|
|
||||||
"ignoreCurrentStateUnknown": true,
|
|
||||||
"ignoreCurrentStateUnavailable": true,
|
|
||||||
"outputProperties": [
|
|
||||||
{
|
|
||||||
"property": "payload",
|
|
||||||
"propertyType": "msg",
|
|
||||||
"value": "",
|
|
||||||
"valueType": "entityState"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"property": "data",
|
|
||||||
"propertyType": "msg",
|
|
||||||
"value": "",
|
|
||||||
"valueType": "eventData"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"x": 100,
|
|
||||||
"y": 820
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ap_func_b_001",
|
|
||||||
"type": "function",
|
|
||||||
"z": "1f4d4622.7490ca",
|
|
||||||
"name": "Check flag + transform",
|
|
||||||
"wires": [
|
|
||||||
[
|
|
||||||
"ap_acs_is_001"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"func": "const newState = msg.payload;\nconst newPreset = msg.data.new_state.attributes.preset_mode;\nconst oldPreset = msg.data.old_state ? msg.data.old_state.attributes.preset_mode : null;\nconst oldState = msg.data.old_state ? msg.data.old_state.state : null;\n\nif (flow.get('purifier_updating') === true) return null;\n\nif (newState === 'off') {\n if (oldState === 'off') return null;\n flow.set('purifier_updating', true);\n msg.payload = 'Off';\n return msg;\n}\n\nif (newPreset === oldPreset) return null;\nflow.set('purifier_updating', true);\nmsg.payload = newPreset.split('_').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ');\nreturn msg;",
|
|
||||||
"outputs": 1,
|
|
||||||
"timeout": 0,
|
|
||||||
"noerr": 0,
|
|
||||||
"initialize": "",
|
|
||||||
"finalize": "",
|
|
||||||
"libs": [],
|
|
||||||
"x": 390,
|
|
||||||
"y": 820
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ap_acs_is_001",
|
|
||||||
"type": "api-call-service",
|
|
||||||
"z": "1f4d4622.7490ca",
|
|
||||||
"name": "Update input_select",
|
|
||||||
"wires": [
|
|
||||||
[
|
|
||||||
"ap_dly_b_001"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"server": "657c7463.48e1e4",
|
|
||||||
"version": 7,
|
|
||||||
"debugenabled": false,
|
|
||||||
"action": "input_select.select_option",
|
|
||||||
"floorId": [],
|
|
||||||
"areaId": [],
|
|
||||||
"deviceId": [],
|
|
||||||
"entityId": [
|
|
||||||
"input_select.air_purifier_mode"
|
|
||||||
],
|
|
||||||
"labelId": [],
|
|
||||||
"data": "{\"option\": msg.payload}",
|
|
||||||
"dataType": "jsonata",
|
|
||||||
"mergeContext": "",
|
|
||||||
"mustacheAltTags": false,
|
|
||||||
"outputProperties": [],
|
|
||||||
"queue": "all",
|
|
||||||
"blockInputOverrides": false,
|
|
||||||
"domain": "input_select",
|
|
||||||
"service": "select_option",
|
|
||||||
"x": 630,
|
|
||||||
"y": 820
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ap_dly_b_001",
|
|
||||||
"type": "delay",
|
|
||||||
"z": "1f4d4622.7490ca",
|
|
||||||
"name": "Wait 1s",
|
|
||||||
"wires": [
|
|
||||||
[
|
|
||||||
"ap_rst_b_001"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"pauseType": "delay",
|
|
||||||
"timeout": "1",
|
|
||||||
"timeoutUnits": "seconds",
|
|
||||||
"rate": "1",
|
|
||||||
"nbRateUnits": "1",
|
|
||||||
"rateUnits": "second",
|
|
||||||
"randomFirst": "1",
|
|
||||||
"randomLast": "5",
|
|
||||||
"randomUnits": "seconds",
|
|
||||||
"drop": false,
|
|
||||||
"allowrate": false,
|
|
||||||
"outputs": 1,
|
|
||||||
"x": 850,
|
|
||||||
"y": 820
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ap_rst_b_001",
|
|
||||||
"type": "change",
|
|
||||||
"z": "1f4d4622.7490ca",
|
|
||||||
"name": "Reset flag",
|
|
||||||
"wires": [
|
|
||||||
[]
|
|
||||||
],
|
|
||||||
"rules": [
|
|
||||||
{
|
|
||||||
"t": "set",
|
|
||||||
"p": "purifier_updating",
|
|
||||||
"pt": "flow",
|
|
||||||
"to": "false",
|
|
||||||
"tot": "bool"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "",
|
|
||||||
"property": "",
|
|
||||||
"from": "",
|
|
||||||
"to": "",
|
|
||||||
"reg": false,
|
|
||||||
"x": 1070,
|
|
||||||
"y": 820
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ap_acs_off_001",
|
|
||||||
"type": "api-call-service",
|
|
||||||
"z": "1f4d4622.7490ca",
|
|
||||||
"name": "Turn off purifier",
|
|
||||||
"wires": [
|
|
||||||
[
|
|
||||||
"ap_dly_a_001"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"server": "657c7463.48e1e4",
|
|
||||||
"version": 7,
|
|
||||||
"debugenabled": false,
|
|
||||||
"action": "fan.turn_off",
|
|
||||||
"floorId": [],
|
|
||||||
"areaId": [],
|
|
||||||
"deviceId": [],
|
|
||||||
"entityId": [
|
|
||||||
"fan.philips_ac2729_10"
|
|
||||||
],
|
|
||||||
"labelId": [],
|
|
||||||
"data": "",
|
|
||||||
"dataType": "jsonata",
|
|
||||||
"mergeContext": "",
|
|
||||||
"mustacheAltTags": false,
|
|
||||||
"outputProperties": [],
|
|
||||||
"queue": "all",
|
|
||||||
"blockInputOverrides": false,
|
|
||||||
"domain": "fan",
|
|
||||||
"service": "turn_off",
|
|
||||||
"x": 850,
|
|
||||||
"y": 720
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
Reference in New Issue
Block a user