ZNDS智能电视网 推荐当贝市场

TV应用下载 / 资源分享区

软件下载 | 游戏 | 讨论 | 电视计算器

综合交流 / 评测 / 活动区

交流区 | 测硬件 | 网站活动 | Z币中心

新手入门 / 进阶 / 社区互助

新手 | 你问我答 | 免费刷机救砖 | ROM固件

查看: 170327|回复: 30
上一主题 下一主题
[分享]

怎样用小爱音箱控制电视 用小爱音箱控制电视播放任意影视

  [复制链接]
跳转到指定楼层
楼主
发表于 2024-1-10 11:06 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式 | 来自江西
除了播放音乐和控制智能家居设备外,小爱音箱还可以与电视进行联动,实现语音控制电视的功能。那么,如何利用小爱音箱来控制电视,并播放任意影视内容呢?

首先说明,我实在群晖docker安装的homeassistant和nodered,部署在其他服务器上的可参考修改。

1.本地部署小雅,具体怎么部署的自己搜哔站,教程一大堆就不在重复。假设我部署的地址是:http://192.168.1.222:6789/
后边代码中这个地址改为你自己的

怎样用小爱音箱控制电视 用小爱音箱控制电视播放任意影视

2.在homeassistant中将你家的电视通过dlna接入。

怎样用小爱音箱控制电视 用小爱音箱控制电视播放任意影视

3.在群晖创建一个文件夹挂载 nodered的root目录。

怎样用小爱音箱控制电视 用小爱音箱控制电视播放任意影视

4.群晖开启ssh,并进入nodered容器内部:

  1. docker exec -it nodered /bin/bash
复制代码

怎样用小爱音箱控制电视 用小爱音箱控制电视播放任意影视


我这里以新docker部署的nr为例

安装http请求及解析需要的库:

  1. python3 -m ensurepip --upgrade
  2. python3 -m pip install requests
  3. python3 -m pip install bs4
复制代码

怎样用小爱音箱控制电视 用小爱音箱控制电视播放任意影视


安装完就可以到nr里边操作了。

5.在nodered中,将我的流导入:并将第一步说的小雅的网址改为自己的

  1. [
  2.     {
  3.         "id": "ce7ae6436c0af95a",
  4.         "type": "file",
  5.         "z": "5641ce060432f122",
  6.         "name": "存储在root目录下",
  7.         "filename": "/root/查询小雅电影url.py",
  8.         "filenameType": "str",
  9.         "appendNewline": true,
  10.         "createDir": true,
  11.         "overwriteFile": "true",
  12.         "encoding": "none",
  13.         "x": 430,
  14.         "y": 1740,
  15.         "wires": [
  16.             [
  17.                 "6d47d72d49f59618"
  18.             ]
  19.         ]
  20.     },
  21.     {
  22.         "id": "6d47d72d49f59618",
  23.         "type": "exec",
  24.         "z": "5641ce060432f122",
  25.         "command": "python3 /root/查询小雅电影url.py",
  26.         "addpay": "payload",
  27.         "append": "",
  28.         "useSpawn": "false",
  29.         "timer": "",
  30.         "winHide": false,
  31.         "oldrc": false,
  32.         "name": "",
  33.         "x": 740,
  34.         "y": 1740,
  35.         "wires": [
  36.             [
  37.                 "05f6b97e57de70a4",
  38.                 "931f4e09ee722274"
  39.             ],
  40.             [],
  41.             []
  42.         ]
  43.     },
  44.     {
  45.         "id": "1b5f9bfbd0bce847",
  46.         "type": "api-call-service",
  47.         "z": "5641ce060432f122",
  48.         "name": "主卧电视",
  49.         "server": "598f8fe7bc05621b",
  50.         "version": 5,
  51.         "debugenabled": false,
  52.         "domain": "media_player",
  53.         "service": "play_media",
  54.         "areaId": [
  55.             "wo_shi"
  56.         ],
  57.         "deviceId": [],
  58.         "entityId": [
  59.             "media_player.zhu_wo_dian_shi"
  60.         ],
  61.         "data": "{\t   "media_content_id": msg.payload[0],\t   "media_content_type":"video",\t   "announce":"true"\t}",
  62.         "dataType": "jsonata",
  63.         "mergeContext": "",
  64.         "mustacheAltTags": false,
  65.         "outputProperties": [],
  66.         "queue": "none",
  67.         "x": 1680,
  68.         "y": 1700,
  69.         "wires": [
  70.             [
  71.                 "6ffd3c1403904fc6"
  72.             ]
  73.         ]
  74.     },
  75.     {
  76.         "id": "6ffd3c1403904fc6",
  77.         "type": "debug",
  78.         "z": "5641ce060432f122",
  79.         "name": "debug 18",
  80.         "active": true,
  81.         "tosidebar": true,
  82.         "console": false,
  83.         "tostatus": false,
  84.         "complete": "true",
  85.         "targetType": "full",
  86.         "statusVal": "",
  87.         "statusType": "auto",
  88.         "x": 1960,
  89.         "y": 1800,
  90.         "wires": []
  91.     },
  92.     {
  93.         "id": "2e0618eb53503ab3",
  94.         "type": "debug",
  95.         "z": "5641ce060432f122",
  96.         "name": "debug 20",
  97.         "active": true,
  98.         "tosidebar": true,
  99.         "console": false,
  100.         "tostatus": false,
  101.         "complete": "true",
  102.         "targetType": "full",
  103.         "statusVal": "",
  104.         "statusType": "auto",
  105.         "x": 1460,
  106.         "y": 1600,
  107.         "wires": []
  108.     },
  109.     {
  110.         "id": "030138d8effd759f",
  111.         "type": "template",
  112.         "z": "5641ce060432f122",
  113.         "name": "python 脚本",
  114.         "field": "payload",
  115.         "fieldType": "msg",
  116.         "format": "python",
  117.         "syntax": "mustache",
  118.         "template": "import requests\nfrom bs4 import BeautifulSoup\n\n# 定义URL\nurl = "http://192.168.1.222:6789/search?box={{payload}}&type=video&url="\n\n# 发送GET请求获取页面内容\nresponse = requests.get(url)\n\n# 检查响应状态码\nif response.status_code == 200:\n    html = response.text\n\n    # 使用Beautiful Soup解析HTML\n    soup = BeautifulSoup(html, 'html.parser')\n\n    # 找到所有的<a>标签\n    a_tags = soup.find_all('a')\n\n    # 初始化路径列表,用于存储尝试的路径\n    paths_to_try = [a['href'] for a in a_tags[2:]]\n\n    # 用于记录是否找到匹配的文件名\n    found = False\n\n    # 检查列表中是否包含".mkv"或".mp4"的结果\n    for path in paths_to_try:\n        if ".mkv" in path or ".mp4" in path:\n            # 拼接新的URL\n            new_url = f"http://192.168.1.222:6789/d/{path}"\n            print(new_url)\n            found = True\n            break\n\n    if not found:\n        while paths_to_try and not found:\n            path = paths_to_try.pop(0)  # 弹出列表中的第一个路径\n\n            # 定义URL\n            api_url = "http://192.168.1.222:6789/api/fs/list"\n\n            # 定义请求参数\n            params = {\n                "path": path,\n                "password": "",\n                "page": 1,\n                "per_page": 30,\n                "refresh": False\n            }\n\n            # 发送POST请求获取JSON响应\n            response = requests.post(api_url, json=params)\n\n            # 检查响应状态码\n            if response.status_code == 200:\n                data = response.json()\n\n                # 尝试获取content中的项目,如果出现异常则跳出当前循环\n                try:\n                    content = data.get("data", {}).get("content")\n                except AttributeError:\n                   # print(f"在路径 {path} 下发生异常,跳过该路径")\n                    continue\n\n                if content is not None:\n                    # 查找第一个包含“.mp4”或“.mkv”的name\n                    found_name = None\n                    for item in content:\n                        name = item.get("name", "")\n                        if ".mp4" in name or ".mkv" in name:\n                            found_name = name\n                            break\n\n                    # 如果找到了匹配的name\n                    if found_name:\n                        # 拼接完整的网址\n                        full_url = f"http://192.168.1.222:6789/d/{path}/{found_name}"\n                        print(full_url)\n                        found = True\n                    else:\n                        print(f"在路径 {path} 下未找到匹配的文件名")\n                else:\n                    print(f"JSON响应中没有'content'字段")\n            else:\n                print(f"无法访问指定URL: {api_url}")\n\n        if not found:\n            print("没有找到包含'.mp4'或'.mkv'的文件名")\nelse:\n    print("无法访问指定URL")\n",
  119.         "output": "str",
  120.         "x": 210,
  121.         "y": 1760,
  122.         "wires": [
  123.             [
  124.                 "ce7ae6436c0af95a"
  125.             ]
  126.         ]
  127.     },
  128.     {
  129.         "id": "0e62fca7ed5d9b7b",
  130.         "type": "inject",
  131.         "z": "5641ce060432f122",
  132.         "name": "",
  133.         "props": [
  134.             {
  135.                 "p": "payload"
  136.             },
  137.             {
  138.                 "p": "topic",
  139.                 "vt": "str"
  140.             }
  141.         ],
  142.         "repeat": "",
  143.         "crontab": "",
  144.         "once": false,
  145.         "onceDelay": 0.1,
  146.         "topic": "",
  147.         "payload": "速度与激情10",
  148.         "payloadType": "str",
  149.         "x": 130,
  150.         "y": 1680,
  151.         "wires": [
  152.             [
  153.                 "030138d8effd759f"
  154.             ]
  155.         ]
  156.     },
  157.     {
  158.         "id": "05f6b97e57de70a4",
  159.         "type": "debug",
  160.         "z": "5641ce060432f122",
  161.         "name": "debug 21",
  162.         "active": true,
  163.         "tosidebar": true,
  164.         "console": false,
  165.         "tostatus": false,
  166.         "complete": "true",
  167.         "targetType": "full",
  168.         "statusVal": "",
  169.         "statusType": "auto",
  170.         "x": 940,
  171.         "y": 1840,
  172.         "wires": []
  173.     },
  174.     {
  175.         "id": "561da383e0140cab",
  176.         "type": "join",
  177.         "z": "5641ce060432f122",
  178.         "name": "",
  179.         "mode": "custom",
  180.         "build": "array",
  181.         "property": "payload",
  182.         "propertyType": "msg",
  183.         "key": "topic",
  184.         "joiner": "\\n",
  185.         "joinerType": "str",
  186.         "accumulate": false,
  187.         "timeout": "",
  188.         "count": "",
  189.         "reduceRight": false,
  190.         "reduceExp": "",
  191.         "reduceInit": "",
  192.         "reduceInitType": "",
  193.         "reduceFixup": "",
  194.         "x": 1230,
  195.         "y": 1720,
  196.         "wires": [
  197.             [
  198.                 "2e0618eb53503ab3",
  199.                 "081e66e145ad4ade",
  200.                 "65545ddaebf3e8a4"
  201.             ]
  202.         ]
  203.     },
  204.     {
  205.         "id": "c3e5a779dfee461f",
  206.         "type": "split",
  207.         "z": "5641ce060432f122",
  208.         "name": "",
  209.         "splt": "\\n",
  210.         "spltType": "str",
  211.         "arraySplt": 1,
  212.         "arraySpltType": "len",
  213.         "stream": false,
  214.         "addname": "",
  215.         "x": 1130,
  216.         "y": 1780,
  217.         "wires": [
  218.             [
  219.                 "561da383e0140cab"
  220.             ]
  221.         ]
  222.     },
  223.     {
  224.         "id": "4d24b8ce856620bf",
  225.         "type": "function",
  226.         "z": "5641ce060432f122",
  227.         "name": "function 10",
  228.         "func": "\nmsg.payload=encodeURI(msg.payload).slice(0, -3);\n\n\nreturn msg;",
  229.         "outputs": 1,
  230.         "timeout": 0,
  231.         "noerr": 0,
  232.         "initialize": "",
  233.         "finalize": "",
  234.         "libs": [],
  235.         "x": 1630,
  236.         "y": 1600,
  237.         "wires": [
  238.             [
  239.                 "1b5f9bfbd0bce847"
  240.             ]
  241.         ]
  242.     },
  243.     {
  244.         "id": "ef5d923092afd21d",
  245.         "type": "comment",
  246.         "z": "5641ce060432f122",
  247.         "name": "电影url",
  248.         "info": "",
  249.         "x": 110,
  250.         "y": 1600,
  251.         "wires": []
  252.     },
  253.     {
  254.         "id": "ebde0123b4902e43",
  255.         "type": "server-state-changed",
  256.         "z": "5641ce060432f122",
  257.         "name": "小爱对话",
  258.         "server": "598f8fe7bc05621b",
  259.         "version": 4,
  260.         "exposeToHomeAssistant": false,
  261.         "haConfig": [
  262.             {
  263.                 "property": "name",
  264.                 "value": ""
  265.             },
  266.             {
  267.                 "property": "icon",
  268.                 "value": ""
  269.             }
  270.         ],
  271.         "entityidfilter": "sensor.xiaomi_lx5a_7d9b_conversation",
  272.         "entityidfiltertype": "exact",
  273.         "outputinitially": false,
  274.         "state_type": "str",
  275.         "haltifstate": "",
  276.         "halt_if_type": "str",
  277.         "halt_if_compare": "is",
  278.         "outputs": 1,
  279.         "output_only_on_state_change": true,
  280.         "for": "0",
  281.         "forType": "num",
  282.         "forUnits": "minutes",
  283.         "ignorePreVSTateNull": false,
  284.         "ignorePrevStateUnknown": false,
  285.         "ignorePrevStateUnavailable": false,
  286.         "ignoreCurrentStateUnknown": false,
  287.         "ignoreCurrentStateUnavailable": false,
  288.         "outputProperties": [
  289.             {
  290.                 "property": "payload",
  291.                 "propertyType": "msg",
  292.                 "value": "",
  293.                 "valueType": "entityState"
  294.             },
  295.             {
  296.                 "property": "data",
  297.                 "propertyType": "msg",
  298.                 "value": "",
  299.                 "valueType": "eventData"
  300.             },
  301.             {
  302.                 "property": "topic",
  303.                 "propertyType": "msg",
  304.                 "value": "",
  305.                 "valueType": "triggerId"
  306.             }
  307.         ],
  308.         "x": 120,
  309.         "y": 2000,
  310.         "wires": [
  311.             [
  312.                 "2f2c89887be9e04e"
  313.             ]
  314.         ]
  315.     },
  316.     {
  317.         "id": "2f2c89887be9e04e",
  318.         "type": "switch",
  319.         "z": "5641ce060432f122",
  320.         "name": "我想看",
  321.         "property": "payload",
  322.         "propertyType": "msg",
  323.         "rules": [
  324.             {
  325.                 "t": "cont",
  326.                 "v": "我想看",
  327.                 "vt": "str"
  328.             },
  329.             {
  330.                 "t": "else"
  331.             }
  332.         ],
  333.         "checkall": "true",
  334.         "repair": false,
  335.         "outputs": 2,
  336.         "x": 310,
  337.         "y": 1980,
  338.         "wires": [
  339.             [
  340.                 "b028350e4a8ff48d",
  341.                 "2dc0658ed70d52dd"
  342.             ],
  343.             []
  344.         ]
  345.     },
  346.     {
  347.         "id": "b028350e4a8ff48d",
  348.         "type": "split",
  349.         "z": "5641ce060432f122",
  350.         "name": "",
  351.         "splt": "想看",
  352.         "spltType": "str",
  353.         "arraySplt": "1",
  354.         "arraySpltType": "len",
  355.         "stream": false,
  356.         "addname": "",
  357.         "x": 510,
  358.         "y": 1980,
  359.         "wires": [
  360.             [
  361.                 "2c27c3910bb47959"
  362.             ]
  363.         ]
  364.     },
  365.     {
  366.         "id": "2c27c3910bb47959",
  367.         "type": "join",
  368.         "z": "5641ce060432f122",
  369.         "name": "",
  370.         "mode": "custom",
  371.         "build": "array",
  372.         "property": "payload",
  373.         "propertyType": "msg",
  374.         "key": "topic",
  375.         "joiner": "\\n",
  376.         "joinerType": "str",
  377.         "accumulate": false,
  378.         "timeout": "",
  379.         "count": "",
  380.         "reduceRight": false,
  381.         "reduceExp": "",
  382.         "reduceInit": "",
  383.         "reduceInitType": "",
  384.         "reduceFixup": "",
  385.         "x": 670,
  386.         "y": 1980,
  387.         "wires": [
  388.             [
  389.                 "cfb73ae3d376c74a"
  390.             ]
  391.         ]
  392.     },
  393.     {
  394.         "id": "cfb73ae3d376c74a",
  395.         "type": "function",
  396.         "z": "5641ce060432f122",
  397.         "name": "",
  398.         "func": "msg.payload = msg.payload[1]\n\nreturn msg;",
  399.         "outputs": 1,
  400.         "timeout": "",
  401.         "noerr": 0,
  402.         "initialize": "",
  403.         "finalize": "",
  404.         "libs": [],
  405.         "x": 790,
  406.         "y": 1980,
  407.         "wires": [
  408.             [
  409.                 "030138d8effd759f",
  410.                 "f4f391a64858ac59"
  411.             ]
  412.         ]
  413.     },
  414.     {
  415.         "id": "df9356cc80c6bfb0",
  416.         "type": "inject",
  417.         "z": "5641ce060432f122",
  418.         "name": "",
  419.         "props": [
  420.             {
  421.                 "p": "payload"
  422.             },
  423.             {
  424.                 "p": "topic",
  425.                 "vt": "str"
  426.             }
  427.         ],
  428.         "repeat": "",
  429.         "crontab": "",
  430.         "once": false,
  431.         "onceDelay": 0.1,
  432.         "topic": "",
  433.         "payload": "我想看我和我的祖国",
  434.         "payloadType": "str",
  435.         "x": 210,
  436.         "y": 2100,
  437.         "wires": [
  438.             [
  439.                 "2f2c89887be9e04e"
  440.             ]
  441.         ]
  442.     },
  443.     {
  444.         "id": "2dc0658ed70d52dd",
  445.         "type": "xiaoai-mediaplayer",
  446.         "z": "5641ce060432f122",
  447.         "name": "",
  448.         "xiaoai": "09b787bdbe3ed75d",
  449.         "action": "pause",
  450.         "device": "",
  451.         "x": 550,
  452.         "y": 2100,
  453.         "wires": [
  454.             [],
  455.             []
  456.         ]
  457.     },
  458.     {
  459.         "id": "f23f85e17f7d3a33",
  460.         "type": "api-call-service",
  461.         "z": "5641ce060432f122",
  462.         "name": "",
  463.         "server": "598f8fe7bc05621b",
  464.         "version": 5,
  465.         "debugenabled": false,
  466.         "domain": "media_player",
  467.         "service": "play_media",
  468.         "areaId": [],
  469.         "deviceId": [],
  470.         "entityId": [
  471.             "media_player.chuang_wei_ke_ting_dian_shi_g6_7f6_dlna"
  472.         ],
  473.         "data": "{\t   "media_content_id": msg.payload[0],\t   "media_content_type":"video",\t   "announce":"true"\t}",
  474.         "dataType": "jsonata",
  475.         "mergeContext": "",
  476.         "mustacheAltTags": false,
  477.         "outputProperties": [],
  478.         "queue": "none",
  479.         "x": 1790,
  480.         "y": 1860,
  481.         "wires": [
  482.             [
  483.                 "6ffd3c1403904fc6"
  484.             ]
  485.         ]
  486.     },
  487.     {
  488.         "id": "3798846de5c7f949",
  489.         "type": "server-state-changed",
  490.         "z": "5641ce060432f122",
  491.         "name": "电影名称",
  492.         "server": "598f8fe7bc05621b",
  493.         "version": 4,
  494.         "exposeToHomeAssistant": false,
  495.         "haConfig": [
  496.             {
  497.                 "property": "name",
  498.                 "value": ""
  499.             },
  500.             {
  501.                 "property": "icon",
  502.                 "value": ""
  503.             }
  504.         ],
  505.         "entityidfilter": "input_text.dian_ying_ming_cheng",
  506.         "entityidfiltertype": "exact",
  507.         "outputinitially": false,
  508.         "state_type": "str",
  509.         "haltifstate": "",
  510.         "halt_if_type": "str",
  511.         "halt_if_compare": "is",
  512.         "outputs": 1,
  513.         "output_only_on_state_change": true,
  514.         "for": "0",
  515.         "forType": "num",
  516.         "forUnits": "minutes",
  517.         "ignorePrevStateNull": false,
  518.         "ignorePrevStateUnknown": false,
  519.         "ignorePrevStateUnavailable": false,
  520.         "ignoreCurrentStateUnknown": false,
  521.         "ignoreCurrentStateUnavailable": false,
  522.         "outputProperties": [
  523.             {
  524.                 "property": "payload",
  525.                 "propertyType": "msg",
  526.                 "value": "",
  527.                 "valueType": "entityState"
  528.             },
  529.             {
  530.                 "property": "data",
  531.                 "propertyType": "msg",
  532.                 "value": "",
  533.                 "valueType": "eventData"
  534.             },
  535.             {
  536.                 "property": "topic",
  537.                 "propertyType": "msg",
  538.                 "value": "",
  539.                 "valueType": "triggerId"
  540.             }
  541.         ],
  542.         "x": 100,
  543.         "y": 1880,
  544.         "wires": [
  545.             [
  546.                 "030138d8effd759f"
  547.             ]
  548.         ]
  549.     },
  550.     {
  551.         "id": "081e66e145ad4ade",
  552.         "type": "api-call-service",
  553.         "z": "5641ce060432f122",
  554.         "name": "",
  555.         "server": "598f8fe7bc05621b",
  556.         "version": 5,
  557.         "debugenabled": false,
  558.         "domain": "media_player",
  559.         "service": "media_stop",
  560.         "areaId": [],
  561.         "deviceId": [],
  562.         "entityId": [
  563.             "media_player.chuang_wei_ke_ting_dian_shi_g6_7f6_dlna"
  564.         ],
  565.         "data": "",
  566.         "dataType": "jsonata",
  567.         "mergeContext": "",
  568.         "mustacheAltTags": false,
  569.         "outputProperties": [],
  570.         "queue": "none",
  571.         "x": 1250,
  572.         "y": 1860,
  573.         "wires": [
  574.             []
  575.         ]
  576.     },
  577.     {
  578.         "id": "e6304a814503d679",
  579.         "type": "debug",
  580.         "z": "5641ce060432f122",
  581.         "name": "debug 301",
  582.         "active": true,
  583.         "tosidebar": true,
  584.         "console": false,
  585.         "tostatus": false,
  586.         "complete": "payload",
  587.         "targetType": "msg",
  588.         "statusVal": "",
  589.         "statusType": "auto",
  590.         "x": 1550,
  591.         "y": 1960,
  592.         "wires": []
  593.     },
  594.     {
  595.         "id": "2162eb85046df316",
  596.         "type": "delay",
  597.         "z": "5641ce060432f122",
  598.         "name": "",
  599.         "pauseType": "delay",
  600.         "timeout": "2",
  601.         "timeoutUnits": "seconds",
  602.         "rate": "1",
  603.         "nbRateUnits": "1",
  604.         "rateUnits": "second",
  605.         "randomFirst": "1",
  606.         "randomLast": "5",
  607.         "randomUnits": "seconds",
  608.         "drop": false,
  609.         "allowrate": false,
  610.         "outputs": 1,
  611.         "x": 1640,
  612.         "y": 1780,
  613.         "wires": [
  614.             [
  615.                 "f23f85e17f7d3a33"
  616.             ]
  617.         ]
  618.     },
  619.     {
  620.         "id": "3e5669590088e34d",
  621.         "type": "function",
  622.         "z": "5641ce060432f122",
  623.         "name": "function 17",
  624.         "func": "// 获取输入的URL\nvar originalURL = msg.payload;\n\n// 使用encodeURI函数转换URL\nvar encodedURL = encodeURI(originalURL);\n\n// 删除末尾的逗号\nvar cleanedURL = encodedURL.replace(/,+$/, '');\n\n// 将清理后的URL存储在msg.payload中\nmsg.payload = cleanedURL;\n\n// 返回msg对象以传递到下一个节点\nreturn msg;",
  625.         "outputs": 1,
  626.         "timeout": 0,
  627.         "noerr": 0,
  628.         "initialize": "",
  629.         "finalize": "",
  630.         "libs": [],
  631.         "x": 1470,
  632.         "y": 1840,
  633.         "wires": [
  634.             [
  635.                 "2162eb85046df316",
  636.                 "e6304a814503d679"
  637.             ]
  638.         ]
  639.     },
  640.     {
  641.         "id": "65545ddaebf3e8a4",
  642.         "type": "switch",
  643.         "z": "5641ce060432f122",
  644.         "name": "",
  645.         "property": "payload",
  646.         "propertyType": "msg",
  647.         "rules": [
  648.             {
  649.                 "t": "cont",
  650.                 "v": "%20",
  651.                 "vt": "str"
  652.             },
  653.             {
  654.                 "t": "else"
  655.             }
  656.         ],
  657.         "checkall": "true",
  658.         "repair": false,
  659.         "outputs": 2,
  660.         "x": 1410,
  661.         "y": 1680,
  662.         "wires": [
  663.             [
  664.                 "2162eb85046df316"
  665.             ],
  666.             [
  667.                 "3e5669590088e34d"
  668.             ]
  669.         ]
  670.     },
  671.     {
  672.         "id": "3a5605c9317eb24f",
  673.         "type": "api-call-service",
  674.         "z": "5641ce060432f122",
  675.         "name": "",
  676.         "server": "598f8fe7bc05621b",
  677.         "version": 5,
  678.         "debugenabled": false,
  679.         "domain": "xiaomi_miot",
  680.         "service": "intelligent_speaker",
  681.         "areaId": [],
  682.         "deviceId": [],
  683.         "entityId": [
  684.             "media_player.xiaomi_lx5a_7d9b_play_control"
  685.         ],
  686.         "data": "{"text":"没有找到您所说的电影,可以去tv,box找找"}",
  687.         "dataType": "jsonata",
  688.         "mergeContext": "",
  689.         "mustacheAltTags": false,
  690.         "outputProperties": [],
  691.         "queue": "none",
  692.         "x": 1030,
  693.         "y": 1520,
  694.         "wires": [
  695.             []
  696.         ]
  697.     },
  698.     {
  699.         "id": "931f4e09ee722274",
  700.         "type": "switch",
  701.         "z": "5641ce060432f122",
  702.         "name": "",
  703.         "property": "payload",
  704.         "propertyType": "msg",
  705.         "rules": [
  706.             {
  707.                 "t": "cont",
  708.                 "v": "没有找到包含",
  709.                 "vt": "str"
  710.             },
  711.             {
  712.                 "t": "else"
  713.             }
  714.         ],
  715.         "checkall": "true",
  716.         "repair": false,
  717.         "outputs": 2,
  718.         "x": 850,
  719.         "y": 1620,
  720.         "wires": [
  721.             [
  722.                 "3a5605c9317eb24f"
  723.             ],
  724.             [
  725.                 "c3e5a779dfee461f",
  726.                 "38da2c94e298a6f6",
  727.                 "8b39e6f4e4fa8774"
  728.             ]
  729.         ]
  730.     },
  731.     {
  732.         "id": "1ee4cc39ad69ee40",
  733.         "type": "inject",
  734.         "z": "5641ce060432f122",
  735.         "name": "",
  736.         "props": [
  737.             {
  738.                 "p": "payload"
  739.             },
  740.             {
  741.                 "p": "topic",
  742.                 "vt": "str"
  743.             }
  744.         ],
  745.         "repeat": "",
  746.         "crontab": "",
  747.         "once": false,
  748.         "onceDelay": 0.1,
  749.         "topic": "",
  750.         "payload": "",
  751.         "payloadType": "date",
  752.         "x": 990,
  753.         "y": 1920,
  754.         "wires": [
  755.             [
  756.                 "081e66e145ad4ade"
  757.             ]
  758.         ]
  759.     },
  760.     {
  761.         "id": "dac6af55d7290b5e",
  762.         "type": "api-call-service",
  763.         "z": "5641ce060432f122",
  764.         "name": "",
  765.         "server": "598f8fe7bc05621b",
  766.         "version": 5,
  767.         "debugenabled": false,
  768.         "domain": "xiaomi_miot",
  769.         "service": "intelligent_speaker",
  770.         "areaId": [],
  771.         "deviceId": [],
  772.         "entityId": [
  773.             "media_player.xiaomi_lx5a_7d9b_play_control"
  774.         ],
  775.         "data": "{"text":msg.name}",
  776.         "dataType": "jsonata",
  777.         "mergeContext": "",
  778.         "mustacheAltTags": false,
  779.         "outputProperties": [],
  780.         "queue": "none",
  781.         "x": 1410,
  782.         "y": 1520,
  783.         "wires": [
  784.             []
  785.         ]
  786.     },
  787.     {
  788.         "id": "38da2c94e298a6f6",
  789.         "type": "function",
  790.         "z": "5641ce060432f122",
  791.         "name": "function 18",
  792.         "func": "\n\n\nmsg.name = "正在为您播放 " + global.get("moviename")+"请稍后";\nreturn msg;",
  793.         "outputs": 1,
  794.         "timeout": 0,
  795.         "noerr": 0,
  796.         "initialize": "",
  797.         "finalize": "",
  798.         "libs": [],
  799.         "x": 1030,
  800.         "y": 1580,
  801.         "wires": [
  802.             [
  803.                 "dac6af55d7290b5e"
  804.             ]
  805.         ]
  806.     },
  807.     {
  808.         "id": "f4f391a64858ac59",
  809.         "type": "function",
  810.         "z": "5641ce060432f122",
  811.         "name": "function 19",
  812.         "func": "\n\nglobal.set("moviename", msg.payload);\nreturn msg;",
  813.         "outputs": 1,
  814.         "timeout": 0,
  815.         "noerr": 0,
  816.         "initialize": "",
  817.         "finalize": "",
  818.         "libs": [],
  819.         "x": 930,
  820.         "y": 2020,
  821.         "wires": [
  822.             []
  823.         ]
  824.     },
  825.     {
  826.         "id": "8b39e6f4e4fa8774",
  827.         "type": "debug",
  828.         "z": "5641ce060432f122",
  829.         "name": "debug 302",
  830.         "active": true,
  831.         "tosidebar": true,
  832.         "console": false,
  833.         "tostatus": false,
  834.         "complete": "true",
  835.         "targetType": "full",
  836.         "statusVal": "",
  837.         "statusType": "auto",
  838.         "x": 1130,
  839.         "y": 1660,
  840.         "wires": []
  841.     },
  842.     {
  843.         "id": "598f8fe7bc05621b",
  844.         "type": "server",
  845.         "name": "Home Assistant",
  846.         "version": 5,
  847.         "addon": false,
  848.         "rejectUnauthorizedCerts": false,
  849.         "ha_boolean": "y|yes|true|on|home|open",
  850.         "connectionDelay": true,
  851.         "cacheJson": true,
  852.         "heartbeat": false,
  853.         "heartbeatInterval": "30",
  854.         "areaSelector": "friendlyName",
  855.         "deviceSelector": "friendlyName",
  856.         "entitySelector": "friendlyName",
  857.         "statusSeparator": ": ",
  858.         "statusYear": "hidden",
  859.         "statusMonth": "short",
  860.         "statusDay": "numeric",
  861.         "statusHourCycle": "default",
  862.         "statusTimeFormat": "h:m",
  863.         "enableGlobalContextStore": false
  864.     },
  865.     {
  866.         "id": "09b787bdbe3ed75d",
  867.         "type": "xiaoai-tts-configurator",
  868.         "name": ""
  869.     }
  870. ]
复制代码

在nr输入一个你想看的电影,如果出现下边的url就说明成功了。恭喜你,可以随心看电影了。

怎样用小爱音箱控制电视 用小爱音箱控制电视播放任意影视

如果上边的流导入有问题就直接下载附件

游客,如果您要查看本帖隐藏内容请回复



相关阅读:



上一篇:Alist Helper(电脑傻瓜式设置alist) v0.1.4.8使用教程
下一篇:山西移动九联UNT413A,芯片S905L3急需求助!!!
沙发
发表于 2024-1-10 11:10 | 只看该作者 | 来自江西
大神666.
回复 支持 反对

使用道具 举报

板凳
发表于 2024-1-10 11:10 | 只看该作者 | 来自陕西
厉害了,膜拜一下
回复 支持 反对

使用道具 举报

地板
发表于 2024-1-10 11:11 | 只看该作者 | 来自重庆

有些人可能是在homeassistant里面安装的nodered,并不是独立的docker,这种情况怎么安装http请求及解析需要的库
回复 支持 反对

使用道具 举报

5#
发表于 2024-1-10 11:11 | 只看该作者 | 来自重庆
天天猫妈 发表于 2024-1-10 11:11
有些人可能是在homeassistant里面安装的nodered,并不是独立的docker,这种情况怎么安装http请求及解析需 ...

如果HA supervised的,直接SSH进宿主机,用同样的命令。
如果HAOS的,需要超级权限,进SSH,然后,命令一样。
回复 支持 反对

使用道具 举报

6#
发表于 2024-1-10 11:11 | 只看该作者 | 来自上海
果然还是玩不转,要好好学习了
回复 支持 反对

使用道具 举报

7#
发表于 2024-1-10 11:11 | 只看该作者 | 来自江西
厉害了我的哥
回复 支持 反对

使用道具 举报

8#
发表于 2024-1-10 21:27 来自ZNDS手机版 | 只看该作者 | 来自湖南
我连标点符号都不懂
回复 支持 反对

使用道具 举报

9#
发表于 2024-1-10 21:53 | 只看该作者 | 来自辽宁

谢谢楼主分享
回复 支持 反对

使用道具 举报

10#
发表于 2024-1-11 16:24 | 只看该作者 | 来自山东
连标点符号都不懂
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|新帖|标签|软件|Sitemap|ZNDS智能电视网 ( 苏ICP备2023012627号 )

网络信息服务信用承诺书 | 增值电信业务经营许可证:苏B2-20221768 丨 苏公网安备 32011402011373号

GMT+8, 2024-4-30 00:46 , Processed in 0.093358 second(s), 14 queries , Redis On.

Powered by Discuz!

监督举报:report#znds.com (请将#替换为@)

© 2007-2024 ZNDS.Com

快速回复 返回顶部 返回列表