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 - platform: gpio pin: number: 33 mode: INPUT_PULLDOWN name: PIR id: pir_motion_sensor device_class: motion filters: - delayed_off: !lambda 'return id(pir_off_latency).state * 1000.0;' - platform: template name: Occupancy id: occupancy device_class: occupancy filters: - delayed_off: !lambda 'return id(occupancy_off_latency).state * 1000.0;' on_state: - lambda: 'id(illuminance_sensor).update();' lambda: |- if ( id(mmwave).state or id(pir_motion_sensor).state) { return true; } else if (id(mmwave).state == 0 and id(pir_motion_sensor).state == 0) { return false; } else { return id(occupancy).state; } 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(cms.begin(), cms.end()); - delay: 1s - uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89" - delay: 1s - switch.turn_on: mmwave_sensor - platform: template name: Occupancy off latency icon: mdi:clock-end entity_category: config id: occupancy_off_latency min_value: 1 max_value: 600 initial_value: 15 optimistic: true step: 5 restore_value: true unit_of_measurement: seconds mode: slider - platform: template name: PIR off latency icon: mdi:clock-end entity_category: config id: pir_off_latency min_value: 1 max_value: 120 initial_value: 10 optimistic: true step: 1 restore_value: true unit_of_measurement: seconds mode: slider - platform: template name: "Temperature Offset" id: temperature_offset_ui unit_of_measurement: "°C" min_value: -20 max_value: 20 step: 0.1 mode: box update_interval: never optimistic: true restore_value: true initial_value: 0 icon: "mdi:thermometer" entity_category: config on_value: - lambda: 'id(shtc3_sensor).update();' - platform: template name: "Humidity Offset" id: humidity_offset_ui unit_of_measurement: "%" min_value: -50 max_value: 50 step: 0.1 mode: box update_interval: never optimistic: true restore_value: true initial_value: 0 icon: "mdi:water-percent" entity_category: config on_value: - lambda: 'id(shtc3_sensor).update();' - platform: template name: "Illuminance Offset" id: illuminance_offset_ui unit_of_measurement: "lx" min_value: -50 max_value: 50 step: 1 mode: box update_interval: never optimistic: true restore_value: true initial_value: 0 icon: "mdi:brightness-5" entity_category: config on_value: - lambda: 'id(illuminance_sensor).update();' 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 light: - platform: status_led name: ESP32 status LED pin: GPIO32 entity_category: config disabled_by_default: False sensor: - platform: shtcx id: "shtc3_sensor" i2c_id: bus_a temperature: name: Temperature id: temperature_sensor filters: - offset: ${temperature_offset} - lambda: "return x + id(temperature_offset_ui).state;" humidity: name: Humidity id: humidity_sensor filters: - offset: ${humidity_offset} - lambda: "return x + id(humidity_offset_ui).state;" address: 0x70 update_interval: ${temperature_update_interval} - platform: bh1750 name: Illuminance id: illuminance_sensor i2c_id: bus_a address: 0x23 update_interval: ${illuminance_update_interval} filters: - calibrate_linear: method: exact datapoints: - 0.3 -> 0.3 - 0.9 -> 1.7 - 1.2 -> 3.6 - 3.2 -> 6.9 - 5.1 -> 10.2 - 6.8 -> 27.1 - 7.0 -> 13.5 - 7.4 -> 28.2 - 8.7 -> 21.7 - 8.9 -> 17.1 - 10.9 -> 20.4 - 12.8 -> 23.5 - 14.5 -> 31.2 - 14.9 -> 26.7 - 16.8 -> 41.1 - 16.9 -> 30.2 - 18.8 -> 33.4 - 19.1 -> 35.8 - 20.7 -> 37.0 - 24.3 -> 60.3 - 26.1 -> 68.6 - 26.7 -> 83.8 - 30.2 -> 75.9 - 32.6 -> 80.3 - 34.6 -> 83.2 - 40.4 -> 99.9 - 48.0 -> 183.7 - 48.3 -> 119.2 - 55.5 -> 141.3 - 55.8 -> 137.9 - 63.8 -> 157.6 - 71.5 -> 176.9 - 79.8 -> 197.1 - 84.3 -> 205.7 - lambda: "return x + id(illuminance_offset_ui).state;" - clamp: min_value: 0