跳转到内容

UART 开关

uart 开关平台允许你在触发时向 UART 总线 发送预定义的字节序列。

# Example configuration entry
switch:
- platform: uart
name: "UART String Output"
data: 'DataToSend'
- platform: uart
name: "UART Bytes Output"
data: [0xDE, 0xAD, 0xBE, 0xEF]
- platform: uart
name: "UART Recurring Output"
data: [0xDE, 0xAD, 0xBE, 0xEF]
send_every: 1s
- platform: uart
name: "UART On/Off"
data:
turn_on: "TurnOn\r\n"
turn_off: "TurnOff\r\n"
  • uart_id(可选,ID):手动指定 UART 中心的 ID。

  • data(可选,字符串或字节列表):要通过 UART 发送的数据。可以是 ASCII 字符串 或字节列表或以下嵌套选项之一或两者(参见上面的示例)。

    • turn_on(可选,字符串或字节列表):打开时要发送的数据。
    • turn_off(可选,字符串或字节列表):关闭时要发送的数据。
  • send_every(可选,Time):定期发送数据,而不是只发送一次。

  • Switch 中的所有其他选项。