diff --git a/esphome/components/usb_uart/usb_uart.cpp b/esphome/components/usb_uart/usb_uart.cpp index cf66e4c369..75badfc0d5 100644 --- a/esphome/components/usb_uart/usb_uart.cpp +++ b/esphome/components/usb_uart/usb_uart.cpp @@ -242,7 +242,7 @@ void USBUartComponent::loop() { this->chunk_pool_.release(chunk); // Invoke the RX callback (if registered) immediately after data lands in the - // ring buffer. This lets consumers such as ZigbeeProxy process incoming bytes + // ring buffer. This lets consumers such as ZigbeeProxyTap process incoming bytes // in the same loop iteration they are delivered, avoiding an extra wakeup cycle. if (channel->rx_callback_) { channel->rx_callback_(); diff --git a/esphome/components/usb_uart/usb_uart.h b/esphome/components/usb_uart/usb_uart.h index 1f3c32d8cb..357e41c639 100644 --- a/esphome/components/usb_uart/usb_uart.h +++ b/esphome/components/usb_uart/usb_uart.h @@ -160,7 +160,7 @@ class USBUartChannelBase : public uart::UARTComponent, public Parented cb) { this->rx_callback_ = std::move(cb); } diff --git a/esphome/components/zigbee_proxy/__init__.py b/esphome/components/zigbee_proxy_tap/__init__.py similarity index 82% rename from esphome/components/zigbee_proxy/__init__.py rename to esphome/components/zigbee_proxy_tap/__init__.py index 6f73f5544d..c27c96b25f 100644 --- a/esphome/components/zigbee_proxy/__init__.py +++ b/esphome/components/zigbee_proxy_tap/__init__.py @@ -10,9 +10,9 @@ DEPENDENCIES = ["serial_proxy"] CONF_SERIAL_PROXY_ID = "serial_proxy_id" -zigbee_proxy_ns = cg.esphome_ns.namespace("zigbee_proxy") -ZigbeeProxy = zigbee_proxy_ns.class_( - "ZigbeeProxy", cg.Component, serial_proxy.SerialProxyTap +zigbee_proxy_tap_ns = cg.esphome_ns.namespace("zigbee_proxy_tap") +ZigbeeProxyTap = zigbee_proxy_tap_ns.class_( + "ZigbeeProxyTap", cg.Component, serial_proxy.SerialProxyTap ) @@ -29,7 +29,7 @@ def _final_validate(config: ConfigType) -> ConfigType: CONFIG_SCHEMA = cv.Schema( { - cv.GenerateID(): cv.declare_id(ZigbeeProxy), + cv.GenerateID(): cv.declare_id(ZigbeeProxyTap), cv.Required(CONF_SERIAL_PROXY_ID): cv.use_id(serial_proxy.SerialProxy), } ).extend(cv.COMPONENT_SCHEMA) @@ -42,6 +42,6 @@ async def to_code(config: ConfigType) -> None: var = cg.new_Pvariable(config[CONF_ID], sp) await cg.register_component(var, config) - cg.add_define("USE_ZIGBEE_PROXY") + cg.add_define("USE_ZIGBEE_PROXY_TAP") # Compiles the tap interface into serial_proxy; without it the port is a plain byte pipe cg.add_define("USE_SERIAL_PROXY_TAP") diff --git a/esphome/components/zigbee_proxy/ash_detector.cpp b/esphome/components/zigbee_proxy_tap/ash_detector.cpp similarity index 98% rename from esphome/components/zigbee_proxy/ash_detector.cpp rename to esphome/components/zigbee_proxy_tap/ash_detector.cpp index f88b6298f5..e0ffddd3ca 100644 --- a/esphome/components/zigbee_proxy/ash_detector.cpp +++ b/esphome/components/zigbee_proxy_tap/ash_detector.cpp @@ -1,8 +1,8 @@ #include "ash_detector.h" -#ifdef USE_ZIGBEE_PROXY +#ifdef USE_ZIGBEE_PROXY_TAP -namespace esphome::zigbee_proxy { +namespace esphome::zigbee_proxy_tap { // Control byte of an RSTACK, and the only ASH version byte that can follow it static constexpr uint8_t ASH_RSTACK_CONTROL = 0xC1; @@ -245,6 +245,6 @@ bool AshDetector::take_pending_ack(uint8_t &ack_num) { return true; } -} // namespace esphome::zigbee_proxy +} // namespace esphome::zigbee_proxy_tap -#endif // USE_ZIGBEE_PROXY +#endif // USE_ZIGBEE_PROXY_TAP diff --git a/esphome/components/zigbee_proxy/ash_detector.h b/esphome/components/zigbee_proxy_tap/ash_detector.h similarity index 96% rename from esphome/components/zigbee_proxy/ash_detector.h rename to esphome/components/zigbee_proxy_tap/ash_detector.h index eb14f88c39..92acac7eac 100644 --- a/esphome/components/zigbee_proxy/ash_detector.h +++ b/esphome/components/zigbee_proxy_tap/ash_detector.h @@ -1,14 +1,14 @@ #pragma once #include "esphome/core/defines.h" -#ifdef USE_ZIGBEE_PROXY +#ifdef USE_ZIGBEE_PROXY_TAP #include "ash_protocol.h" #include #include -namespace esphome::zigbee_proxy { +namespace esphome::zigbee_proxy_tap { // Decides when it is safe to acknowledge NCP frames on a client's behalf. // @@ -99,6 +99,6 @@ class AshDetector { bool ack_owed_{false}; }; -} // namespace esphome::zigbee_proxy +} // namespace esphome::zigbee_proxy_tap -#endif // USE_ZIGBEE_PROXY +#endif // USE_ZIGBEE_PROXY_TAP diff --git a/esphome/components/zigbee_proxy/ash_protocol.cpp b/esphome/components/zigbee_proxy_tap/ash_protocol.cpp similarity index 94% rename from esphome/components/zigbee_proxy/ash_protocol.cpp rename to esphome/components/zigbee_proxy_tap/ash_protocol.cpp index f0ee7c7504..eca457e1ef 100644 --- a/esphome/components/zigbee_proxy/ash_protocol.cpp +++ b/esphome/components/zigbee_proxy_tap/ash_protocol.cpp @@ -1,6 +1,6 @@ #include "ash_protocol.h" -namespace esphome::zigbee_proxy { +namespace esphome::zigbee_proxy_tap { static const uint16_t CRC_NIBBLE_TABLE[16] = {0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF}; @@ -38,4 +38,4 @@ size_t ash_build_ack_frame(uint8_t *output, uint8_t ack_num) { return pos; } -} // namespace esphome::zigbee_proxy +} // namespace esphome::zigbee_proxy_tap diff --git a/esphome/components/zigbee_proxy/ash_protocol.h b/esphome/components/zigbee_proxy_tap/ash_protocol.h similarity index 96% rename from esphome/components/zigbee_proxy/ash_protocol.h rename to esphome/components/zigbee_proxy_tap/ash_protocol.h index 0891b439f8..81d1f6fd7a 100644 --- a/esphome/components/zigbee_proxy/ash_protocol.h +++ b/esphome/components/zigbee_proxy_tap/ash_protocol.h @@ -3,7 +3,7 @@ #include #include -namespace esphome::zigbee_proxy { +namespace esphome::zigbee_proxy_tap { // ASH Protocol Constants static constexpr uint8_t ASH_FLAG_BYTE = 0x7E; // Frame delimiter @@ -48,4 +48,4 @@ static constexpr size_t ASH_ACK_FRAME_MAX_SIZE = 8; // ASH_ACK_FRAME_MAX_SIZE bytes, and returns its length. size_t ash_build_ack_frame(uint8_t *output, uint8_t ack_num); -} // namespace esphome::zigbee_proxy +} // namespace esphome::zigbee_proxy_tap diff --git a/esphome/components/zigbee_proxy/zigbee_proxy.cpp b/esphome/components/zigbee_proxy_tap/zigbee_proxy_tap.cpp similarity index 74% rename from esphome/components/zigbee_proxy/zigbee_proxy.cpp rename to esphome/components/zigbee_proxy_tap/zigbee_proxy_tap.cpp index c5cf71786e..ae82410e62 100644 --- a/esphome/components/zigbee_proxy/zigbee_proxy.cpp +++ b/esphome/components/zigbee_proxy_tap/zigbee_proxy_tap.cpp @@ -1,18 +1,18 @@ -#include "zigbee_proxy.h" +#include "zigbee_proxy_tap.h" -#ifdef USE_ZIGBEE_PROXY +#ifdef USE_ZIGBEE_PROXY_TAP #include "esphome/core/log.h" -namespace esphome::zigbee_proxy { +namespace esphome::zigbee_proxy_tap { -static const char *const TAG = "zigbee_proxy"; +static const char *const TAG = "zigbee_proxy_tap"; -void ZigbeeProxy::setup() { this->parent_->set_tap(this); } +void ZigbeeProxyTap::setup() { this->parent_->set_tap(this); } -void ZigbeeProxy::dump_config() { ESP_LOGCONFIG(TAG, "Zigbee Proxy:\n Port: %s", this->parent_->get_name()); } +void ZigbeeProxyTap::dump_config() { ESP_LOGCONFIG(TAG, "Zigbee Proxy Tap:\n Port: %s", this->parent_->get_name()); } -void ZigbeeProxy::on_device_rx(const uint8_t *data, size_t len) { +void ZigbeeProxyTap::on_device_rx(const uint8_t *data, size_t len) { for (size_t i = 0; i < len; i++) { // Observation only: the detector never gates forwarding, so it adds no latency and a // frame it cannot parse still reaches the client, which judges it for itself. @@ -37,7 +37,7 @@ void ZigbeeProxy::on_device_rx(const uint8_t *data, size_t len) { } } -void ZigbeeProxy::on_client_tx(const uint8_t *data, size_t len) { +void ZigbeeProxyTap::on_client_tx(const uint8_t *data, size_t len) { // Scanning this direction only matters while waiting for the version command that // completes the handshake. Outside that window it is skipped entirely -- which is what // makes a firmware upload, all of which flows this way, essentially free. @@ -49,13 +49,13 @@ void ZigbeeProxy::on_client_tx(const uint8_t *data, size_t len) { } } -void ZigbeeProxy::on_protocol_disabled() { +void ZigbeeProxyTap::on_protocol_disabled() { // A client turning protocol handling off is usually about to reflash the radio, so the // handshake we saw says nothing about what will be on the wire next. Forget it: a real // ASH session announces itself again with an RSTACK. this->detector_.reset(); } -} // namespace esphome::zigbee_proxy +} // namespace esphome::zigbee_proxy_tap -#endif // USE_ZIGBEE_PROXY +#endif // USE_ZIGBEE_PROXY_TAP diff --git a/esphome/components/zigbee_proxy/zigbee_proxy.h b/esphome/components/zigbee_proxy_tap/zigbee_proxy_tap.h similarity index 84% rename from esphome/components/zigbee_proxy/zigbee_proxy.h rename to esphome/components/zigbee_proxy_tap/zigbee_proxy_tap.h index 63d13698c0..702ae12eb7 100644 --- a/esphome/components/zigbee_proxy/zigbee_proxy.h +++ b/esphome/components/zigbee_proxy_tap/zigbee_proxy_tap.h @@ -1,13 +1,13 @@ #pragma once #include "esphome/core/defines.h" -#ifdef USE_ZIGBEE_PROXY +#ifdef USE_ZIGBEE_PROXY_TAP #include "esphome/components/serial_proxy/serial_proxy.h" #include "esphome/core/component.h" #include "ash_detector.h" -namespace esphome::zigbee_proxy { +namespace esphome::zigbee_proxy_tap { // Acknowledges the ASH frames of an EZSP NCP on behalf of a remote client, so the NCP's // ack timeout is measured against this device rather than against the network round trip @@ -17,9 +17,9 @@ namespace esphome::zigbee_proxy { // It never carries client traffic: the serial proxy owns the port and the bytes, and this // component only observes them. The sole exception is the acknowledgement itself, and it // is sent only once the handshake has proven the port really is carrying ASH. -class ZigbeeProxy : public serial_proxy::SerialProxyTap, public Component { +class ZigbeeProxyTap : public serial_proxy::SerialProxyTap, public Component { public: - explicit ZigbeeProxy(serial_proxy::SerialProxy *parent) : parent_(parent) {} + explicit ZigbeeProxyTap(serial_proxy::SerialProxy *parent) : parent_(parent) {} void setup() override; void dump_config() override; @@ -45,6 +45,6 @@ class ZigbeeProxy : public serial_proxy::SerialProxyTap, public Component { bool was_armed_{false}; }; -} // namespace esphome::zigbee_proxy +} // namespace esphome::zigbee_proxy_tap -#endif // USE_ZIGBEE_PROXY +#endif // USE_ZIGBEE_PROXY_TAP diff --git a/esphome/core/defines.h b/esphome/core/defines.h index afeb0dd737..0200901ba2 100644 --- a/esphome/core/defines.h +++ b/esphome/core/defines.h @@ -198,7 +198,7 @@ #define USE_VALVE #define USE_WATER_HEATER #define USE_WATER_HEATER_VISUAL_OVERRIDES -#define USE_ZIGBEE_PROXY +#define USE_ZIGBEE_PROXY_TAP #define USE_ZWAVE_PROXY #define USE_ZWAVE_PROXY_TAP diff --git a/tests/components/zigbee_proxy/.gitignore b/tests/components/zigbee_proxy_tap/.gitignore similarity index 100% rename from tests/components/zigbee_proxy/.gitignore rename to tests/components/zigbee_proxy_tap/.gitignore diff --git a/tests/components/zigbee_proxy/common.yaml b/tests/components/zigbee_proxy_tap/common.yaml similarity index 78% rename from tests/components/zigbee_proxy/common.yaml rename to tests/components/zigbee_proxy_tap/common.yaml index b2b8cf1f57..676925ab33 100644 --- a/tests/components/zigbee_proxy/common.yaml +++ b/tests/components/zigbee_proxy_tap/common.yaml @@ -14,7 +14,7 @@ uart: rx_pin: ${rx_pin} baud_rate: 115200 -# The port owns the UART and carries every byte; zigbee_proxy only taps it +# The port owns the UART and carries every byte; zigbee_proxy_tap only taps it serial_proxy: - id: zigbee_serial uart_id: zigbee_uart diff --git a/tests/components/zigbee_proxy/test-usb.esp32-s3-idf.yaml b/tests/components/zigbee_proxy_tap/test-usb.esp32-s3-idf.yaml similarity index 80% rename from tests/components/zigbee_proxy/test-usb.esp32-s3-idf.yaml rename to tests/components/zigbee_proxy_tap/test-usb.esp32-s3-idf.yaml index e3ee3e7116..a28488d6df 100644 --- a/tests/components/zigbee_proxy/test-usb.esp32-s3-idf.yaml +++ b/tests/components/zigbee_proxy_tap/test-usb.esp32-s3-idf.yaml @@ -16,11 +16,11 @@ usb_uart: baud_rate: 460800 # The tapped port may be a USB CDC ACM channel just as well as a hardware UART: -# zigbee_proxy never touches the UART itself, so it does not care which it is. +# zigbee_proxy_tap never touches the UART itself, so it does not care which it is. serial_proxy: - id: zigbee_usb_serial uart_id: zigbee_usb_channel name: Zigbee -zigbee_proxy: +zigbee_proxy_tap: serial_proxy_id: zigbee_usb_serial diff --git a/tests/components/zigbee_proxy/test.esp32-idf.yaml b/tests/components/zigbee_proxy_tap/test.esp32-idf.yaml similarity index 88% rename from tests/components/zigbee_proxy/test.esp32-idf.yaml rename to tests/components/zigbee_proxy_tap/test.esp32-idf.yaml index 4c27e96efd..877fbafa51 100644 --- a/tests/components/zigbee_proxy/test.esp32-idf.yaml +++ b/tests/components/zigbee_proxy_tap/test.esp32-idf.yaml @@ -7,5 +7,5 @@ esp32: <<: !include common.yaml -zigbee_proxy: +zigbee_proxy_tap: serial_proxy_id: zigbee_serial diff --git a/tests/components/zigbee_proxy/test.esp8266-ard.yaml b/tests/components/zigbee_proxy_tap/test.esp8266-ard.yaml similarity index 88% rename from tests/components/zigbee_proxy/test.esp8266-ard.yaml rename to tests/components/zigbee_proxy_tap/test.esp8266-ard.yaml index f08b9eee94..d9bcb21979 100644 --- a/tests/components/zigbee_proxy/test.esp8266-ard.yaml +++ b/tests/components/zigbee_proxy_tap/test.esp8266-ard.yaml @@ -7,5 +7,5 @@ esp8266: <<: !include common.yaml -zigbee_proxy: +zigbee_proxy_tap: serial_proxy_id: zigbee_serial diff --git a/tests/components/zigbee_proxy/test.rp2040-ard.yaml b/tests/components/zigbee_proxy_tap/test.rp2040-ard.yaml similarity index 85% rename from tests/components/zigbee_proxy/test.rp2040-ard.yaml rename to tests/components/zigbee_proxy_tap/test.rp2040-ard.yaml index 0837d4ee65..def235c516 100644 --- a/tests/components/zigbee_proxy/test.rp2040-ard.yaml +++ b/tests/components/zigbee_proxy_tap/test.rp2040-ard.yaml @@ -4,5 +4,5 @@ substitutions: <<: !include common.yaml -zigbee_proxy: +zigbee_proxy_tap: serial_proxy_id: zigbee_serial