From 965016d0efb1747d95c909ff76e35d80ef325c69 Mon Sep 17 00:00:00 2001 From: Marcelo Borges Date: Thu, 21 May 2026 09:12:09 +0100 Subject: [PATCH] Allow network_device without USB device Make the 'device' option optional in the schema so users with network-connected RCP radios (via network_device) don't need a USB serial device configured. Use bashio::config.has_value for both device and network_device validation instead of -z string test, which fails to catch bashio's literal 'null' string for unset options. --- openthread_border_router/config.yaml | 2 +- .../rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/openthread_border_router/config.yaml b/openthread_border_router/config.yaml index ce93af94a..1a2811c9b 100644 --- a/openthread_border_router/config.yaml +++ b/openthread_border_router/config.yaml @@ -39,7 +39,7 @@ ports_description: 8080/tcp: OpenThread Web port 8081/tcp: OpenThread REST API port schema: - device: device(subsystem=tty) + device: device(subsystem=tty)? baudrate: list(57600|115200|230400|460800|921600|1000000) flow_control: bool backbone_interface: str? diff --git a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run index 36a4c73ad..07b74448d 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run +++ b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run @@ -42,10 +42,14 @@ if [ "$(cat /proc/sys/net/ipv6/conf/all/forwarding)" != "1" ]; then bashio::log.warning "IPv6 routing/forwarding is not enabled! Make sure the Home Assistant host has IPv6 forwarding enabled." fi -device=$(bashio::config 'device') +if ! bashio::config.has_value 'device' && ! bashio::config.has_value 'network_device'; then + bashio::exit.nok "No device configured. Set either 'device' (serial port) or 'network_device' (TCP host:port)." +fi if bashio::config.has_value 'network_device'; then device="/tmp/ttyOTBR" +else + device="$(bashio::config 'device')" fi baudrate=$(bashio::config 'baudrate')