『瀚思彼岸』» 智能家居技术论坛

标题: 奥克斯A+ app 空调抓包数据接口 [打印本页]

作者: liuxiaobo    时间: 2024-8-23 14:30
标题: 奥克斯A+ app 空调抓包数据接口
本帖最后由 liuxiaobo 于 2024-8-25 22:24 编辑

家中使用的奥克斯空调,论坛的MQTT方案不适用,无奈手动抓包,小黄鸟抓包接口数据如下:

1.登录为短信验证,短信请求接口如下:

https://smthomeav.aux-home.com/app/login_sms_code

方法为 POST,请求体为 phone:13xxxxx   手机号

2.短信验证请求接口:
https://smthomeav.aux-home.com/app/wechatMini/loginBySms

方法为 POST,请求体为 phone:13xxxxx   手机号;code:xxxx 验证码

3.登录后获取到Authorization 参数=token值 并包含到请求头中,expireAt应为token有效期时间参数:
    "openApiToken": {
      "token": "bc18c3b217a34c7b9dfXXXXXXXXXXXXXXXXX",
      "expireAt": 1726762443
}






4.获取设备列表接口,确保请求头中包含 Authorization 参数值

https://smthomeav.aux-home.com/app/device_bindings?getStatus=true

获取到的设备列表JSON数据如下(部分私人参数和谐):

{
  "code": 200,
  "message": "OK",
  "data": [
    {
      "deviceId": "f57cb83f-e9c5-4251-b98e-a81fXXXXXXXXXXX",
      "source": 1,
      "productKey": "000100XXXXX",
      "mac": "E8165XXXXXXXX",
      "did": "d500010001XXXXXXX",
      "alias": "主卧空调",
      "type": null,
      "deviceKey": null,
      "deviceLock": null,
      "password": "b7beXXXXXXXX",
      "terminalId": 1,
      "subDevice": 0,
      "dataOne": "42",
      "dataTwo": "90",
      "dataThree": "06",
      "city": null,
      "cityCode": null,
      "sn": "",
      "longitude": "113.XXXXX",
      "latitude": "30.XXXXX",
      "modelId": "ea47d0fc-e9f1-4589-8f9d-4XXXXXXXXXXX",
      "suitType": 0,
      "useType": 0,
      "feature": "{\"coolType\":[\"1\",\"0\"],\"frenquency\":[\"1\",\"0\"],\"tempInterval\":[\"0\",\"0\"],\"roomTempDisplay\":[\"1\",\"0\"],\"screen\":[\"2\",\"0\"],\"windSpeed\":[\"2\",\"0\"],\"faultSupport\":[\"0\",\"0\"],\"timing\":[\"0\",\"0\"],\"mode\":[\"0,1,2,3,4\",\"1\"],\"deviceSupport\":[\"0,1,2,3,4,5,6,7,9,10\",\"1\"],\"appSupport\":[\"0,1,2,3,4,5\",\"1\"]}",
      "deviceMainUri": "https://smart-home-saas.oss-cn-hangzhou.aliyuncs.com/20181108/img/a2f1873e-c7a8-49ea-bd2c-7005ccf921e3.png",
      "entityUri": null,
      "userTag": 0,
      "wash": true,
      "deviceKind": null,
      "mcuType": 0,
      "sftype": false,
      "zeroWindFeel": false,
      "address": null,
      "transport": null,
      "customerFuncs": null,
      "thirdDid": null,
      "online": true,
      "data": {
        "wind_child": 0,
        "ventilate": 0,
        "half": 0,
        "wind_speed_1": 6,
        "air_con_func": 1,
        "power_limit_percent": 0,
        "support_heat": 1,
        "type": "control_status",
        "auto_screen": 0,
        "eco": 0,
        "temperature_decimal": 0,
        "up_down_swing": 7,
        "power_limit": 0,
        "electric_lock": 0,
        "anti_fungus": 0,
        "temperature": 29,
        "left_right_swing": 1,
        "wind_smart": 0,
        "ventilate_heap_notify": 0,
        "fahrenheit": 0,
        "addr": 1,
        "wind_far": 0,
        "sleep_mode": 0,
        "ver": 0,
        "electric_heating": 0,
        "src": 1,
        "comfort_wind": 0,
        "freshing": 0,
        "wind_ring": 0,
        "on_off": 1,
        "clean": 0,
        "zero_wind_feeling": 0,
        "sleep_diy": 0,
        "ventilate_auxiliary": 0,
        "auto_following_code": 0,
        "human_detection": 0,
        "screen_on_off": 0,
        "healthy": 0,
        "following": 0,
        "wind_light": 0,
        "turbo_silence": 0,
        "air_q_light": 0,
        "hanging": 1
      },
      "wifi_hard_version": "2C007100",
      "wifi_soft_version": "00071061",
      "passcode": "b7beXXXXXX"
    }
  ]
}



5.控制接口和部分控制代码值(请确保请求头中包含 Authorization 参数值):
https://smthomeav.aux-home.com/app/wechatMini/new_device_control


例,空调调整到29.5度:
{
  "did": "d500010001e816566b4b98",
  "uart": "bb00068000010f000101af2080a0002000002000000000de9b",
  "pk": "00010001",
  "action": {
    "temperature": 295
  }
}





作者: bhc1365    时间: 2024-8-23 18:31
我也是奥克斯空调,有没有接入到hass?接入的话具体怎样做?
作者: dengxiao    时间: 2024-8-23 21:32
伸手党表示有nodered流程就完美了
作者: dengxiao    时间: 2024-8-23 21:33
虽然我用空调伴侣,但是APP可以控制到0.5度,更适合实际感受
作者: liuxiaobo    时间: 2024-8-25 16:34
dengxiao 发表于 2024-8-23 21:32
伸手党表示有nodered流程就完美了

抛砖引玉,留给大神们发挥,看哪位大神心情好直接改写程插件~
作者: goldstep    时间: 2025-1-23 22:52
同样的是奥克斯A+ app 有大佬写好了吗?
作者: liuxiaobo    时间: 2025-2-4 21:24
本帖最后由 liuxiaobo 于 2025-2-4 21:25 编辑
dengxiao 发表于 2024-8-23 21:32
伸手党表示有nodered流程就完美了
  1. JSON 代码,可直接导入到 Node - RED 中。请确保在实际使用时,将占位的手机号、验证码、设备 `did` 和 `pk` 等信息替换为真实有效的值。

  2. ```json
  3. [
  4.     {
  5.         "id": "c29c1697.56e9e8",
  6.         "type": "inject",
  7.         "z": "2797f4c1.8b059e",
  8.         "name": "发送短信验证码",
  9.         "props": [
  10.             {
  11.                 "p": "payload"
  12.             },
  13.             {
  14.                 "p": "topic",
  15.                 "vt": "str"
  16.             }
  17.         ],
  18.         "repeat": "",
  19.         "crontab": "",
  20.         "once": false,
  21.         "onceDelay": 0.1,
  22.         "topic": "",
  23.         "payload": "{"phone":"13xxxxx"}",
  24.         "payloadType": "json",
  25.         "x": 110,
  26.         "y": 140,
  27.         "wires": [
  28.             [
  29.                 "56c98c0f.d009d4"
  30.             ]
  31.         ]
  32.     },
  33.     {
  34.         "id": "56c98c0f.d009d4",
  35.         "type": "http request",
  36.         "z": "2797f4c1.8b059e",
  37.         "name": "",
  38.         "method": "POST",
  39.         "ret": "txt",
  40.         "paytoqs": false,
  41.         "url": "https://smthomeav.aux-home.com/app/login_sms_code",
  42.         "tls": "",
  43.         "persist": false,
  44.         "proxy": "",
  45.         "authType": "",
  46.         "senderr": false,
  47.         "headers": {},
  48.         "x": 300,
  49.         "y": 140,
  50.         "wires": [
  51.             [
  52.                 "7c9c0f01.15c28c"
  53.             ]
  54.         ]
  55.     },
  56.     {
  57.         "id": "7c9c0f01.15c28c",
  58.         "type": "debug",
  59.         "z": "2797f4c1.8b059e",
  60.         "name": "",
  61.         "active": true,
  62.         "tosidebar": true,
  63.         "console": false,
  64.         "tostatus": false,
  65.         "complete": "true",
  66.         "targetType": "full",
  67.         "statusVal": "",
  68.         "statusType": "auto",
  69.         "x": 480,
  70.         "y": 140,
  71.         "wires": []
  72.     },
  73.     {
  74.         "id": "f0e75b33.8d0798",
  75.         "type": "inject",
  76.         "z": "2797f4c1.8b059e",
  77.         "name": "登录",
  78.         "props": [
  79.             {
  80.                 "p": "payload"
  81.             },
  82.             {
  83.                 "p": "topic",
  84.                 "vt": "str"
  85.             }
  86.         ],
  87.         "repeat": "",
  88.         "crontab": "",
  89.         "once": false,
  90.         "onceDelay": 0.1,
  91.         "topic": "",
  92.         "payload": "{"phone":"13xxxxx","code":"xxxx"}",
  93.         "payloadType": "json",
  94.         "x": 110,
  95.         "y": 200,
  96.         "wires": [
  97.             [
  98.                 "6c978c13.16c99c"
  99.             ]
  100.         ]
  101.     },
  102.     {
  103.         "id": "6c978c13.16c99c",
  104.         "type": "http request",
  105.         "z": "2797f4c1.8b059e",
  106.         "name": "",
  107.         "method": "POST",
  108.         "ret": "json",
  109.         "paytoqs": false,
  110.         "url": "https://smthomeav.aux-home.com/app/wechatMini/loginBySms",
  111.         "tls": "",
  112.         "persist": false,
  113.         "proxy": "",
  114.         "authType": "",
  115.         "senderr": false,
  116.         "headers": {},
  117.         "x": 300,
  118.         "y": 200,
  119.         "wires": [
  120.             [
  121.                 "a58d9725.5c102"
  122.             ]
  123.         ]
  124.     },
  125.     {
  126.         "id": "a58d9725.5c102",
  127.         "type": "function",
  128.         "z": "2797f4c1.8b059e",
  129.         "name": "提取并存储token",
  130.         "func": "global.set("aux_token", msg.payload.openApiToken.token);\nreturn msg;",
  131.         "outputs": 1,
  132.         "noerr": 0,
  133.         "initialize": "",
  134.         "finalize": "",
  135.         "x": 480,
  136.         "y": 200,
  137.         "wires": [
  138.             [
  139.                 "d1b4a72d.75529"
  140.             ]
  141.         ]
  142.     },
  143.     {
  144.         "id": "d1b4a72d.75529",
  145.         "type": "debug",
  146.         "z": "2797f4c1.8b059e",
  147.         "name": "",
  148.         "active": true,
  149.         "tosidebar": true,
  150.         "console": false,
  151.         "tostatus": false,
  152.         "complete": "true",
  153.         "targetType": "full",
  154.         "statusVal": "",
  155.         "statusType": "auto",
  156.         "x": 650,
  157.         "y": 200,
  158.         "wires": []
  159.     },
  160.     {
  161.         "id": "d806b960.10c92",
  162.         "type": "inject",
  163.         "z": "2797f4c1.8b059e",
  164.         "name": "获取设备列表",
  165.         "props": [
  166.             {
  167.                 "p": "payload"
  168.             },
  169.             {
  170.                 "p": "topic",
  171.                 "vt": "str"
  172.             }
  173.         ],
  174.         "repeat": "",
  175.         "crontab": "",
  176.         "once": false,
  177.         "onceDelay": 0.1,
  178.         "topic": "",
  179.         "payload": "",
  180.         "payloadType": "date",
  181.         "x": 110,
  182.         "y": 260,
  183.         "wires": [
  184.             [
  185.                 "c0700d94.9b2768"
  186.             ]
  187.         ]
  188.     },
  189.     {
  190.         "id": "c0700d94.9b2768",
  191.         "type": "http request",
  192.         "z": "2797f4c1.8b059e",
  193.         "name": "",
  194.         "method": "GET",
  195.         "ret": "json",
  196.         "paytoqs": false,
  197.         "url": "https://smthomeav.aux-home.com/app/device_bindings?getStatus=true",
  198.         "tls": "",
  199.         "persist": false,
  200.         "proxy": "",
  201.         "authType": "",
  202.         "senderr": false,
  203.         "headers": {
  204.             "Authorization": "{{global.aux_token}}"
  205.         },
  206.         "x": 300,
  207.         "y": 260,
  208.         "wires": [
  209.             [
  210.                 "e9d7c00d.7c4918"
  211.             ]
  212.         ]
  213.     },
  214.     {
  215.         "id": "e9d7c00d.7c4918",
  216.         "type": "debug",
  217.         "z": "2797f4c1.8b059e",
  218.         "name": "",
  219.         "active": true,
  220.         "tosidebar": true,
  221.         "console": false,
  222.         "tostatus": false,
  223.         "complete": "true",
  224.         "targetType": "full",
  225.         "statusVal": "",
  226.         "statusType": "auto",
  227.         "x": 480,
  228.         "y": 260,
  229.         "wires": []
  230.     },
  231.     {
  232.         "id": "a59c9b99.99962",
  233.         "type": "inject",
  234.         "z": "2797f4c1.8b059e",
  235.         "name": "控制设备",
  236.         "props": [
  237.             {
  238.                 "p": "payload"
  239.             },
  240.             {
  241.                 "p": "topic",
  242.                 "vt": "str"
  243.             }
  244.         ],
  245.         "repeat": "",
  246.         "crontab": "",
  247.         "once": false,
  248.         "onceDelay": 0.1,
  249.         "topic": "",
  250.         "payload": "",
  251.         "payloadType": "date",
  252.         "x": 110,
  253.         "y": 320,
  254.         "wires": [
  255.             [
  256.                 "b37c9d02.990988"
  257.             ]
  258.         ]
  259.     },
  260.     {
  261.         "id": "b37c9d02.990988",
  262.         "type": "function",
  263.         "z": "2797f4c1.8b059e",
  264.         "name": "构建控制请求",
  265.         "func": "let did = "d500010001e816566b4b98";\nlet pk = "00010001";\nlet action = {"temperature":295};\nmsg.payload = {\n    "did": did,\n    "uart": "bb00068000010f000101af2080a0002000002000000000de9b",\n    "pk": pk,\n    "action": action\n};\nmsg.headers = {\n    "Authorization": global.get("aux_token")\n};\nreturn msg;",
  266.         "outputs": 1,
  267.         "noerr": 0,
  268.         "initialize": "",
  269.         "finalize": "",
  270.         "x": 300,
  271.         "y": 320,
  272.         "wires": [
  273.             [
  274.                 "c17c9e14.99311"
  275.             ]
  276.         ]
  277.     },
  278.     {
  279.         "id": "c17c9e14.99311",
  280.         "type": "http request",
  281.         "z": "2797f4c1.8b059e",
  282.         "name": "",
  283.         "method": "POST",
  284.         "ret": "txt",
  285.         "paytoqs": false,
  286.         "url": "https://smthomeav.aux-home.com/app/wechatMini/new_device_control",
  287.         "tls": "",
  288.         "persist": false,
  289.         "proxy": "",
  290.         "authType": "",
  291.         "senderr": false,
  292.         "headers": {},
  293.         "x": 480,
  294.         "y": 320,
  295.         "wires": [
  296.             [
  297.                 "7c9c0f01.15c28c1"
  298.             ]
  299.         ]
  300.     },
  301.     {
  302.         "id": "7c9c0f01.15c28c1",
  303.         "type": "debug",
  304.         "z": "2797f4c1.8b059e",
  305.         "name": "",
  306.         "active": true,
  307.         "tosidebar": true,
  308.         "console": false,
  309.         "tostatus": false,
  310.         "complete": "true",
  311.         "targetType": "full",
  312.         "statusVal": "",
  313.         "statusType": "auto",
  314.         "x": 650,
  315.         "y": 320,
  316.         "wires": []
  317.     }
  318. ]
  319. ```
  320. **导入流程**:
  321.    - 在 Node - RED 界面中,点击菜单中的 `Import` -> `Clipboard`。
  322.    - 将上述 JSON 代码粘贴到弹出的对话框中,然后点击 `Import` 按钮,即可导入该流程。

  323. 请记住,在实际使用中要根据你的奥克斯账号和设备信息正确配置手机号、验证码、设备 `did` 和 `pk` 等参数,以确保流程能够正常运行。
复制代码

作者: goldstep    时间: 2025-6-6 14:12
liuxiaobo 发表于 2025-2-4 21:24

多谢大佬,但是这个流导入报错,能否直接给文件,伸手党再次感谢
作者: xsleaf    时间: 2025-7-4 10:27
官方给我换了新模块,没办法接入这个HA了
作者: 秋雨轩    时间: 2025-9-3 15:55
你的这个API还能用吗?我刚试了第一步短信验证码的请求就回复"code":400,"message":"Bad Request!",是不是官方修改了API?




欢迎光临 『瀚思彼岸』» 智能家居技术论坛 (https://bbs.hassbian.com/) Powered by Discuz! X3.5