From d71ac2adf0e0f36174cb220af0b3850d91494d57 Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 23 Sep 2024 15:25:34 +0200 Subject: [PATCH] Add missing function --- components/tc_bus/protocol.cpp | 7 +++++++ docs/de/reference/esphome-component.md | 13 ++++++++++--- docs/en/reference/esphome-component.md | 15 +++++++++++---- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/components/tc_bus/protocol.cpp b/components/tc_bus/protocol.cpp index f8c26d0..17a004c 100644 --- a/components/tc_bus/protocol.cpp +++ b/components/tc_bus/protocol.cpp @@ -127,6 +127,13 @@ namespace esphome command |= payload & 0xFFFF; // ABCD payload break; + case COMMAND_TYPE_SELECT_MEMORY_PAGE: + command |= (8 << 28); // 8 + command |= (1 << 24); // 1 + command |= (address & 0xF) << 20; // page + command |= serial_number & 0xFFFFF; + break; + default: break; } diff --git a/docs/de/reference/esphome-component.md b/docs/de/reference/esphome-component.md index 69f7971..a72e0bd 100644 --- a/docs/de/reference/esphome-component.md +++ b/docs/de/reference/esphome-component.md @@ -41,10 +41,12 @@ The **TCS Intercom Binary Sensor** detects binary states such as doorbell presse | `type` | Command type that will trigger the binary sensor, used alongside `address` and `serial_number`. Cannot be used with `command`. | No | `unknown` | | `address` | 8-bit address that serves as a condition to trigger the binary sensor. | No | `0` | | `address_lambda` | Lambda expression to evaluate whether the binary sensor should trigger based on the address. | No | | +| `payload` | 32-bit payload that serves as a condition to trigger the binary sensor. | No | `0` | +| `payload_lambda` | Lambda expression to evaluate whether the binary sensor should trigger based on the payload. | No | | | `serial_number` | Specific intercom serial number that serves as a condition to trigger the binary sensor. | No | `unknown` | ::: info -You can use **either** `command`/`command_lambda` **or** a combination of `type`, `address`/`address_lambda`, and `serial_number`, but **not both** simultaneously.\ +You can use **either** `command`/`command_lambda` **or** a combination of `type`, `address`/`address_lambda`, `payload`/`payload_lambda`, and `serial_number`, but **not both** simultaneously.\ This ensures the binary sensor triggers either through a specific command or a combination of parameters, preventing conflicts. ::: @@ -66,7 +68,7 @@ on_command_action: You can send commands on the bus using the `tc_bus.send` action. ::: tip Note -You can either use the `command` field to send a specific command or use the `type`, `address`, and `serial_number` fields to create a more complex message. **Both cannot be used at the same time**. +You can either use the `command` field to send a specific command or use the `type`, `address`, `payload`, and `serial_number` fields to create a more complex message. **Both cannot be used at the same time**. ::: #### Example 1: Sending a Direct Command @@ -84,6 +86,7 @@ on_...: - tc_bus.send: type: open_door address: 0 + payload: 0 serial_number: 123456 ``` @@ -244,4 +247,8 @@ Here are the available command types you can use as binary sensor conditions or - select_device_group_reset - search_devices - found_device -- found_device_subsystem \ No newline at end of file +- found_device_subsystem +- programming_mode +- read_memory_block +- select_memory_page +- write_memory \ No newline at end of file diff --git a/docs/en/reference/esphome-component.md b/docs/en/reference/esphome-component.md index 6e853fd..ccec8da 100644 --- a/docs/en/reference/esphome-component.md +++ b/docs/en/reference/esphome-component.md @@ -41,10 +41,12 @@ The **TCS Intercom Binary Sensor** detects binary states such as doorbell presse | `type` | Command type that will trigger the binary sensor, used alongside `address` and `serial_number`. Cannot be used with `command`. | No | `unknown` | | `address` | 8-bit address that serves as a condition to trigger the binary sensor. | No | `0` | | `address_lambda` | Lambda expression to evaluate whether the binary sensor should trigger based on the address. | No | | +| `payload` | 32-bit payload that serves as a condition to trigger the binary sensor. | No | `0` | +| `payload_lambda` | Lambda expression to evaluate whether the binary sensor should trigger based on the payload. | No | | | `serial_number` | Specific intercom serial number that serves as a condition to trigger the binary sensor. | No | `unknown` | ::: info -You can use **either** `command`/`command_lambda` **or** a combination of `type`, `address`/`address_lambda`, and `serial_number`, but **not both** simultaneously.\ +You can use **either** `command`/`command_lambda` **or** a combination of `type`, `address`/`address_lambda`, `payload`/`payload_lambda`, and `serial_number`, but **not both** simultaneously.\ This ensures the binary sensor triggers either through a specific command or a combination of parameters, preventing conflicts. ::: @@ -66,7 +68,7 @@ on_command_action: You can send commands on the bus using the `tc_bus.send` action. ::: tip Note -You can either use the `command` field to send a specific command or use the `type`, `address`, and `serial_number` fields to create a more complex message. **Both cannot be used at the same time**. +You can either use the `command` field to send a specific command or use the `type`, `address`, `payload`, and `serial_number` fields to create a more complex message. **Both cannot be used at the same time**. ::: #### Example 1: Sending a Direct Command @@ -84,6 +86,7 @@ on_...: - tc_bus.send: type: open_door address: 0 + payload: 0 serial_number: 123456 ``` @@ -146,7 +149,7 @@ Be sure to modify the command and event name as needed based on your configurati Here is an example configuration for the TCS Intercom component in ESPHome: ```yaml -# TC:BUS configuration +# TCS Intercom configuration tc_bus: id: my_tc_bus rx_pin: GPIO9 @@ -244,4 +247,8 @@ Here are the available command types you can use as binary sensor conditions or - select_device_group_reset - search_devices - found_device -- found_device_subsystem \ No newline at end of file +- found_device_subsystem +- programming_mode +- read_memory_block +- select_memory_page +- write_memory \ No newline at end of file