[
{
"id": "65eae738d91f64a3",
"type": "inject",
"z": "fdf7dc26597ae619",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 350,
"y": 400,
"wires": [
[
"3c8c7825f90a5f3b"
]
]
},
{
"id": "93c7b2b927b14214",
"type": "http request",
"z": "fdf7dc26597ae619",
"name": "",
"method": "POST",
"ret": "obj",
"paytoqs": "ignore",
"url": "http://192.168.1.222:5244/api/fs/list",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [
{
"keyType": "other",
"keyValue": "Authorization",
"valueType": "other",
"valueValue": "XXXXXX"
}
],
"x": 680,
"y": 400,
"wires": [
[
"833c3b5c444f548b",
"fe52ae74185a932e"
]
]
},
{
"id": "3c8c7825f90a5f3b",
"type": "function",
"z": "fdf7dc26597ae619",
"name": "function 50",
"func": "msg.payload = {"path":"/nas music/经常听","password":"","page":1,"per_page":0,"refresh":false}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 510,
"y": 400,
"wires": [
[
"93c7b2b927b14214"
]
]
},
{
"id": "833c3b5c444f548b",
"type": "function",
"z": "fdf7dc26597ae619",
"name": "function 51",
"func": "var zongshu = msg.payload.data.total;\nvar randomNumber = Math.floor(Math.random() * zongshu);\nvar song_name = msg.payload.data.content[randomNumber-1].name;\n\nmsg.zongshu=zongshu;\nmsg.random = randomNumber;\nmsg.name=song_name;\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 870,
"y": 400,
"wires": [
[
"a4f751bd5147ca60"
]
]
},
{
"id": "a4f751bd5147ca60",
"type": "switch",
"z": "fdf7dc26597ae619",
"name": "",
"property": "name",
"propertyType": "msg",
"rules": [
{
"t": "cont",
"v": "mp3",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1010,
"y": 400,
"wires": [
[
"992a2b4398a5dc2f"
],
[
"df258a16334b7523"
]
]
},
{
"id": "32c83ecc50e35841",
"type": "mqtt in",
"z": "fdf7dc26597ae619",
"name": "",
"topic": "/mrdiynotifier/status",
"qos": "2",
"datatype": "auto-detect",
"broker": "15e9ca6a44eb2b20",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 390,
"y": 280,
"wires": [
[
"a502c264232b0900"
]
]
},
{
"id": "0c920a6280c04f49",
"type": "mqtt out",
"z": "fdf7dc26597ae619",
"name": "",
"topic": "/mrdiynotifier/play",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "15e9ca6a44eb2b20",
"x": 1430,
"y": 380,
"wires": []
},
{
"id": "992a2b4398a5dc2f",
"type": "function",
"z": "fdf7dc26597ae619",
"name": "function 52",
"func": "\nvar name = encodeURI(msg.name);\nmsg.payload="http://192.168.1.222:5244/d/nas%20music/%E7%BB%8F%E5%B8%B8%E5%90%AC/"+name;\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1210,
"y": 380,
"wires": [
[
"0c920a6280c04f49",
"fc79be3ba922821c"
]
]
},
{
"id": "df258a16334b7523",
"type": "link out",
"z": "fdf7dc26597ae619",
"name": "不是MP3就重新请求",
"mode": "link",
"links": [
"ea373363454b30cb"
],
"x": 1105,
"y": 460,
"wires": []
},
{
"id": "ea373363454b30cb",
"type": "link in",
"z": "fdf7dc26597ae619",
"name": "link in 7",
"links": [
"df258a16334b7523",
"5b1f3f7e12124dd3",
"160e354de1a6bc9c",
"c57947f6b27e0c0a"
],
"x": 415,
"y": 440,
"wires": [
[
"3c8c7825f90a5f3b"
]
]
},
{
"id": "a502c264232b0900",
"type": "ha-sensor",
"z": "fdf7dc26597ae619",
"name": "D1mini_player状态",
"entityConfig": "bcd483331e52fdeb",
"version": 0,
"state": "payload",
"stateType": "msg",
"attributes": [],
"inputOverride": "allow",
"outputProperties": [],
"x": 610,
"y": 280,
"wires": [
[]
]
},
{
"id": "1112acc17e85cf88",
"type": "ha-wait-until",
"z": "fdf7dc26597ae619",
"name": "",
"server": "459a05598e74e156",
"version": 2,
"outputs": 1,
"entityId": "sensor.d1mini_player",
"entityIdFilterType": "exact",
"property": "state",
"comparator": "is",
"value": "idle",
"valueType": "str",
"timeout": "",
"timeoutType": "num",
"timeoutUnits": "seconds",
"checkCurrentState": true,
"blockInputOverrides": true,
"outputProperties": [],
"entityLocation": "data",
"entityLocationType": "none",
"x": 860,
"y": 520,
"wires": [
[
"156cb526d4306d4a"
]
]
},
{
"id": "5b1f3f7e12124dd3",
"type": "link out",
"z": "fdf7dc26597ae619",
"name": "不是MP3就重新请求",
"mode": "link",
"links": [
"ea373363454b30cb"
],
"x": 1405,
"y": 480,
"wires": []
},
{
"id": "964294f2f1016a0c",
"type": "comment",
"z": "fdf7dc26597ae619",
"name": "D1mini-player",
"info": "",
"x": 390,
"y": 160,
"wires": []
},
{
"id": "9eb7ed31cedb42af",
"type": "comment",
"z": "fdf7dc26597ae619",
"name": "播放",
"info": "",
"x": 330,
"y": 340,
"wires": []
},
{
"id": "468436a9f17f97d7",
"type": "delay",
"z": "fdf7dc26597ae619",
"name": "",
"pauseType": "delay",
"timeout": "30",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 700,
"y": 520,
"wires": [
[
"1112acc17e85cf88"
]
]
},
{
"id": "1c2f09261045f962",
"type": "ha-switch",
"z": "fdf7dc26597ae619",
"name": "D1mini-player开关",
"version": 0,
"debugenabled": false,
"inputs": 0,
"outputs": 2,
"entityConfig": "1ca8bde6237bf8a6",
"enableInput": false,
"outputOnStateChange": false,
"outputProperties": [
{
"property": "outputType",
"propertyType": "msg",
"value": "state change",
"valueType": "str"
},
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
}
],
"x": 390,
"y": 220,
"wires": [
[],
[]
]
},
{
"id": "156cb526d4306d4a",
"type": "api-current-state",
"z": "fdf7dc26597ae619",
"name": "",
"server": "459a05598e74e156",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "switch.d1mini_playerkai_guan",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"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": 1150,
"y": 520,
"wires": [
[
"5b1f3f7e12124dd3"
],
[]
]
},
{
"id": "baf139d33a7fb182",
"type": "server-state-changed",
"z": "fdf7dc26597ae619",
"name": "",
"server": "459a05598e74e156",
"version": 4,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "sensor.d1mini_player",
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "str",
"haltifstate": "playing",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 2,
"output_only_on_state_change": true,
"for": "10",
"forType": "num",
"forUnits": "seconds",
"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": 410,
"y": 520,
"wires": [
[
"468436a9f17f97d7"
],
[]
]
},
{
"id": "3a4b092b606f2879",
"type": "mqtt in",
"z": "fdf7dc26597ae619",
"name": "A无线开关",
"topic": "espnow/topic",
"qos": "0",
"datatype": "auto-detect",
"broker": "15e9ca6a44eb2b20",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 340,
"y": 720,
"wires": [
[
"4bf283517a0bb126",
"ec844c5f740874c5"
]
]
},
{
"id": "4bf283517a0bb126",
"type": "switch",
"z": "fdf7dc26597ae619",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "A-1",
"vt": "str"
},
{
"t": "eq",
"v": "A-2",
"vt": "str"
},
{
"t": "eq",
"v": "A-3",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 550,
"y": 720,
"wires": [
[
"160e354de1a6bc9c",
"1af9a25873b49f54"
],
[
"c57947f6b27e0c0a"
],
[
"f2f7a29ae1c871b0",
"9d6834fe15e5930e"
]
]
},
{
"id": "160e354de1a6bc9c",
"type": "link out",
"z": "fdf7dc26597ae619",
"name": "不是MP3就重新请求",
"mode": "link",
"links": [
"ea373363454b30cb"
],
"x": 675,
"y": 640,
"wires": []
},
{
"id": "1af9a25873b49f54",
"type": "api-call-service",
"z": "fdf7dc26597ae619",
"name": "",
"server": "459a05598e74e156",
"version": 5,
"debugenabled": false,
"domain": "switch",
"service": "turn_on",
"areaId": [],
"deviceId": [],
"entityId": [
"switch.d1mini_playerkai_guan"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 860,
"y": 640,
"wires": [
[]
]
},
{
"id": "f2f7a29ae1c871b0",
"type": "api-call-service",
"z": "fdf7dc26597ae619",
"name": "",
"server": "459a05598e74e156",
"version": 5,
"debugenabled": false,
"domain": "switch",
"service": "turn_off",
"areaId": [],
"deviceId": [],
"entityId": [
"switch.d1mini_playerkai_guan"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 760,
"y": 780,
"wires": [
[]
]
},
{
"id": "9d6834fe15e5930e",
"type": "mqtt out",
"z": "fdf7dc26597ae619",
"name": "",
"topic": "/mrdiynotifier/stop",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "15e9ca6a44eb2b20",
"x": 790,
"y": 860,
"wires": []
},
{
"id": "c57947f6b27e0c0a",
"type": "link out",
"z": "fdf7dc26597ae619",
"name": "不是MP3就重新请求",
"mode": "link",
"links": [
"ea373363454b30cb"
],
"x": 735,
"y": 720,
"wires": []
},
{
"id": "a3d4adb9cd02d6af",
"type": "inject",
"z": "fdf7dc26597ae619",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "A-1",
"payloadType": "str",
"x": 370,
"y": 660,
"wires": [
[
"4bf283517a0bb126"
]
]
},
{
"id": "d27904daf87e9494",
"type": "inject",
"z": "fdf7dc26597ae619",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "A-2",
"payloadType": "str",
"x": 390,
"y": 800,
"wires": [
[
"4bf283517a0bb126"
]
]
},
{
"id": "5bdfa5a3ae721c1d",
"type": "inject",
"z": "fdf7dc26597ae619",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "A-3",
"payloadType": "str",
"x": 390,
"y": 860,
"wires": [
[
"4bf283517a0bb126"
]
]
},
{
"id": "ec844c5f740874c5",
"type": "debug",
"z": "fdf7dc26597ae619",
"name": "debug 368",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 530,
"y": 640,
"wires": []
},
{
"id": "fe52ae74185a932e",
"type": "debug",
"z": "fdf7dc26597ae619",
"name": "debug 369",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 930,
"y": 300,
"wires": []
},
{
"id": "fc79be3ba922821c",
"type": "debug",
"z": "fdf7dc26597ae619",
"name": "debug 370",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1350,
"y": 300,
"wires": []
},
{
"id": "15e9ca6a44eb2b20",
"type": "mqtt-broker",
"name": "",
"broker": "192.168.1.100",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthRetain": "false",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closeRetain": "false",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willRetain": "false",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "bcd483331e52fdeb",
"type": "ha-entity-config",
"server": "459a05598e74e156",
"deviceConfig": "",
"name": "",
"version": "6",
"entityType": "sensor",
"haConfig": [
{
"property": "name",
"value": "D1mini_player"
},
{
"property": "icon",
"value": ""
},
{
"property": "entity_category",
"value": ""
},
{
"property": "entity_picture",
"value": ""
},
{
"property": "device_class",
"value": ""
},
{
"property": "unit_of_measurement",
"value": ""
},
{
"property": "state_class",
"value": ""
}
],
"resend": false,
"debugEnabled": false
},
{
"id": "459a05598e74e156",
"type": "server",
"name": "Home Assistant",
"version": 5,
"addon": false,
"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
},
{
"id": "1ca8bde6237bf8a6",
"type": "ha-entity-config",
"server": "459a05598e74e156",
"deviceConfig": "",
"name": "",
"version": "6",
"entityType": "switch",
"haConfig": [
{
"property": "name",
"value": "D1mini-player开关"
},
{
"property": "icon",
"value": ""
},
{
"property": "entity_category",
"value": ""
},
{
"property": "entity_picture",
"value": ""
},
{
"property": "device_class",
"value": ""
}
],
"resend": false,
"debugEnabled": false
}
]
修改http request节点和其前边的function节点,改为你自己的数据。保存部署就行了