Skip to content

Commit

Permalink
Add missing function
Browse files Browse the repository at this point in the history
  • Loading branch information
AzonInc committed Sep 23, 2024
1 parent a8f0dea commit d71ac2a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
7 changes: 7 additions & 0 deletions components/tc_bus/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
13 changes: 10 additions & 3 deletions docs/de/reference/esphome-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
:::

Expand All @@ -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
Expand All @@ -84,6 +86,7 @@ on_...:
- tc_bus.send:
type: open_door
address: 0
payload: 0
serial_number: 123456
```

Expand Down Expand Up @@ -244,4 +247,8 @@ Here are the available command types you can use as binary sensor conditions or
- select_device_group_reset <Badge type="tip" text="COMMAND_TYPE_SELECT_DEVICE_GROUP_RESET" />
- search_devices <Badge type="tip" text="COMMAND_TYPE_SEARCH_DEVICES" />
- found_device <Badge type="tip" text="COMMAND_TYPE_FOUND_DEVICE" />
- found_device_subsystem <Badge type="tip" text="COMMAND_TYPE_FOUND_DEVICE_SUBSYSTEM" />
- found_device_subsystem <Badge type="tip" text="COMMAND_TYPE_FOUND_DEVICE_SUBSYSTEM" />
- programming_mode <Badge type="tip" text="COMMAND_TYPE_PROGRAMMING_MODE" />
- read_memory_block <Badge type="tip" text="COMMAND_TYPE_READ_MEMORY_BLOCK" />
- select_memory_page <Badge type="tip" text="COMMAND_TYPE_SELECT_MEMORY_PAGE" />
- write_memory <Badge type="tip" text="COMMAND_TYPE_WRITE_MEMORY" />
15 changes: 11 additions & 4 deletions docs/en/reference/esphome-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
:::

Expand All @@ -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
Expand All @@ -84,6 +86,7 @@ on_...:
- tc_bus.send:
type: open_door
address: 0
payload: 0
serial_number: 123456
```

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -244,4 +247,8 @@ Here are the available command types you can use as binary sensor conditions or
- select_device_group_reset <Badge type="tip" text="COMMAND_TYPE_SELECT_DEVICE_GROUP_RESET" />
- search_devices <Badge type="tip" text="COMMAND_TYPE_SEARCH_DEVICES" />
- found_device <Badge type="tip" text="COMMAND_TYPE_FOUND_DEVICE" />
- found_device_subsystem <Badge type="tip" text="COMMAND_TYPE_FOUND_DEVICE_SUBSYSTEM" />
- found_device_subsystem <Badge type="tip" text="COMMAND_TYPE_FOUND_DEVICE_SUBSYSTEM" />
- programming_mode <Badge type="tip" text="COMMAND_TYPE_PROGRAMMING_MODE" />
- read_memory_block <Badge type="tip" text="COMMAND_TYPE_READ_MEMORY_BLOCK" />
- select_memory_page <Badge type="tip" text="COMMAND_TYPE_SELECT_MEMORY_PAGE" />
- write_memory <Badge type="tip" text="COMMAND_TYPE_WRITE_MEMORY" />

0 comments on commit d71ac2a

Please sign in to comment.