Update flow files
This commit is contained in:
-447
@@ -54,11 +54,6 @@
|
||||
"type": "tab",
|
||||
"label": "Maintenance"
|
||||
},
|
||||
{
|
||||
"id": "752771ce8fd82a19",
|
||||
"type": "tab",
|
||||
"label": "Claude Test"
|
||||
},
|
||||
{
|
||||
"id": "97e0f1338e182d76",
|
||||
"type": "tab",
|
||||
@@ -10644,448 +10639,6 @@
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "tst0000000000001",
|
||||
"type": "comment",
|
||||
"z": "752771ce8fd82a19",
|
||||
"name": "Livingroom tapdial - proportional dimming (Option B)",
|
||||
"info": "Triggers on brightness_step_up/down (legacy action) which carries action_step_size in the same MQTT publish. Scales brightness by step_size/3 for proportional feel.",
|
||||
"x": 200,
|
||||
"y": 40,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "tst0000000000002",
|
||||
"type": "server-state-changed",
|
||||
"z": "752771ce8fd82a19",
|
||||
"name": "Hue - Living room tapdial",
|
||||
"server": "657c7463.48e1e4",
|
||||
"version": 6,
|
||||
"outputs": 1,
|
||||
"exposeAsEntityConfig": "",
|
||||
"entities": {
|
||||
"entity": [
|
||||
"sensor.livingroom_tapdial_action"
|
||||
],
|
||||
"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": "dial_motion",
|
||||
"propertyType": "msg",
|
||||
"value": "string",
|
||||
"valueType": "entityState"
|
||||
},
|
||||
{
|
||||
"property": "dial_step_size",
|
||||
"propertyType": "msg",
|
||||
"value": "string",
|
||||
"valueType": "entityState"
|
||||
}
|
||||
],
|
||||
"x": 160,
|
||||
"y": 100,
|
||||
"wires": [
|
||||
[
|
||||
"tst0000000000003"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "tst0000000000003",
|
||||
"type": "switch",
|
||||
"z": "752771ce8fd82a19",
|
||||
"name": "Filter: brightness step",
|
||||
"property": "dial_motion",
|
||||
"propertyType": "msg",
|
||||
"rules": [
|
||||
{
|
||||
"t": "eq",
|
||||
"v": "brightness_step_up",
|
||||
"vt": "str"
|
||||
},
|
||||
{
|
||||
"t": "eq",
|
||||
"v": "brightness_step_down",
|
||||
"vt": "str"
|
||||
}
|
||||
],
|
||||
"checkall": "false",
|
||||
"repair": false,
|
||||
"outputs": 2,
|
||||
"x": 420,
|
||||
"y": 100,
|
||||
"wires": [
|
||||
[
|
||||
"tst0000000000004"
|
||||
],
|
||||
[
|
||||
"tst0000000000004"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "tst0000000000004",
|
||||
"type": "api-current-state",
|
||||
"z": "752771ce8fd82a19",
|
||||
"name": "Music control on?",
|
||||
"server": "657c7463.48e1e4",
|
||||
"version": 3,
|
||||
"outputs": 2,
|
||||
"halt_if": "on",
|
||||
"halt_if_type": "str",
|
||||
"halt_if_compare": "is",
|
||||
"entity_id": "input_boolean.livingroom_music_control",
|
||||
"state_type": "str",
|
||||
"blockInputOverrides": true,
|
||||
"outputProperties": [],
|
||||
"for": "0",
|
||||
"forType": "num",
|
||||
"forUnits": "minutes",
|
||||
"override_topic": false,
|
||||
"state_location": "payload",
|
||||
"override_payload": "msg",
|
||||
"entity_location": "data",
|
||||
"override_data": "msg",
|
||||
"x": 680,
|
||||
"y": 100,
|
||||
"wires": [
|
||||
[
|
||||
"tst0000000000005"
|
||||
],
|
||||
[
|
||||
"tst0000000000009"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "tst0000000000005",
|
||||
"type": "api-current-state",
|
||||
"z": "752771ce8fd82a19",
|
||||
"name": "Get current volume",
|
||||
"server": "657c7463.48e1e4",
|
||||
"version": 3,
|
||||
"outputs": 2,
|
||||
"halt_if": "playing",
|
||||
"halt_if_type": "str",
|
||||
"halt_if_compare": "is",
|
||||
"entity_id": "media_player.home_theater_universal",
|
||||
"state_type": "str",
|
||||
"blockInputOverrides": true,
|
||||
"outputProperties": [
|
||||
{
|
||||
"property": "entity",
|
||||
"propertyType": "msg",
|
||||
"value": "",
|
||||
"valueType": "entity"
|
||||
}
|
||||
],
|
||||
"for": "0",
|
||||
"forType": "num",
|
||||
"forUnits": "minutes",
|
||||
"override_topic": false,
|
||||
"state_location": "payload",
|
||||
"override_payload": "msg",
|
||||
"entity_location": "data",
|
||||
"override_data": "msg",
|
||||
"x": 940,
|
||||
"y": 60,
|
||||
"wires": [
|
||||
[
|
||||
"tst0000000000006"
|
||||
],
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "tst0000000000006",
|
||||
"type": "change",
|
||||
"z": "752771ce8fd82a19",
|
||||
"name": "Store current volume",
|
||||
"rules": [
|
||||
{
|
||||
"t": "set",
|
||||
"p": "current_volume",
|
||||
"pt": "msg",
|
||||
"to": "entity.attributes.volume_level",
|
||||
"tot": "msg"
|
||||
},
|
||||
{
|
||||
"t": "delete",
|
||||
"p": "entity",
|
||||
"pt": "msg"
|
||||
}
|
||||
],
|
||||
"action": "",
|
||||
"property": "",
|
||||
"from": "",
|
||||
"to": "",
|
||||
"reg": false,
|
||||
"x": 1200,
|
||||
"y": 60,
|
||||
"wires": [
|
||||
[
|
||||
"tst0000000000007"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "tst0000000000007",
|
||||
"type": "function",
|
||||
"z": "752771ce8fd82a19",
|
||||
"name": "Calculate new volume",
|
||||
"func": "const action = msg.dial_motion;\nconst direction = action === 'brightness_step_up' ? 1 : -1;\nconst stepSize = Number(msg.dial_step_size) || 30;\nconst modifier = Math.round(stepSize / 3) / 255 * 0.2;\nconst raw = (msg.current_volume || 0) + direction * modifier;\nmsg.payload = Math.round(Math.max(0, Math.min(1, raw)) * 100) / 100;\nreturn msg;",
|
||||
"outputs": 1,
|
||||
"timeout": "",
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 1460,
|
||||
"y": 60,
|
||||
"wires": [
|
||||
[
|
||||
"tst0000000000008"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "tst0000000000008",
|
||||
"type": "api-call-service",
|
||||
"z": "752771ce8fd82a19",
|
||||
"name": "Set Volume",
|
||||
"server": "657c7463.48e1e4",
|
||||
"version": 7,
|
||||
"debugenabled": true,
|
||||
"action": "media_player.volume_set",
|
||||
"floorId": [],
|
||||
"areaId": [],
|
||||
"deviceId": [],
|
||||
"entityId": [
|
||||
"media_player.home_theater_universal"
|
||||
],
|
||||
"labelId": [],
|
||||
"data": "{\"volume_level\": {{{ payload }}} }",
|
||||
"dataType": "json",
|
||||
"mergeContext": "",
|
||||
"mustacheAltTags": false,
|
||||
"outputProperties": [],
|
||||
"queue": "none",
|
||||
"blockInputOverrides": false,
|
||||
"domain": "media_player",
|
||||
"service": "volume_set",
|
||||
"x": 1710,
|
||||
"y": 60,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "tst0000000000009",
|
||||
"type": "function",
|
||||
"z": "752771ce8fd82a19",
|
||||
"name": "Calculate brightness step",
|
||||
"func": "const action = msg.dial_motion;\nconst direction = action === 'brightness_step_up' ? 1 : -1;\nconst stepSize = Number(msg.dial_step_size) || 30;\nmsg.service_payload = {\n brightness_step: direction * Math.round(stepSize / 3),\n transition: 0.1\n};\nflow.set('latestServicePayload', msg.service_payload);\nreturn msg;",
|
||||
"outputs": 1,
|
||||
"timeout": "",
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 940,
|
||||
"y": 160,
|
||||
"wires": [
|
||||
[
|
||||
"tst000000000000e",
|
||||
"tst000000000000a"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "tst000000000000e",
|
||||
"type": "debug",
|
||||
"z": "752771ce8fd82a19",
|
||||
"name": "Step debug",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
"console": false,
|
||||
"tostatus": false,
|
||||
"complete": "true",
|
||||
"targetType": "full",
|
||||
"statusVal": "",
|
||||
"statusType": "auto",
|
||||
"x": 940,
|
||||
"y": 240,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "tst000000000000a",
|
||||
"type": "function",
|
||||
"z": "752771ce8fd82a19",
|
||||
"name": "Compute & fan out brightness",
|
||||
"func": "const action = msg.dial_motion;\nconst direction = action === 'brightness_step_up' ? 1 : -1;\nconst rawStep = Number(msg.dial_step_size) || 30;\nconst step = direction * rawStep;\n\nconst lights = [\n 'light.living_room_bookshelf',\n 'light.living_room_main',\n 'light.living_room_top_of_bar',\n 'light.living_room_dining_table'\n];\n\nconst haStates = global.get('homeassistant')?.homeAssistantLatest?.states || {};\n\nconst now = Date.now();\nif (now - (flow.get('lastDial') || 0) > 10 * 60 * 1000) {\n lights.forEach(id => flow.set('brt_' + id.replace(/[^a-z0-9]/g, '_'), null));\n}\nflow.set('lastDial', now);\n\nreturn lights.map(id => {\n if (haStates[id]?.state !== 'on') return null;\n const key = 'brt_' + id.replace(/[^a-z0-9]/g, '_');\n let brt = flow.get(key);\n if (brt == null) brt = haStates[id]?.attributes?.brightness || 128;\n brt = Math.max(1, Math.min(255, brt + step));\n flow.set(key, brt);\n return { brightness: Math.round(brt) };\n});",
|
||||
"outputs": 4,
|
||||
"timeout": "",
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 1230,
|
||||
"y": 160,
|
||||
"wires": [
|
||||
[
|
||||
"tst000000000000d"
|
||||
],
|
||||
[
|
||||
"dim_main_001"
|
||||
],
|
||||
[
|
||||
"dim_bar_001"
|
||||
],
|
||||
[
|
||||
"dim_dining_001"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "tst000000000000d",
|
||||
"type": "api-call-service",
|
||||
"z": "752771ce8fd82a19",
|
||||
"name": "Dim bookshelf",
|
||||
"server": "657c7463.48e1e4",
|
||||
"version": 7,
|
||||
"debugenabled": true,
|
||||
"action": "light.turn_on",
|
||||
"floorId": [],
|
||||
"areaId": [],
|
||||
"deviceId": [],
|
||||
"entityId": [
|
||||
"light.living_room_bookshelf"
|
||||
],
|
||||
"labelId": [],
|
||||
"data": "{\"brightness\": {{{brightness}}}, \"transition\": 0.3}",
|
||||
"dataType": "json",
|
||||
"mergeContext": "",
|
||||
"mustacheAltTags": false,
|
||||
"outputProperties": [],
|
||||
"queue": "all",
|
||||
"blockInputOverrides": true,
|
||||
"domain": "light",
|
||||
"service": "turn_on",
|
||||
"x": 2240,
|
||||
"y": 160,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "dim_main_001",
|
||||
"type": "api-call-service",
|
||||
"z": "752771ce8fd82a19",
|
||||
"name": "Dim ceiling (main)",
|
||||
"server": "657c7463.48e1e4",
|
||||
"version": 7,
|
||||
"debugenabled": false,
|
||||
"action": "light.turn_on",
|
||||
"floorId": [],
|
||||
"areaId": [],
|
||||
"deviceId": [],
|
||||
"entityId": [
|
||||
"light.living_room_main"
|
||||
],
|
||||
"labelId": [],
|
||||
"data": "{\"brightness\": {{{brightness}}}, \"transition\": 0.3}",
|
||||
"dataType": "json",
|
||||
"mergeContext": "",
|
||||
"mustacheAltTags": false,
|
||||
"outputProperties": [],
|
||||
"queue": "all",
|
||||
"blockInputOverrides": true,
|
||||
"domain": "light",
|
||||
"service": "turn_on",
|
||||
"x": 2240,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "dim_bar_001",
|
||||
"type": "api-call-service",
|
||||
"z": "752771ce8fd82a19",
|
||||
"name": "Dim top of bar",
|
||||
"server": "657c7463.48e1e4",
|
||||
"version": 7,
|
||||
"debugenabled": false,
|
||||
"action": "light.turn_on",
|
||||
"floorId": [],
|
||||
"areaId": [],
|
||||
"deviceId": [],
|
||||
"entityId": [
|
||||
"light.living_room_top_of_bar"
|
||||
],
|
||||
"labelId": [],
|
||||
"data": "{\"brightness\": {{{brightness}}}, \"transition\": 0.3}",
|
||||
"dataType": "json",
|
||||
"mergeContext": "",
|
||||
"mustacheAltTags": false,
|
||||
"outputProperties": [],
|
||||
"queue": "all",
|
||||
"blockInputOverrides": true,
|
||||
"domain": "light",
|
||||
"service": "turn_on",
|
||||
"x": 2240,
|
||||
"y": 280,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "dim_dining_001",
|
||||
"type": "api-call-service",
|
||||
"z": "752771ce8fd82a19",
|
||||
"name": "Dim dining table",
|
||||
"server": "657c7463.48e1e4",
|
||||
"version": 7,
|
||||
"debugenabled": false,
|
||||
"action": "light.turn_on",
|
||||
"floorId": [],
|
||||
"areaId": [],
|
||||
"deviceId": [],
|
||||
"entityId": [
|
||||
"light.living_room_dining_table"
|
||||
],
|
||||
"labelId": [],
|
||||
"data": "{\"brightness\": {{{brightness}}}, \"transition\": 0.3}",
|
||||
"dataType": "json",
|
||||
"mergeContext": "",
|
||||
"mustacheAltTags": false,
|
||||
"outputProperties": [],
|
||||
"queue": "all",
|
||||
"blockInputOverrides": true,
|
||||
"domain": "light",
|
||||
"service": "turn_on",
|
||||
"x": 2240,
|
||||
"y": 340,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "d46b0ef0ec904159",
|
||||
"type": "server-state-changed",
|
||||
|
||||
Reference in New Issue
Block a user