Metainformationen zur Seite
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
digitales:hardware:sensoren:human_static_presence_module_lite_mr24hpc1 [24.04.2025] – gelöscht - Externe Bearbeitung (Unbekanntes Datum) 127.0.0.1 | digitales:hardware:sensoren:human_static_presence_module_lite_mr24hpc1 [25.05.2025] (aktuell) – cs | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | {{tag> | ||
+ | |||
+ | ====== Human Static Presence Module Lite (MR24HPC1) ====== | ||
+ | |||
+ | {{..: | ||
+ | |||
+ | ---- | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ^ XIAO ESP32C3 ^ 24GHz mmWave Human Static \\ Presence Module Lite ^ | ||
+ | | 5V | 5V | | ||
+ | | GND | GND | | ||
+ | | RX | D6 | | ||
+ | | TX | D7 | | ||
+ | |||
+ | ====== Nützliche Links ====== | ||
+ | |||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | |||
+ | ====== Code ====== | ||
+ | |||
+ | <code yaml xiao-esp32c3.yaml> | ||
+ | substitutions: | ||
+ | devicename: xiao-esp32c3 | ||
+ | upper_devicename: | ||
+ | |||
+ | esphome: | ||
+ | name: $devicename | ||
+ | friendly_name: | ||
+ | platformio_options: | ||
+ | board_build.flash_mode: | ||
+ | board_build.mcu: | ||
+ | includes: | ||
+ | - R24dvd.h | ||
+ | |||
+ | esp32: | ||
+ | board: esp32-c3-devkitm-1 | ||
+ | variant: esp32c3 | ||
+ | framework: | ||
+ | type: esp-idf | ||
+ | |||
+ | # Enable logging | ||
+ | logger: | ||
+ | hardware_uart: | ||
+ | level: DEBUG | ||
+ | |||
+ | packages: | ||
+ | wifi: !include packages/ | ||
+ | mqtt: !include packages/ | ||
+ | ota: !include packages/ | ||
+ | time: !include packages/ | ||
+ | |||
+ | # Enable Home Assistant API | ||
+ | api: | ||
+ | |||
+ | # | ||
+ | |||
+ | # part 3: | ||
+ | uart: | ||
+ | id: uart_bus | ||
+ | baud_rate: | ||
+ | rx_pin: 20 | ||
+ | tx_pin: 21 | ||
+ | |||
+ | select: | ||
+ | - platform: template | ||
+ | name: " | ||
+ | id: scene_mode | ||
+ | icon: mdi: | ||
+ | optimistic: true | ||
+ | options: | ||
+ | - " | ||
+ | - "Area detection" | ||
+ | - " | ||
+ | - " | ||
+ | initial_option: | ||
+ | set_action: | ||
+ | - logger.log: | ||
+ | format: "set action option: %s" | ||
+ | args: [" | ||
+ | - uart.write: !lambda | ||
+ | auto index = id(scene_mode).index_of(x); | ||
+ | uint8_t value = (uint8_t)index.value() + 1; | ||
+ | uint8_t crc = value + 0xB9; | ||
+ | return {0x53, | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: unmanned_time | ||
+ | icon: mdi: | ||
+ | optimistic: true | ||
+ | options: | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | initial_option: | ||
+ | set_action: | ||
+ | - logger.log: | ||
+ | format: " | ||
+ | args: [" | ||
+ | - uart.write: !lambda | ||
+ | auto index = id(unmanned_time).index_of(x); | ||
+ | uint8_t value = (uint8_t)index.value(); | ||
+ | uint8_t crc = value + 0x37; | ||
+ | return {0x53, | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: custom_presence_of_perception_boundary | ||
+ | optimistic: true | ||
+ | options: | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | set_action: | ||
+ | - logger.log: | ||
+ | format: " | ||
+ | args: [" | ||
+ | - uart.write: !lambda | ||
+ | auto index = id(unmanned_time).index_of(x); | ||
+ | uint8_t value = (uint8_t)index.value() + 1; | ||
+ | uint8_t crc = value + 0xBF; | ||
+ | return {0x53, | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: custom_motion_trigger_boundary | ||
+ | optimistic: true | ||
+ | options: | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | set_action: | ||
+ | - logger.log: | ||
+ | format: " | ||
+ | args: [" | ||
+ | - uart.write: !lambda | ||
+ | auto index = id(unmanned_time).index_of(x); | ||
+ | uint8_t value = (uint8_t)index.value() + 1; | ||
+ | uint8_t crc = value + 0xC0; | ||
+ | return {0x53, | ||
+ | |||
+ | number: | ||
+ | - platform: template | ||
+ | id: sensitivity | ||
+ | name: " | ||
+ | icon: mdi: | ||
+ | min_value: 0 | ||
+ | max_value: 3 | ||
+ | optimistic: false | ||
+ | step: 1 | ||
+ | update_interval: | ||
+ | set_action: | ||
+ | - uart.write: !lambda | ||
+ | uint8_t crc = x + 0xBA; | ||
+ | return {0x53, | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: moving_target_detection_max_distance | ||
+ | icon: mdi: | ||
+ | unit_of_measurement: | ||
+ | min_value: 0 | ||
+ | max_value: 65536 | ||
+ | step: 500 | ||
+ | set_action: | ||
+ | - uart.write: !lambda | ||
+ | int h_num = (int)x>> | ||
+ | int l_num = (int)x & 0xff; | ||
+ | int crc = 0xB6 + h_num + l_num; | ||
+ | return {0x53, | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: static_target_detection_max_distance | ||
+ | icon: mdi: | ||
+ | unit_of_measurement: | ||
+ | min_value: 0 | ||
+ | max_value: 65536 | ||
+ | step: 500 | ||
+ | set_action: | ||
+ | - uart.write: !lambda | ||
+ | int h_num = (int)x>> | ||
+ | int l_num = (int)x & 0xff; | ||
+ | int crc = 0xB9 + h_num + l_num; | ||
+ | return {0x53, | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: custom_judgment_threshold_exists | ||
+ | min_value: 0 | ||
+ | max_value: 250 | ||
+ | step: 1 | ||
+ | set_action: | ||
+ | - uart.write: !lambda | ||
+ | int crc = 0xBD + (int)x; | ||
+ | return {0x53, | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: custom_motion_amplitude_trigger_threshold | ||
+ | min_value: 0 | ||
+ | max_value: 250 | ||
+ | step: 1 | ||
+ | set_action: | ||
+ | - uart.write: !lambda | ||
+ | int crc = 0xBE + (int)x; | ||
+ | return {0x53, | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: custom_mode_settings | ||
+ | icon: mdi:cog | ||
+ | min_value: 0 | ||
+ | max_value: 250 | ||
+ | step: 1 | ||
+ | set_action: | ||
+ | - uart.write: !lambda | ||
+ | int crc = 0xBB + (int)x; | ||
+ | return {0x53, | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: custom_mode_setting_completed | ||
+ | icon: mdi:cog | ||
+ | min_value: 0 | ||
+ | max_value: 250 | ||
+ | step: 1 | ||
+ | set_action: | ||
+ | - uart.write: !lambda | ||
+ | int crc = 0xBC + (int)x; | ||
+ | return {0x53, | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | icon: mdi:cog | ||
+ | id: custom_mode_query | ||
+ | min_value: 0 | ||
+ | max_value: 250 | ||
+ | step: 1 | ||
+ | set_action: | ||
+ | - uart.write: !lambda | ||
+ | int crc = 0x3B + (int)x; | ||
+ | return {0x53, | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: custom_motion_trigger_time | ||
+ | icon: mdi: | ||
+ | unit_of_measurement: | ||
+ | min_value: 0 | ||
+ | max_value: 4294967295 | ||
+ | step: 5000 | ||
+ | set_action: | ||
+ | - uart.write: !lambda | ||
+ | int crc = 0xC4 + (int)x; | ||
+ | int h24_num = ((int)x>> | ||
+ | int h16_num = ((int)x>> | ||
+ | int h8_num = ((int)x>> | ||
+ | int l8_num = (int)x & 0xff; | ||
+ | return {0x53, | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: custom_movement_to_rest_time | ||
+ | icon: mdi: | ||
+ | unit_of_measurement: | ||
+ | min_value: 0 | ||
+ | max_value: 4294967295 | ||
+ | step: 5000 | ||
+ | set_action: | ||
+ | - uart.write: !lambda | ||
+ | int crc = 0xC5 + (int)x; | ||
+ | int h24_num = ((int)x>> | ||
+ | int h16_num = ((int)x>> | ||
+ | int h8_num = ((int)x>> | ||
+ | int l8_num = (int)x & 0xff; | ||
+ | return {0x53, | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: custom_time_of_enter_unmanned | ||
+ | icon: mdi: | ||
+ | unit_of_measurement: | ||
+ | min_value: 0 | ||
+ | max_value: 4294967295 | ||
+ | step: 5000 | ||
+ | set_action: | ||
+ | - uart.write: !lambda | ||
+ | int crc = 0xC6 + (int)x; | ||
+ | int h24_num = ((int)x>> | ||
+ | int h16_num = ((int)x>> | ||
+ | int h8_num = ((int)x>> | ||
+ | int l8_num = (int)x & 0xff; | ||
+ | return {0x53, | ||
+ | |||
+ | text_sensor: | ||
+ | - platform: custom | ||
+ | lambda: |- | ||
+ | auto my_custom_sensor = new MyCustomTextSensor(); | ||
+ | App.register_component(my_custom_sensor); | ||
+ | return {my_custom_sensor-> | ||
+ | |||
+ | text_sensors: | ||
+ | - name: " | ||
+ | icon: mdi: | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: product_mode | ||
+ | icon: mdi: | ||
+ | on_raw_value: | ||
+ | then: | ||
+ | - logger.log: text_sensor on_raw_value | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: product_id | ||
+ | icon: mdi: | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: hardware_model | ||
+ | icon: mdi: | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: firmware_version | ||
+ | icon: mdi: | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: protocol_type | ||
+ | icon: mdi: | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: keep_away | ||
+ | icon: mdi:walk | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: motion_status | ||
+ | icon: mdi: | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: someoneExists | ||
+ | icon: " | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: custom_presence_of_detection | ||
+ | icon: mdi: | ||
+ | |||
+ | # - platform: template | ||
+ | # name: " | ||
+ | # id: custom_motion_distance | ||
+ | |||
+ | # - platform: template | ||
+ | # name: " | ||
+ | # id: custom_static_distance | ||
+ | |||
+ | # - platform: template | ||
+ | # name: " | ||
+ | # id: custom_spatial_static_value | ||
+ | |||
+ | # - platform: template | ||
+ | # name: " | ||
+ | # id: custom_spatial_motion_value | ||
+ | |||
+ | # - platform: template | ||
+ | # name: " | ||
+ | # id: custom_motion_speed | ||
+ | |||
+ | button: | ||
+ | - platform: template | ||
+ | name: " | ||
+ | id: " | ||
+ | icon: mdi:reload | ||
+ | on_press: | ||
+ | then: | ||
+ | - logger.log: Button Pressed | ||
+ | - uart.write: [0x53, | ||
+ | |||
+ | switch: | ||
+ | - platform: template | ||
+ | id: output_info_switch | ||
+ | name: " | ||
+ | icon: mdi: | ||
+ | assumed_state: | ||
+ | turn_on_action: | ||
+ | - uart.write: [0x53, | ||
+ | - delay: 1s | ||
+ | - lambda: !lambda |- | ||
+ | id(product_mode).publish_state("" | ||
+ | id(product_id).publish_state("" | ||
+ | id(hardware_model).publish_state("" | ||
+ | id(firmware_version).publish_state("" | ||
+ | id(protocol_type).publish_state("" | ||
+ | turn_off_action: | ||
+ | - uart.write: [0x53, | ||
+ | |||
+ | sensor: | ||
+ | - platform: custom | ||
+ | lambda: |- | ||
+ | auto my_custom_sensor = new UartReadLineSensor(id(uart_bus)); | ||
+ | App.register_component(my_custom_sensor); | ||
+ | return { | ||
+ | my_custom_sensor-> | ||
+ | my_custom_sensor-> | ||
+ | }; | ||
+ | sensors: | ||
+ | - name: " | ||
+ | id: movementSigns | ||
+ | icon: " | ||
+ | device_class: | ||
+ | state_class: | ||
+ | |||
+ | - name: " | ||
+ | id: inited | ||
+ | icon: mdi: | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: custom_motion_distance | ||
+ | icon: mdi: | ||
+ | on_value: | ||
+ | then: | ||
+ | # - logger.log: Custom Motion distance on_value | ||
+ | - logger.log: | ||
+ | format: " | ||
+ | args: [" | ||
+ | on_raw_value: | ||
+ | then: | ||
+ | - logger.log: | ||
+ | format: " | ||
+ | args: [" | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: custom_static_distance | ||
+ | icon: mdi: | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: custom_spatial_static_value | ||
+ | icon: mdi:counter | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: custom_spatial_motion_value | ||
+ | icon: mdi:counter | ||
+ | |||
+ | - platform: template | ||
+ | name: " | ||
+ | id: custom_motion_speed | ||
+ | icon: mdi: | ||
+ | </ | ||
+ | |||