73 lines
1.8 KiB
YAML
73 lines
1.8 KiB
YAML
uart:
|
|
id: uart_bus
|
|
tx_pin: GPIO13
|
|
rx_pin: GPIO14
|
|
baud_rate: 115200
|
|
debug:
|
|
direction: BOTH
|
|
dummy_receiver: true
|
|
after:
|
|
delimiter: "\n"
|
|
sequence:
|
|
- lambda: UARTDebug::log_string(direction, bytes);
|
|
|
|
binary_sensor:
|
|
- platform: gpio
|
|
name: mmWave
|
|
id: mmwave
|
|
device_class: occupancy
|
|
pin:
|
|
number: GPIO15
|
|
mode: INPUT_PULLDOWN
|
|
|
|
number:
|
|
- platform: template
|
|
id: mmwave_distance
|
|
name: mmWave distance
|
|
icon: mdi:arrow-left-right
|
|
entity_category: config
|
|
min_value: 0
|
|
max_value: 800
|
|
initial_value: 315
|
|
optimistic: true
|
|
step: 15
|
|
restore_value: true
|
|
unit_of_measurement: cm
|
|
mode: slider
|
|
set_action:
|
|
- switch.turn_off: mmwave_sensor
|
|
- delay: 1s
|
|
- uart.write: !lambda int cm = (int)ceil(x / 15.0);
|
|
std::string cms = "detRangeCfg -1 0 " + to_string(cm);
|
|
return std::vector<unsigned char>(cms.begin(), cms.end());
|
|
- delay: 1s
|
|
- uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
|
|
- delay: 1s
|
|
- switch.turn_on: mmwave_sensor
|
|
|
|
switch:
|
|
- platform: template
|
|
name: UART target output
|
|
id: uart_target_output
|
|
entity_category: config
|
|
internal: ${uart_target_output_disabled}
|
|
optimistic: true
|
|
assumed_state: false
|
|
turn_on_action:
|
|
- logger.log: "UART Target Output On"
|
|
- switch.turn_off: mmwave_sensor
|
|
- delay: 1s
|
|
- uart.write: "setUartOutput 2 1 1 1"
|
|
- delay: 1s
|
|
- uart.write: "saveConfig"
|
|
- delay: 3s
|
|
- switch.turn_on: mmwave_sensor
|
|
turn_off_action:
|
|
- logger.log: "UART Presence Output Off"
|
|
- switch.turn_off: mmwave_sensor
|
|
- delay: 1s
|
|
- uart.write: "setUartOutput 2 0"
|
|
- delay: 1s
|
|
- uart.write: "saveConfig"
|
|
- delay: 3s
|
|
- switch.turn_on: mmwave_sensor |