| 本帖最后由 sundat 于 2022-6-13 15:15 编辑 
 他用的代码,我给各位复制出来了
    https://community.home-assistant ... sphome-style/382778
 
 
 
esphome:
  name: mmwave-occupancy
esp8266:
  board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
  password: "password"
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "mmWave-Occupancy"
    password: "password"
substitutions:
  device_name: mmwave-sensor
  
captive_portal:
web_server:
  port: 80
  version: 2
  include_internal: true
http_request:
  useragent: esphome/$device_name
  timeout: 2s
switch:
  - platform: safe_mode
    internal: true
    name: use_safe_mode
binary_sensor:
- platform: gpio
  name: mmwave_in_bedroom
  pin:
    number: GPIO16
    mode: INPUT_PULLDOWN
uart:
  id: uart_bus
  tx_pin: GPIO4
  rx_pin: GPIO5
  baud_rate: 115200
  debug:
    direction: BOTH
    dummy_receiver: true
    after:
      delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);
number:
  - platform: template
    name: distance
    id: distance
    min_value: 0
    max_value: 1350
    initial_value: 315
    optimistic: true
    step: 15
    restore_value: true
    unit_of_measurement: cm
    set_action:
      - uart.write: "sensorStop"
      - 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
      - uart.write: "sensorStart"
      
  - platform: template
    name: latency
    id: latency
    min_value: 0
    max_value: 65000
    initial_value: 12500
    optimistic: true
    step: 25
    restore_value: true
    unit_of_measurement: ms
    set_action:
      - uart.write: "sensorStop"
      - delay: 1s
      - uart.write: !lambda
                      int ms = (int)ceil(x / 25.0);
                      std::string mss = "outputLatency -1 0 " + to_string(ms);
                      return std::vector<unsigned char>(mss.begin(), mss.end());
      - delay: 1s
      - uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
      - delay: 1s
      - uart.write: "sensorStart"   
button:
  - platform: restart
    name: Restart $device_name
  - platform: template
    name: "factory_reset_sensor"
    id: "factory_reset_sensor"
    on_press:
      - uart.write: "sensorStop"
      - delay: 1s
      - uart.write: "factoryReset 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
      - delay: 3s
      - uart.write: "sensorStart" 
 
 |