From 81a0c1bbf88a970daa2b71fce5139af83e92abd2 Mon Sep 17 00:00:00 2001
From: Hello World <wuwentao2000@126.com>
Date: Wed, 22 Jan 2025 10:51:02 +0800
Subject: [PATCH] chore(doc): add get device type and sn in debug doc (#468)

---
 doc/debug.md      | 21 ++++++++++++++++++++-
 doc/debug_hans.md | 21 ++++++++++++++++++++-
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/doc/debug.md b/doc/debug.md
index 55e8f4d..524c5c2 100644
--- a/doc/debug.md
+++ b/doc/debug.md
@@ -5,6 +5,8 @@
 1. Install Add-on `[Advanced SSH & Web Terminal]` and disable `[Protected Mode]` once it done, you can ssh to your HAOS
 2. Use any SSH Terminal software (or HA `[Advanced SSH & Web Terminal]` add-on web UI)
 
+> disable `[Protected Mode]` can show HA Core docker container with docker command.
+
 ## Debug log
 
 you can use below two methods to enable debug log.
@@ -66,7 +68,7 @@ if you need to manual edit or change source code in `midea_ac_lan` for test purp
 
 ### edit `midealocal` source code
 
-`midealocal` is a python3 pip package, and it will be installed in HA core (a docker container in HAOS).
+`midealocal` is a python3 pip package, it has been installed in HA Core,and HA Core is a docker container in HAOS.
 
 1. ssh login to your HAOS
 2. enter HA Core docker in HAOS: `docker exec -it homeassistant /bin/bash`
@@ -96,3 +98,20 @@ you can use below command to get a device json config:
 
 > if there is no any error exist, please don't remove or edit this file.
 > if you want to change it, you can rename and backup it.
+
+## Get Device type and SN
+
+`midealocal` is a python3 pip package, it has been installed in HA Core,and HA Core is a docker container in HAOS.
+
+1. ssh login to your HAOS
+2. enter HA Core docker in HAOS: `docker exec -it homeassistant /bin/bash`
+3. run below command to get device type and device SN in HA Core shell `python3 -m midealocal.cli discover --get_sn --host 192.168.2.127` (replace the example ip address to your device IP).
+
+output example:
+
+```shell
+2025-01-21 18:06:33.552 INFO (MainThread) [cli] Found 1 devices.
+2025-01-21 18:06:33.552 INFO (MainThread) [cli] Found devices: {193514046726897: {'device_id': 193514046726897, 'type': 176, 'ip_address': '192.168.2.127', 'port': 6444, 'model': '0TG025JG', 'sn': 'xxxx', 'protocol': 3}}
+```
+
+post these output to us, it's a important debug info for your device, we can confirm with your device type/SN/protocol for debug purpose.
diff --git a/doc/debug_hans.md b/doc/debug_hans.md
index d5e33b4..507124f 100644
--- a/doc/debug_hans.md
+++ b/doc/debug_hans.md
@@ -5,6 +5,8 @@
 1. 安装 Add-on `[Advanced SSH & Web Terminal]` ,并禁用保护模式 `[Protected Mode]`
 2. 使用任意SSH终端软件(或者HA Web UI中使用 `[Advanced SSH & Web Terminal]` add-on)
 
+> 禁用保护模式 `[Protected Mode]`后才能在HAOS中使用docker命令显示和操作HA Core docker container.
+
 ## 调试日志Debug Log
 
 以下二种方法都可以打开调试日志Debug Log, 推荐使用修改`configuration.yaml`并重启HA的方法.
@@ -65,7 +67,7 @@
 
 ### 修改`midealocal`源代码
 
-`midealocal`是python3的pip package, 安装是HA core 中,(属于HAOS里面运行的一个docker container).
+`midealocal`是python3的pip package, 安装在HA core 中,而HA Core则属于HAOS里面运行的一个docker container.
 
 1. SSH登录HAOS
 2. 在HAOS中执行如下命令进入HA Core所在的docker: `docker exec -it homeassistant /bin/bash`
@@ -93,3 +95,20 @@
 3. 可以使用`ls`命令查看所有文件,可以使用`cat xxx.json`查看某个设备的配置信息,xxx为设备虚拟ID.
 
 > 如无特殊或者异常情况,一般不建议操作该文件。如需操作,可重命名备份该文件配置文件
+
+## 获取设备类型和SN
+
+`midealocal`是python3的pip package, 安装在HA core 中,而HA Core则属于HAOS里面运行的一个docker container.
+
+1. SSH登录HAOS
+2. 在HAOS中执行如下命令进入HA Core所在的docker: `docker exec -it homeassistant /bin/bash`
+3. 在HA Core的shell中执行如下命令来获取设备类型和SN: `python3 -m midealocal.cli discover --get_sn --host 192.168.2.127` (请替换示例命令中的IP为你的设备IP).
+
+执行以上命令的输出如下:
+
+```shell
+2025-01-21 18:06:33.552 INFO (MainThread) [cli] Found 1 devices.
+2025-01-21 18:06:33.552 INFO (MainThread) [cli] Found devices: {193514046726897: {'device_id': 193514046726897, 'type': 176, 'ip_address': '192.168.2.127', 'port': 6444, 'model': '0TG025JG', 'sn': 'xxxx', 'protocol': 3}}
+```
+
+请提供设备实际输出的内容, debug时需使用以上信息来确认设备的类型,协议,SN等.