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

 找回密码
 立即注册
楼主: Yonsm

[修仙教程] MiService - MiIO/MIoT 协议工具,获取Token超级简单

  [复制链接]

21

主题

294

帖子

2551

积分

论坛技术达人

积分
2551
金钱
2207
HASS币
180

教程狂人

 楼主| 发表于 2021-3-7 23:31:14 | 显示全部楼层
WeDone 发表于 2021-3-7 21:25
老大麻烦看看,不能执行文本命令
设备是 红米 小爱音箱 Play
接口能力如下:

先确保
micli.py 5-1 语音播报
是对的。

看起来你应该是
micli.py 5-4 查询天气 #1
,但如果你说不对的话,试试第二个参数改成 #0 或 去掉 #多试试。
回复

使用道具 举报

2

主题

89

帖子

789

积分

高级会员

Rank: 4

积分
789
金钱
700
HASS币
0
发表于 2021-3-7 23:43:48 | 显示全部楼层
本帖最后由 WeDone 于 2021-3-8 00:05 编辑
Yonsm 发表于 2021-3-7 23:31
先确保  是对的。

看起来你应该是 ,但如果你说不对的话,试试第二个参数改成 #0 或 去掉 #多试试。 ...
micli.py 5-1 语音播报
有播放“语音播报”声音
========================
micli.py 5-4 查询天气 #1
micli.py 5-4 查询天气 #0
micli.py 5-4 查询天气 #
micli.py 5-4 查询天气 

4种都无反应,返回都是

{
  "did": "290072327",
  "miid": 0,
  "siid": 5,
  "aiid": 4,
  "code": -704220025,
  "exe_time": 0,
  "net_cost": 0,
  "ot_cost": 0,
  "otlocalts": 0,
  "oa_cost": 0,
  "_oa_rpc_cost": 0
}
不过看我的接口能力表
aiid 4 是
 "iid": 4,
          "type": "urn:miot-spec-v2:action:play-music:00002846:xiaomi-lx01:1",
          "description": "Play Music",
          "in": [],
          "out": []
aiid 5 是
"iid": 5,
          "type": "urn:miot-spec-v2:action:execute-text-directive:00002842:xiaomi-lx01:1",
          "description": "Execute Text Directive",
          "in": [
            1,
            2
          ],
          "out": []
我的小爱应该是要执行 micli.py 5-5 查询天气 #1 才是叫小爱播放天气,不过4种命令返回也是一样

回复

使用道具 举报

4

主题

91

帖子

677

积分

高级会员

Rank: 4

积分
677
金钱
586
HASS币
0
发表于 2021-3-8 00:33:34 | 显示全部楼层
Yonsm 发表于 2021-3-7 19:53
SSL整数检查不通过,可能是你用了代理,或者本机ca bundles不包含小米的ssl跟证书。
1. 如果你是在 ZhiMi  ...

感谢大佬,确实是ssl的问题,修改之后可以登录了
回复

使用道具 举报

5

主题

141

帖子

787

积分

论坛技术达人

积分
787
金钱
641
HASS币
20
发表于 2021-3-14 21:51:29 | 显示全部楼层
{
  "type": "urn:miot-spec-v2:device:speaker:0000A015:xiaomi-lx04:1",
  "description": "Speaker",
  "services": [
    {
      "iid": 1,
      "type": "urn:miot-spec-v2:service:device-information:00007801:xiaomi-lx04:1",
      "description": "Device Information",
      "properties": [
        {
          "iid": 1,
          "type": "urn:miot-spec-v2:property:manufacturer:00000001:xiaomi-lx04:1",
          "description": "Device Manufacturer",
          "format": "string",
          "access": [
            "read"
          ]
        },
        {
          "iid": 2,
          "type": "urn:miot-spec-v2:property:model:00000002:xiaomi-lx04:1",
          "description": "Device Model",
          "format": "string",
          "access": [
            "read"
          ]
        },
        {
          "iid": 3,
          "type": "urn:miot-spec-v2:property:serial-number:00000003:xiaomi-lx04:1",
          "description": "Device Serial Number",
          "format": "string",
          "access": [
            "read"
          ]
        },
        {
          "iid": 4,
          "type": "urn:miot-spec-v2:property:firmware-revision:00000005:xiaomi-lx04:1",
          "description": "Current Firmware Version",
          "format": "string",
          "access": [
            "read"
          ]
        }
      ]
    },
    {
      "iid": 2,
      "type": "urn:miot-spec-v2:service:speaker:0000781C:xiaomi-lx04:1",
      "description": "Speaker",
      "properties": [
        {
          "iid": 1,
          "type": "urn:miot-spec-v2:property:volume:00000013:xiaomi-lx04:1",
          "description": "Volume",
          "format": "uint8",
          "access": [
            "read",
            "write"
          ],
          "unit": "percentage",
          "value-range": [
            5,
            100,
            1
          ]
        },
        {
          "iid": 2,
          "type": "urn:miot-spec-v2:property:mute:00000040:xiaomi-lx04:1",
          "description": "Mute",
          "format": "bool",
          "access": [
            "read",
            "write"
          ]
        }
      ]
    },
    {
      "iid": 3,
      "type": "urn:miot-spec-v2:service:play-control:0000781D:xiaomi-lx04:1",
      "description": "Play Control",
      "properties": [
        {
          "iid": 1,
          "type": "urn:miot-spec-v2:property:playing-state:00000041:xiaomi-lx04:1",
          "description": "Playing State",
          "format": "uint8",
          "access": [
            "read",
            "notify"
          ],
          "value-list": [
            {
              "value": 0,
              "description": "Pause"
            },
            {
              "value": 1,
              "description": "Playing"
            }
          ]
        }
      ],
      "actions": [
        {
          "iid": 1,
          "type": "urn:miot-spec-v2:action:play:0000280B:xiaomi-lx04:1",
          "description": "Play",
          "in": [],
          "out": []
        },
        {
          "iid": 2,
          "type": "urn:miot-spec-v2:action:pause:0000280C:xiaomi-lx04:1",
          "description": "Pause",
          "in": [],
          "out": []
        },
        {
          "iid": 3,
          "type": "urn:miot-spec-v2:action:next:0000280F:xiaomi-lx04:1",
          "description": "Next",
          "in": [],
          "out": []
        },
        {
          "iid": 4,
          "type": "urn:miot-spec-v2:action:previous:0000280E:xiaomi-lx04:1",
          "description": "Previous",
          "in": [],
          "out": []
        }
      ]
    },
    {
      "iid": 4,
      "type": "urn:miot-spec-v2:service:microphone:00007826:xiaomi-lx04:1",
      "description": "Microphone",
      "properties": [
        {
          "iid": 1,
          "type": "urn:miot-spec-v2:property:mute:00000040:xiaomi-lx04:1",
          "description": "Mute",
          "format": "bool",
          "access": [
            "read",
            "write"
          ]
        }
      ]
    },
    {
      "iid": 5,
      "type": "urn:miot-spec-v2:service:intelligent-speaker:0000789B:xiaomi-lx04:1",
      "description": "Intelligent Speaker",
      "properties": [
        {
          "iid": 1,
          "type": "urn:miot-spec-v2:property:text-content:000000FA:xiaomi-lx04:1",
          "description": "Text Content",
          "format": "string",
          "access": []
        },
        {
          "iid": 2,
          "type": "urn:miot-spec-v2:property:silent-execution:000000FB:xiaomi-lx04:1",
          "description": "Silent Execution",
          "format": "uint8",
          "access": [],
          "value-list": [
            {
              "value": 0,
              "description": "On"
            },
            {
              "value": 1,
              "description": "Off"
            }
          ]
        }
      ],
      "actions": [
        {
          "iid": 1,
          "type": "urn:miot-spec-v2:action:play-text:00002841:xiaomi-lx04:1",
          "description": "Play Text",
          "in": [
            1
          ],
          "out": []
        },
        {
          "iid": 2,
          "type": "urn:miot-spec-v2:action:wake-up:0000283F:xiaomi-lx04:1",
          "description": "Wake Up",
          "in": [
            1
          ],
          "out": []
        },
        {
          "iid": 3,
          "type": "urn:miot-spec-v2:action:play-radio:00002840:xiaomi-lx04:1",
          "description": "Play Radio",
          "in": [],
          "out": []
        },
        {
          "iid": 4,
          "type": "urn:miot-spec-v2:action:execute-text-directive:00002842:xiaomi-lx04:1",
          "description": "Execute Text Directive",
          "in": [
            1,
            2
          ],
          "out": []
        }
      ]
    },
    {
      "iid": 6,
      "type": "urn:miot-spec-v2:service:clock:0000789A:xiaomi-lx04:1",
      "description": "Clock",
      "actions": [
        {
          "iid": 1,
          "type": "urn:miot-spec-v2:action:stop-alarm:00002843:xiaomi-lx04:1",
          "description": "Stop Alarm",
          "in": [],
          "out": []
        }
      ]
    }
  ]
}

TTS正常,但是直接执行指令就不行,返回

/config # micli.py 5-4 查询天气 #1
{
  "did": "********",
  "miid": 0,
  "siid": 5,
  "aiid": 4,
  "code": -704220025,
  "exe_time": 0,
  "net_cost": 0,
  "ot_cost": 0,
  "otlocalts": 0,
  "oa_cost": 0,
  "_oa_rpc_cost": 0
}
回复

使用道具 举报

5

主题

141

帖子

787

积分

论坛技术达人

积分
787
金钱
641
HASS币
20
发表于 2021-3-14 22:21:07 | 显示全部楼层
micli.py action '{"did":"********","siid":5,"aiid":4,"in":["查询天气",1]}'

但是用这个命令可以正常执行....大概率是bug了,劳烦修一下
回复

使用道具 举报

35

主题

978

帖子

4507

积分

论坛元老

Rank: 8Rank: 8

积分
4507
金钱
3529
HASS币
20
发表于 2021-3-14 23:08:46 | 显示全部楼层
谢谢分享,帖子先收藏着,本来就是打算用小米的东西连入进来的。我目前的比较基础,慢慢完善
回复

使用道具 举报

21

主题

294

帖子

2551

积分

论坛技术达人

积分
2551
金钱
2207
HASS币
180

教程狂人

 楼主| 发表于 2021-3-21 08:37:44 | 显示全部楼层
hzx1987227 发表于 2021-3-14 21:51
{
  "type": "urn:miot-spec-v2:device:speaker:0000A015:xiaomi-lx04:1",
  "description": "Speaker",

你加-v运行试试,把结果解出来。我看了没有问题的,比如我的:

micli.py -v 5-4 查询天气 #1
https://api.io.mi.com/app/miotspec/action {'_nonce': 'QBxGZVxfP04BmwsF', 'data': '{"params": {"did": "267090026", "siid": 5, "aiid": 4, "in": ["\\u67e5\\u8be2\\u5929\\u6c14", 1]}}', 'signature': 'JtTGkBPmBJE8NwgYQiXJLKxmJEPN7iAgYCLKMOwgevI='}
{
  "did": "267090026",
  "miid": 0,
  "siid": 5,
  "aiid": 4,
  "code": 0,
  "exe_time": 0,
  "net_cost": 0,
  "ot_cost": 0,
  "otlocalts": 0,
  "oa_cost": 0,
  "_oa_rpc_cost": 0
}
回复

使用道具 举报

5

主题

141

帖子

787

积分

论坛技术达人

积分
787
金钱
641
HASS币
20
发表于 2021-3-21 14:35:27 | 显示全部楼层
Yonsm 发表于 2021-3-21 08:37
你加-v运行试试,把结果解出来。我看了没有问题的,比如我的:

~ # micli.py -v 5-4 查询天气 #1
https://api.io.mi.com/app/miotspec/action <function MiIOService.miio_request.<locals>.prepare_data at 0x7fc920ac20d0>
{
  "did": "267224386",
  "miid": 0,
  "siid": 5,
  "aiid": 4,
  "code": -704220025,
  "exe_time": 0,
  "net_cost": 0,
  "ot_cost": 0,
  "otlocalts": 0,
  "oa_cost": 0,
  "_oa_rpc_cost": 0
}
~ #

回复

使用道具 举报

14

主题

186

帖子

1657

积分

论坛技术达人

积分
1657
金钱
1451
HASS币
40
发表于 2021-3-21 18:20:13 | 显示全部楼层
似乎挂了? 执行小爱 5-4   5   code 都返回-704220025  -704053100, tts 都不会发声了, 大神看一下吧
回复

使用道具 举报

20

主题

247

帖子

1405

积分

金牌会员

Rank: 6Rank: 6

积分
1405
金钱
1153
HASS币
40
发表于 2021-3-21 18:42:34 | 显示全部楼层
很早,大概十几年前用你的celecmd源码做过衍生版,里面的UniBase.h我现在还在用
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-23 18:46 , Processed in 0.076594 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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