Is there a smarter way?

Hi All,
I am fairly new to node-red and have made a flow for controlling my Xbox, AV Receiver, Projector and Lights in my Media Room. The goal is to ask Alexa to either just enable Gaming Mode which just turns everything on or turn on a specific game which turns everything on, if its not already, and then start the game. I have the flow working but there’s a lot of spaghetti so I’m wondering if there is a smarter way to achieve this.

[
    {
        "id": "9879bffe.2be56",
        "type": "tab",
        "label": "Media Room",
        "disabled": false,
        "info": ""
    },
    {
        "id": "d39dc354.49feb",
        "type": "link in",
        "z": "9879bffe.2be56",
        "name": "Alexa In",
        "links": [
            "dff1328c.941a6"
        ],
        "x": 65,
        "y": 100,
        "wires": [
            [
                "3ae81e9840f3b68f",
                "38663ed8401afb54",
                "65eb907a374594de"
            ]
        ]
    },
    {
        "id": "dc72ed9d.68814",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Turn on Projector",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "remote",
        "service": "send_command",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "remote.media_room_remote"
        ],
        "data": "{\"command\":\"turn_on\",\"device\":\"media_room_projector\"}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1170,
        "y": 100,
        "wires": [
            []
        ]
    },
    {
        "id": "97daa3c2.0dc6d",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Turn on AV",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "remote",
        "service": "send_command",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "remote.media_room_remote"
        ],
        "data": "{\"command\":\"power\",\"device\":\"media_room_av\"}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1150,
        "y": 160,
        "wires": [
            [
                "ea44579f.9d1db8"
            ]
        ]
    },
    {
        "id": "ea44579f.9d1db8",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Set Input to Game",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "remote",
        "service": "send_command",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "remote.media_room_remote"
        ],
        "data": "{\"command\":\"game\",\"device\":\"media_room_av\"}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1370,
        "y": 160,
        "wires": [
            [
                "2e956646.e5ff3a"
            ]
        ]
    },
    {
        "id": "2e956646.e5ff3a",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Mute AV",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "remote",
        "service": "send_command",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "remote.media_room_remote"
        ],
        "data": "{\"command\":\"mute\",\"device\":\"media_room_av\"}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1580,
        "y": 160,
        "wires": [
            []
        ]
    },
    {
        "id": "5adaed27.ce4a74",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Turn on Rear Light - 10%",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "light",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "light.media_room_back_light"
        ],
        "data": "{\"brightness_pct\":\"10\"}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1190,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "ba2c5358.51ac6",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Turn off Front Light",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "light",
        "service": "turn_off",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "light.media_room_front_light"
        ],
        "data": "",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1170,
        "y": 280,
        "wires": [
            []
        ]
    },
    {
        "id": "1520f6f2.34af79",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Gaming Mode Enabled",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "notify",
        "service": "alexa_media",
        "areaId": [],
        "deviceId": [],
        "entityId": [],
        "data": "{\"target\":\"media_player.media_room_echo_dot\",\"message\":\"Gaming Mode Enabled!\",\"data\":{\"type\":\"tts\"}}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1180,
        "y": 400,
        "wires": [
            []
        ]
    },
    {
        "id": "3bb3454244c77d13",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Turn off Projector",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "remote",
        "service": "send_command",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "remote.media_room_remote"
        ],
        "data": "{\"command\":\"turn_off\",\"device\":\"media_room_projector\",\"num_repeats\":\"2\",\"delay_secs\":\"2\"}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1170,
        "y": 520,
        "wires": [
            []
        ]
    },
    {
        "id": "8936a5cadd4b229c",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Turn off Media Room Lights",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "light",
        "service": "turn_off",
        "areaId": [
            "ce6faed16c5646febd6fbfb209c0063b"
        ],
        "deviceId": [],
        "entityId": [],
        "data": "",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1200,
        "y": 580,
        "wires": [
            []
        ]
    },
    {
        "id": "3ae81e9840f3b68f",
        "type": "amazon-echo-device",
        "z": "9879bffe.2be56",
        "name": "Gaming Mode",
        "topic": "",
        "x": 240,
        "y": 100,
        "wires": [
            [
                "195993283e1176f5"
            ]
        ]
    },
    {
        "id": "195993283e1176f5",
        "type": "switch",
        "z": "9879bffe.2be56",
        "name": "Gaming Mode",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "on",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "off",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 520,
        "y": 100,
        "wires": [
            [
                "dc72ed9d.68814",
                "97daa3c2.0dc6d",
                "5adaed27.ce4a74",
                "ba2c5358.51ac6",
                "1520f6f2.34af79",
                "10f16f029c479329"
            ],
            [
                "3bb3454244c77d13",
                "8936a5cadd4b229c",
                "23e2cec2c810d949",
                "4782b243acc7822e"
            ]
        ]
    },
    {
        "id": "23e2cec2c810d949",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Gaming Mode Disabled",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "notify",
        "service": "alexa_media",
        "areaId": [],
        "deviceId": [],
        "entityId": [],
        "data": "{\"target\":\"media_player.media_room_echo_dot\",\"message\":\"Gaming Mode Disabled!\",\"data\":{\"type\":\"tts\"}}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1190,
        "y": 640,
        "wires": [
            []
        ]
    },
    {
        "id": "10f16f029c479329",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Turn on Xbox",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "media_player",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [
            "c3a53f9c81ee8d6804dde3c8048e9ecf"
        ],
        "entityId": [],
        "data": "",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1160,
        "y": 340,
        "wires": [
            []
        ]
    },
    {
        "id": "4782b243acc7822e",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Turn off Xbox",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": true,
        "domain": "media_player",
        "service": "turn_off",
        "areaId": [],
        "deviceId": [
            "c3a53f9c81ee8d6804dde3c8048e9ecf"
        ],
        "entityId": [],
        "data": "",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1150,
        "y": 700,
        "wires": [
            []
        ]
    },
    {
        "id": "38663ed8401afb54",
        "type": "amazon-echo-device",
        "z": "9879bffe.2be56",
        "name": "Destiny",
        "topic": "",
        "x": 220,
        "y": 160,
        "wires": [
            [
                "e7a63f2248054581"
            ]
        ]
    },
    {
        "id": "83e206a7625009f7",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Launch Destiny",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "media_player",
        "service": "play_media",
        "areaId": [],
        "deviceId": [
            "c3a53f9c81ee8d6804dde3c8048e9ecf"
        ],
        "entityId": [],
        "data": "{\"media_content_id\":\"BPQ955FQFPH6\",\"media_content_type\":\"game\"}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1720,
        "y": 820,
        "wires": [
            [
                "1f645ea59eb91e4d"
            ]
        ]
    },
    {
        "id": "e7a63f2248054581",
        "type": "switch",
        "z": "9879bffe.2be56",
        "name": "Play Destiny",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "on",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "off",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 510,
        "y": 160,
        "wires": [
            [
                "dc72ed9d.68814",
                "5adaed27.ce4a74",
                "ba2c5358.51ac6",
                "ae11003b02034c84"
            ],
            [
                "3bb3454244c77d13",
                "8936a5cadd4b229c",
                "23e2cec2c810d949",
                "4782b243acc7822e"
            ]
        ]
    },
    {
        "id": "1f645ea59eb91e4d",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "It's Destiny time",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "notify",
        "service": "alexa_media",
        "areaId": [],
        "deviceId": [],
        "entityId": [],
        "data": "{\"target\":\"media_player.media_room_echo_dot\",\"message\":\"It's Destiny time!\",\"data\":{\"type\":\"tts\"}}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 2040,
        "y": 820,
        "wires": [
            []
        ]
    },
    {
        "id": "94615505f4453067",
        "type": "ha-wait-until",
        "z": "9879bffe.2be56",
        "name": "Wait for Xbox to turn on",
        "server": "f8a50b9a.39c988",
        "version": 1,
        "outputs": 1,
        "entityId": "media_player.media_room_series_x",
        "entityIdFilterType": "exact",
        "property": "state",
        "comparator": "is",
        "value": "on",
        "valueType": "str",
        "timeout": "0",
        "timeoutType": "num",
        "timeoutUnits": "minutes",
        "entityLocation": "data",
        "entityLocationType": "none",
        "checkCurrentState": true,
        "blockInputOverrides": true,
        "x": 1470,
        "y": 820,
        "wires": [
            [
                "83e206a7625009f7"
            ]
        ]
    },
    {
        "id": "6c8ca67ae6bdeb02",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Turn on Xbox",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "media_player",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [
            "c3a53f9c81ee8d6804dde3c8048e9ecf"
        ],
        "entityId": [],
        "data": "",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1160,
        "y": 820,
        "wires": [
            [
                "94615505f4453067"
            ]
        ]
    },
    {
        "id": "65eb907a374594de",
        "type": "amazon-echo-device",
        "z": "9879bffe.2be56",
        "name": "Fortnite",
        "topic": "",
        "x": 220,
        "y": 220,
        "wires": [
            [
                "72bd51ced414b66a"
            ]
        ]
    },
    {
        "id": "72bd51ced414b66a",
        "type": "switch",
        "z": "9879bffe.2be56",
        "name": "Play Fortnite",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "on",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "off",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 510,
        "y": 220,
        "wires": [
            [
                "dc72ed9d.68814",
                "5adaed27.ce4a74",
                "ba2c5358.51ac6",
                "52ec778d471990cc"
            ],
            [
                "3bb3454244c77d13",
                "8936a5cadd4b229c",
                "23e2cec2c810d949",
                "4782b243acc7822e"
            ]
        ]
    },
    {
        "id": "28421d9bf4b133a5",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Launch Fortnite",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "media_player",
        "service": "play_media",
        "areaId": [],
        "deviceId": [
            "c3a53f9c81ee8d6804dde3c8048e9ecf"
        ],
        "entityId": [],
        "data": "{\"media_content_id\":\"BT5P2X999VH2\",\"media_content_type\":\"game\"}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1720,
        "y": 980,
        "wires": [
            [
                "b4398109fdcc88bc"
            ]
        ]
    },
    {
        "id": "b4398109fdcc88bc",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "It's Fortnite time",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "notify",
        "service": "alexa_media",
        "areaId": [],
        "deviceId": [],
        "entityId": [],
        "data": "{\"target\":\"media_player.media_room_echo_dot\",\"message\":\"It's Fortnite time!\",\"data\":{\"type\":\"tts\"}}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 2040,
        "y": 980,
        "wires": [
            []
        ]
    },
    {
        "id": "f7a6d87ff6c8ce01",
        "type": "ha-wait-until",
        "z": "9879bffe.2be56",
        "name": "Wait for Xbox to turn on",
        "server": "f8a50b9a.39c988",
        "version": 1,
        "outputs": 1,
        "entityId": "media_player.media_room_series_x",
        "entityIdFilterType": "exact",
        "property": "state",
        "comparator": "is",
        "value": "on",
        "valueType": "str",
        "timeout": "0",
        "timeoutType": "num",
        "timeoutUnits": "minutes",
        "entityLocation": "data",
        "entityLocationType": "none",
        "checkCurrentState": true,
        "blockInputOverrides": true,
        "x": 1470,
        "y": 980,
        "wires": [
            [
                "28421d9bf4b133a5"
            ]
        ]
    },
    {
        "id": "730fdeaff402503a",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Turn on Xbox",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "media_player",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [
            "c3a53f9c81ee8d6804dde3c8048e9ecf"
        ],
        "entityId": [],
        "data": "",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1160,
        "y": 980,
        "wires": [
            [
                "f7a6d87ff6c8ce01"
            ]
        ]
    },
    {
        "id": "ae11003b02034c84",
        "type": "api-current-state",
        "z": "9879bffe.2be56",
        "name": "Xbox status",
        "server": "f8a50b9a.39c988",
        "version": 3,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "media_player.media_room_series_x",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 930,
        "y": 760,
        "wires": [
            [
                "83e206a7625009f7"
            ],
            [
                "6c8ca67ae6bdeb02",
                "97daa3c2.0dc6d"
            ]
        ]
    },
    {
        "id": "52ec778d471990cc",
        "type": "api-current-state",
        "z": "9879bffe.2be56",
        "name": "Xbox status",
        "server": "f8a50b9a.39c988",
        "version": 3,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "media_player.media_room_series_x",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 930,
        "y": 920,
        "wires": [
            [
                "28421d9bf4b133a5"
            ],
            [
                "730fdeaff402503a",
                "97daa3c2.0dc6d"
            ]
        ]
    },
    {
        "id": "3d02edac1221cf9f",
        "type": "amazon-echo-device",
        "z": "9879bffe.2be56",
        "name": "Battlefield",
        "topic": "",
        "x": 220,
        "y": 280,
        "wires": [
            [
                "c208bdcdadbb9d36"
            ]
        ]
    },
    {
        "id": "c208bdcdadbb9d36",
        "type": "switch",
        "z": "9879bffe.2be56",
        "name": "Play Battlefield",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "on",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "off",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 520,
        "y": 280,
        "wires": [
            [
                "ab76246b6af38d39",
                "dc72ed9d.68814",
                "5adaed27.ce4a74",
                "ba2c5358.51ac6"
            ],
            [
                "3bb3454244c77d13",
                "8936a5cadd4b229c",
                "23e2cec2c810d949",
                "4782b243acc7822e"
            ]
        ]
    },
    {
        "id": "33063c0bc6708b6c",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Launch Battlefield",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "media_player",
        "service": "play_media",
        "areaId": [],
        "deviceId": [
            "c3a53f9c81ee8d6804dde3c8048e9ecf"
        ],
        "entityId": [],
        "data": "{\"media_content_id\":\"9PD5BFNZ4V7K\",\"media_content_type\":\"game\"}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1730,
        "y": 1120,
        "wires": [
            [
                "ba623d55ef22ecad"
            ]
        ]
    },
    {
        "id": "ba623d55ef22ecad",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "It's Fortnite time",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "notify",
        "service": "alexa_media",
        "areaId": [],
        "deviceId": [],
        "entityId": [],
        "data": "{\"target\":\"media_player.media_room_echo_dot\",\"message\":\"It's Battlefield time!\",\"data\":{\"type\":\"tts\"}}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 2040,
        "y": 1120,
        "wires": [
            []
        ]
    },
    {
        "id": "c81d11254fb65dc7",
        "type": "ha-wait-until",
        "z": "9879bffe.2be56",
        "name": "Wait for Xbox to turn on",
        "server": "f8a50b9a.39c988",
        "version": 1,
        "outputs": 1,
        "entityId": "media_player.media_room_series_x",
        "entityIdFilterType": "exact",
        "property": "state",
        "comparator": "is",
        "value": "on",
        "valueType": "str",
        "timeout": "0",
        "timeoutType": "num",
        "timeoutUnits": "minutes",
        "entityLocation": "data",
        "entityLocationType": "none",
        "checkCurrentState": true,
        "blockInputOverrides": true,
        "x": 1470,
        "y": 1120,
        "wires": [
            [
                "33063c0bc6708b6c"
            ]
        ]
    },
    {
        "id": "91edbfab7a79e7a2",
        "type": "api-call-service",
        "z": "9879bffe.2be56",
        "name": "Turn on Xbox",
        "server": "f8a50b9a.39c988",
        "version": 5,
        "debugenabled": false,
        "domain": "media_player",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [
            "c3a53f9c81ee8d6804dde3c8048e9ecf"
        ],
        "entityId": [],
        "data": "",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1160,
        "y": 1120,
        "wires": [
            [
                "c81d11254fb65dc7"
            ]
        ]
    },
    {
        "id": "ab76246b6af38d39",
        "type": "api-current-state",
        "z": "9879bffe.2be56",
        "name": "Xbox status",
        "server": "f8a50b9a.39c988",
        "version": 3,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "media_player.media_room_series_x",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 930,
        "y": 1080,
        "wires": [
            [
                "33063c0bc6708b6c"
            ],
            [
                "91edbfab7a79e7a2",
                "97daa3c2.0dc6d"
            ]
        ]
    },
    {
        "id": "f8a50b9a.39c988",
        "type": "server",
        "name": "VASHA01",
        "version": 2,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30"
    }
]

[{"id":"d20ade64.e30f9","type":"api-call-service","z":"9879bffe.2be56","name":"Turn off Front Light","server":"f8a50b9a.39c988","version":5,"debugenabled":false,"service":"turn_off","entityId":["light.media_room_front_light"],"data":"","dataType":"json","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2030,"y":1360,"wires":[[]]},{"id":"8feab676.f1de28","type":"api-call-service","z":"9879bffe.2be56","name":"Turn on Rear Light - 10%","server":"f8a50b9a.39c988","version":5,"debugenabled":false,"service":"turn_on","entityId":["light.media_room_back_light"],"data":"{\"brightness_pct\":\"10\"}","dataType":"json","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1810,"y":1360,"wires":[["d20ade64.e30f9"]]},{"id":"c3cec93c.995128","type":"api-call-service","z":"9879bffe.2be56","name":"Turn on Projector","server":"f8a50b9a.39c988","version":5,"debugenabled":false,"service":"send_command","entityId":["remote.media_room_remote"],"data":"{\"command\":\"turn_on\",\"device\":\"media_room_projector\"}","dataType":"json","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1590,"y":1360,"wires":[["8feab676.f1de28"]]},{"id":"2a3821a6.41e12e","type":"amazon-echo-device","z":"9879bffe.2be56","name":"Destiny","topic":"Destiny","x":260,"y":1460,"wires":[["58d4ece3.baa8b4"]]},{"id":"58d4ece3.baa8b4","type":"switch","z":"9879bffe.2be56","name":"on or off?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":420,"y":1500,"wires":[["8922b257.79dc1"],["922918e4.90c278"]]},{"id":"5416124e.a1b6bc","type":"amazon-echo-device","z":"9879bffe.2be56","name":"Fortnite","topic":"Fortnite","x":260,"y":1500,"wires":[["58d4ece3.baa8b4"]]},{"id":"2cb75063.0af97","type":"amazon-echo-device","z":"9879bffe.2be56","name":"Battlefield","topic":"Battlefield","x":260,"y":1540,"wires":[["58d4ece3.baa8b4"]]},{"id":"3d29b1f6.28bd3e","type":"api-current-state","z":"9879bffe.2be56","name":"Xbox on?","server":"f8a50b9a.39c988","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"media_player.media_room_series_x","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":840,"y":1440,"wires":[["c3cec93c.995128","4d3d6ef3.7d99a"],["7f0590a.f5d2d7","4b363cd9.284944"]]},{"id":"4b363cd9.284944","type":"api-call-service","z":"9879bffe.2be56","name":"Turn on AV","server":"f8a50b9a.39c988","version":5,"debugenabled":false,"service":"send_command","entityId":["remote.media_room_remote"],"data":"{\"command\":\"power\",\"device\":\"media_room_av\"}","dataType":"json","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1030,"y":1340,"wires":[["9144c0b4.d539c"]]},{"id":"9144c0b4.d539c","type":"api-call-service","z":"9879bffe.2be56","name":"Set Input to Game","server":"f8a50b9a.39c988","version":5,"debugenabled":false,"service":"send_command","entityId":["remote.media_room_remote"],"data":"{\"command\":\"game\",\"device\":\"media_room_av\"}","dataType":"json","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1210,"y":1340,"wires":[["81cd5a5.d46cca8"]]},{"id":"81cd5a5.d46cca8","type":"api-call-service","z":"9879bffe.2be56","name":"Mute AV","server":"f8a50b9a.39c988","version":5,"debugenabled":false,"service":"send_command","entityId":["remote.media_room_remote"],"data":"{\"command\":\"mute\",\"device\":\"media_room_av\"}","dataType":"json","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1380,"y":1340,"wires":[["c3cec93c.995128"]]},{"id":"738573d.b8e4a8c","type":"amazon-echo-device","z":"9879bffe.2be56","name":"Gaming Mode","topic":"Gaming Mode","x":240,"y":1360,"wires":[["a0e0875f.e72418"]]},{"id":"a0e0875f.e72418","type":"switch","z":"9879bffe.2be56","name":"on or off?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":420,"y":1360,"wires":[["16e3d262.d4f5be"],["922918e4.90c278"]]},{"id":"16e3d262.d4f5be","type":"api-call-service","z":"9879bffe.2be56","name":"Turn on Xbox","server":"f8a50b9a.39c988","version":5,"debugenabled":false,"service":"turn_on","entityId":[],"data":"","dataType":"jsonata","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":600,"y":1360,"wires":[["f6dbcf69.db793"]]},{"id":"f6dbcf69.db793","type":"api-call-service","z":"9879bffe.2be56","name":"Gaming Mode Enabled","server":"f8a50b9a.39c988","version":5,"debugenabled":false,"service":"alexa_media","entityId":[],"data":"{\"target\":\"media_player.media_room_echo_dot\",\"message\":\"Gaming Mode Enabled!\",\"data\":{\"type\":\"tts\"}}","dataType":"json","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":800,"y":1360,"wires":[["4b363cd9.284944"]]},{"id":"922918e4.90c278","type":"api-call-service","z":"9879bffe.2be56","name":"Turn off Projector","server":"f8a50b9a.39c988","version":5,"debugenabled":false,"service":"send_command","entityId":["remote.media_room_remote"],"data":"{\"command\":\"turn_off\",\"device\":\"media_room_projector\",\"num_repeats\":\"2\",\"delay_secs\":\"2\"}","dataType":"json","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":750,"y":1660,"wires":[["a684ad85.460bf"]]},{"id":"a684ad85.460bf","type":"api-call-service","z":"9879bffe.2be56","name":"Turn off Media Room Lights","server":"f8a50b9a.39c988","version":5,"debugenabled":false,"service":"turn_off","entityId":[],"data":"","dataType":"json","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":980,"y":1660,"wires":[["589b00d9.14c48"]]},{"id":"589b00d9.14c48","type":"api-call-service","z":"9879bffe.2be56","name":"Gaming Mode Disabled","server":"f8a50b9a.39c988","version":5,"debugenabled":false,"service":"alexa_media","entityId":[],"data":"{\"target\":\"media_player.media_room_echo_dot\",\"message\":\"Gaming Mode Disabled!\",\"data\":{\"type\":\"tts\"}}","dataType":"json","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1230,"y":1660,"wires":[["b163049f.484aa8"]]},{"id":"b163049f.484aa8","type":"api-call-service","z":"9879bffe.2be56","name":"Turn off Xbox","server":"f8a50b9a.39c988","version":5,"debugenabled":true,"service":"turn_off","entityId":[],"data":"","dataType":"jsonata","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1440,"y":1660,"wires":[[]]},{"id":"4d3d6ef3.7d99a","type":"api-call-service","z":"9879bffe.2be56","name":"Launch msg.game_id","server":"f8a50b9a.39c988","version":5,"debugenabled":false,"service_domain":"","service":"play_media","entityId":[],"data":"{\"media_content_id\":\"{{game_id}}\",\"media_content_type\":\"game\"}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1600,"y":1460,"wires":[["fa06c297.7d95a"]]},{"id":"fa06c297.7d95a","type":"api-call-service","z":"9879bffe.2be56","name":"It's {{topic}} time","server":"f8a50b9a.39c988","version":5,"debugenabled":false,"service_domain":"","service":"alexa_media","entityId":[],"data":"{\"target\":\"media_player.media_room_echo_dot\",\"message\":\"It's {{topic}} time!\",\"data\":{\"type\":\"tts\"}}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1840,"y":1460,"wires":[[]]},{"id":"79083b9c.ee9074","type":"ha-wait-until","z":"9879bffe.2be56","name":"Wait for Xbox to turn on","server":"f8a50b9a.39c988","version":1,"outputs":1,"entityId":"media_player.media_room_series_x","entityIdFilterType":"exact","property":"state","comparator":"is","value":"on","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"minutes","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":1310,"y":1520,"wires":[["4d3d6ef3.7d99a"]]},{"id":"7f0590a.f5d2d7","type":"api-call-service","z":"9879bffe.2be56","name":"Turn on Xbox","server":"f8a50b9a.39c988","version":5,"debugenabled":false,"service":"turn_on","entityId":[],"data":"","dataType":"jsonata","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1060,"y":1520,"wires":[["79083b9c.ee9074"]]},{"id":"8922b257.79dc1","type":"change","z":"9879bffe.2be56","name":"","rules":[{"t":"set","p":"game_id","pt":"msg","to":"topic","tot":"msg"},{"t":"change","p":"game_id","pt":"msg","from":"Destiny","fromt":"str","to":"BPQ955FQFPH6","tot":"str"},{"t":"change","p":"game_id","pt":"msg","from":"Fortnite","fromt":"str","to":"BT5P2X999VH2","tot":"str"},{"t":"change","p":"game_id","pt":"msg","from":"Battlefield","fromt":"str","to":"9PD5BFNZ4V7K","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":1440,"wires":[["3d29b1f6.28bd3e"]]},{"id":"4efc4121.cfd1b","type":"link in","z":"9879bffe.2be56","name":"Alexa In","links":["dff1328c.941a6"],"x":55,"y":1360,"wires":[["738573d.b8e4a8c","2a3821a6.41e12e","5416124e.a1b6bc","2cb75063.0af97"]]},{"id":"f8a50b9a.39c988","type":"server","name":"VASHA01","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"}]

The main trick is setting a topic whithin every echo device node. Then with the change node use that topic to set the message and game_id variables. Don’t deploy my echo device nodes though, you’ll find errors. Check inside them what I did, I only added a topic, delete them, deploy and adjust your already existing echo device nodes accordingly. I’m sure it can be polished further.

Awesome, thanks for taking a look! I didn’t even consider just setting the topic like that. Such a simple solution which tidies it all up so nicely.

I have a lot to learn still but now I can use this same logic in other flows to help simplify them as well :slight_smile:

1 Like