RS485对接

使用方法

  • 参考如下json配置文件内容,将配置文件命名smart_bus.json,然后通过如下方式保存至设备端。json编辑方法推荐通过在线网站 http://www.kjson.com/jsoneditor/ 或 使用visual studio code软件编辑json文件,并保证json文件格式正确。

    注意:必须格式以及内容正确,不然会导致机器无法开机。

  • 如果出现导入485配置文件后,无法开机进入,说明是这个配置文件里的json文件内容异常,usb线连接屏,进去U盘把485配置文件先删除掉,然后su2.sh这个文件,通过电脑拷贝到弹出的磁盘里面去,然后重启一下机器。   su2.sh文件 点击下载

  • 通过电脑usb连接设备,拷贝文件至设备根目录。然后进入设备桌面>设置>智能家居>SmartBus配置>点击导入按钮。

协议定义

协议一级字段定义

{
  "version": 1, # 协议版本号,本版本必须为1
  "protocol": "rs485", # 协议为rs485协议,本协议该字段值必须为rs485
  "vendor": "厂商名字", # 厂商名,可为任意名字,后期会用来显示在界面上
  "description": "简易RS485协议", # 协议描述
  "baudrate": 9600, # 波特率,默认为9600
  "codeFormat": 0, # 0: code十六进制 1: ASCII码文本
  "supportRecv": 1, # 0: 主机只发送码 1: 主机可以接收相同的码更新状态
  "devices": [] # 设备或场景数组
}

协议二级字段定义(设备或场景)

{
  "version": 1,
  "protocol": "rs485",
  "vendor": "simple",
  "description": "简易RS485协议,支持主机发送设备码去控制,也支持设备码状态反馈(发送码跟接收码一致)",
  "baudrate": 9600,
  "codeFormat": 0,
  "supportRecv": 1,
  "devices": [
    {
      "actions": [
        {
          "action": "TurnOn",
          "instructions": [
            {
              "code": "0100000000000000",
              "desc": "打开"
            }
          ]
        },
        {
          "action": "TurnOff",
          "instructions": [
            {
              "code": "0100000000000001",
              "desc": "关闭"
            }
          ]
        },
        {
          "action": "SetBrightness",
          "instructions": [
            {
              "value": "25",
              "code": "010100000000025"
            },
            {
              "value": "50",
              "code": "0101000000000050"
            },
            {
              "value": "75",
              "code": "0101000000000075"
            },
            {
              "value": "100",
              "code": "0101000000000100"
            }
          ]
        },
        {
          "action": "SetColorTemperature",
          "instructions": [
            {
              "value": "25",
              "code": "010200000000025"
            },
            {
              "value": "50",
              "code": "0102000000000050"
            },
            {
              "value": "75",
              "code": "0102000000000075"
            },
            {
              "value": "100",
              "code": "0102000000000100"
            }
          ]
        }
      ],
      "brand": "品牌",
      "deviceId": "1",
      "deviceName": "大灯",
      "deviceType": "light",
      "icon": "",
      "model": "型号",
      "zone": "客厅"
    },
    {
      "actions": [
        {
          "action": "TurnOn",
          "instructions": [
            {
              "code": "0200000000000000",
              "desc": "打开"
            }
          ]
        },
        {
          "action": "TurnOff",
          "instructions": [
            {
              "code": "0200000000000001",
              "desc": "关闭"
            }
          ]
        }
      ],
      "brand": "品牌",
      "deviceId": "2",
      "deviceName": "客厅灯",
      "deviceType": "light",
      "icon": "",
      "model": "型号",
      "zone": "客厅"
    },
    {
      "actions": [
        {
          "action": "TurnOn",
          "instructions": [
            {
              "code": "0300000000000000",
              "desc": "打开"
            }
          ]
        },
        {
          "action": "TurnOff",
          "instructions": [
            {
              "code": "0300000000000001",
              "desc": "关闭"
            }
          ]
        }
      ],
      "brand": "品牌",
      "deviceId": "3",
      "deviceName": "开关",
      "deviceType": "switch",
      "icon": "",
      "model": "型号",
      "zone": "客厅"
    },
    {
      "actions": [
        {
          "action": "TurnOn",
          "instructions": [
            {
              "code": "0400000000000000",
              "desc": "打开"
            }
          ]
        },
        {
          "action": "TurnOff",
          "instructions": [
            {
              "code": "0400000000000001",
              "desc": "关闭"
            }
          ]
        }
      ],
      "brand": "品牌",
      "deviceId": "4",
      "deviceName": "大灯",
      "deviceType": "light",
      "icon": "",
      "model": "型号",
      "zone": "主卧"
    },
    {
      "actions": [
        {
          "action": "TurnOn",
          "instructions": [
            {
              "code": "2000000000000000",
              "desc": "打开"
            }
          ]
        },
        {
          "action": "TurnOff",
          "instructions": [
            {
              "code": "2000000000000001",
              "desc": "关闭"
            }
          ]
        },
        {
          "action": "Pause",
          "instructions": [
            {
              "code": "2000000000000002",
              "desc": "暂停"
            }
          ]
        }
      ],
      "brand": "品牌",
      "deviceId": "20",
      "deviceName": "窗帘",
      "deviceType": "curtain",
      "icon": "",
      "model": "型号",
      "zone": "客厅"
    },
    {
      "actions": [
        {
          "action": "TurnOn",
          "instructions": [
            {
              "code": "0A00000000000000",
              "desc": "打开"
            }
          ]
        },
        {
          "action": "TurnOff",
          "instructions": [
            {
              "code": "0A00000000000001",
              "desc": "关闭"
            }
          ]
        },
        {
          "action": "SetTemperature",
          "instructions": [
            {
              "value": "20",
              "code": "0A00000000000020"
            },
            {
              "value": "21",
              "code": "0A00000000000021"
            },
            {
              "value": "22",
              "code": "0A00000000000022"
            },
            {
              "value": "23",
              "code": "0A00000000000023"
            },
            {
              "value": "24",
              "code": "0A00000000000024"
            },
            {
              "value": "25",
              "code": "0A00000000000025"
            },
            {
              "value": "26",
              "code": "0A00000000000026"
            },
            {
              "value": "27",
              "code": "0A00000000000027"
            },
            {
              "value": "28",
              "code": "0A00000000000028"
            },
            {
              "value": "29",
              "code": "0A00000000000029"
            },
            {
              "value": "30",
              "code": "0A00000000000030"
            }
          ]
        },
        {
          "action": "SetMode",
          "instructions": [
            {
              "value": "auto",
              "code": "0A00000000000040",
              "desc": "自动"
            },
            {
              "value": "cold",
              "code": "0A00000000000041",
              "desc": "制冷"
            },
            {
              "value": "heat",
              "code": "0A00000000000042",
              "desc": "制热"
            },
            {
              "value": "airsupply",
              "code": "0A00000000000043",
              "desc": "送风"
            }
          ]
        },
        {
          "action": "SetWindSpeed",
          "instructions": [
            {
              "value": "auto",
              "code": "0A00000000000010",
              "desc": "自动风"
            },
            {
              "value": "high",
              "code": "0A00000000000011",
              "desc": "高风"
            },
            {
              "value": "medium",
              "code": "0A00000000000012",
              "desc": "中风"
            },
            {
              "value": "low",
              "code": "0A00000000000013",
              "desc": "低风"
            }
          ]
        },
        {
          "action": "SetSwing",
          "instructions": [
            {
              "value": "OpenUpAndDownSwing",
              "code": "0A00000000000030",
              "desc": "上下扫风"
            },
            {
              "value": "OpenLeftAndRightSwing",
              "code": "0A00000000000031",
              "desc": "左右扫风"
            },
            {
              "value": "CloseSwing",
              "code": "0A00000000000032",
              "desc": "停止扫风"
            }
          ]
        }
      ],
      "brand": "品牌",
      "deviceId": "10",
      "deviceName": "空调",
      "deviceType": "aircondition",
      "icon": "",
      "model": "型号",
      "zone": "客厅"
    },
    {
      "actions": [
        {
          "action": "TurnOn",
          "instructions": [
            {
              "code": "F100000000000001",
              "desc": "打开"
            }
          ]
        },
        {
          "action": "TurnOff",
          "instructions": [
            {
              "code": "F100000000000002",
              "desc": "关闭"
            }
          ]
        },
        {
          "action": "AdjustUpChannel",
          "instructions": [
            {
              "code": "F100000000000003",
              "desc": ""
            }
          ]
        },
        {
          "action": "AdjustDownChannel",
          "instructions": [
            {
              "code": "F100000000000004",
              "desc": ""
            }
          ]
        },
        {
          "action": "AdjustUpVolume",
          "instructions": [
            {
              "code": "F100000000000005",
              "desc": ""
            }
          ]
        },
        {
          "action": "AdjustDownVolume",
          "instructions": [
            {
              "code": "F100000000000006",
              "desc": "关闭"
            }
          ]
        },
        {
          "action": "Mute",
          "instructions": [
            {
              "code": "F100000000000007",
              "desc": "关闭"
            }
          ]
        }
      ],
      "brand": "品牌",
      "deviceId": "F1",
      "deviceName": "电视",
      "deviceType": "tv",
      "icon": "",
      "model": "型号",
      "zone": "客厅"
    },
    {
      "actions": [
        {
          "action": "TurnOn",
          "instructions": [
            {
              "code": "1100000000000000",
              "desc": "打开"
            }
          ]
        }
      ],
      "deviceId": "100",
      "deviceName": "晨起",
      "deviceType": "smartscene",
      "icon": ""
    },
    {
      "actions": [
        {
          "action": "TurnOn",
          "instructions": [
            {
              "code": "1100000000000001",
              "desc": "打开"
            }
          ]
        }
      ],
      "deviceId": "101",
      "deviceName": "睡眠",
      "deviceType": "smartscene",
      "icon": ""
    },
    {
      "actions": [
        {
          "action": "TurnOn",
          "instructions": [
            {
              "code": "1100000000000002",
              "desc": "打开"
            }
          ]
        }
      ],
      "deviceId": "102",
      "deviceName": "酒店",
      "deviceType": "smartscene",
      "icon": ""
    }
  ]
}

设备类型 (deviceType)

设备类型 设备类型定义
灯 light
窗帘 curtain
空调 aircondition
插座 outlet
开关 switch
空气净化器 airpurifier
新风机 airfresh
晾衣架 hanger
排插 sockets
温控器 temperature_ctrl
场景 smartscene

指令动作 (action)

动作名 动作定义
开 TurnOn
关 TurnOff
暂停 Pause
设置模式 SetMode
设置温度 SetTemperature
设置风速 SetWindSpeed
设置扫风 SetSwing
设置左右摆风 SwitchHorizontal
设置上下摆风 SwitchVertical
设置亮度 SetBrightness
设置色温 SetColorTemperature
设置颜色 SetColor
设置进度 SetProgress
灯光 SwitchLight
消毒 SwitchSterilize
风干 SwitchAirdry
烘干 SwitchDrying

附录

参考配置文件

  配置文件下载

results matching ""

    No results matching ""