diff --git a/Integrations/ESPHome/MSR-2.yaml b/Integrations/ESPHome/MSR-2.yaml index ae2ba75..e44264a 100644 --- a/Integrations/ESPHome/MSR-2.yaml +++ b/Integrations/ESPHome/MSR-2.yaml @@ -1,7 +1,7 @@ #Define Project substitutions: name: apollo-msr-2 - version: "24.7.5.2" + version: "24.7.5.1" device_description: ${name} made by Apollo Automation - version ${version}. esphome: diff --git a/Integrations/ESPHome/MSR-2_BLE.yaml b/Integrations/ESPHome/MSR-2_BLE.yaml index 9f1af46..d02cef8 100644 --- a/Integrations/ESPHome/MSR-2_BLE.yaml +++ b/Integrations/ESPHome/MSR-2_BLE.yaml @@ -40,631 +40,11 @@ esp32: dashboard_import: package_import_url: github://ApolloAutomation/MSR-2/Integrations/ESPHome/MSR-2.yaml import_full_config: false - - -globals: - - id: button_press_timestamp - restore_value: no - type: uint32_t - initial_value: '0' - - id: runTest - restore_value: yes - type: bool - initial_value: "true" - - id: testCycleCount - type: int - restore_value: no - initial_value: "0" - - id: dps310Passed - restore_value: no - type: bool - initial_value: "false" - - id: ltr390lightPassed - restore_value: no - type: bool - initial_value: "false" - - id: ltr390uvindexPassed - restore_value: no - type: bool - initial_value: "false" - - id: ld2410Passed - restore_value: no - type: bool - initial_value: "false" - -# Enable Home Assistant API -# Also Add Buzzer Service Connection -api: - services: - - service: play_buzzer - variables: - song_str: string - then: - - rtttl.play: - rtttl: !lambda 'return song_str;' - - #Co2 Calibration Service - - service: calibrate_co2_value - variables: - co2_ppm: float - then: - - scd4x.perform_forced_calibration: - value: !lambda 'return co2_ppm;' - id: scd40 - - #Setting HLK Password - - service: set_ld2410_bluetooth_password - variables: - password: string - then: - - bluetooth_password.set: - id: ld2410_radar - password: !lambda 'return password;' - -ota: - - platform: esphome - id: ota_default - -bluetooth_proxy: - active: true - -wifi: - ap: - ssid: "Apollo MSR2 Hotspot" - -captive_portal: - -web_server: - port: 80 - - - -# Set Up Key Ports For Communication -i2c: - sda: GPIO1 - scl: GPIO0 - id: bus_a - -uart: - tx_pin: GPIO21 - rx_pin: GPIO20 - baud_rate: 256000 - parity: NONE - stop_bits: 1 - -# Numbers For Configuration -number: - - platform: ld2410 - timeout: - name: Radar Timeout - max_move_distance_gate: - name: Radar Max Move Distance - max_still_distance_gate: - name: Radar Max Still Distance - g0: - move_threshold: - name: g0 move threshold - still_threshold: - name: g0 still threshold - g1: - move_threshold: - name: g1 move threshold - still_threshold: - name: g1 still threshold - g2: - move_threshold: - name: g2 move threshold - still_threshold: - name: g2 still threshold - g3: - move_threshold: - name: g3 move threshold - still_threshold: - name: g3 still threshold - g4: - move_threshold: - name: g4 move threshold - still_threshold: - name: g4 still threshold - g5: - move_threshold: - name: g5 move threshold - still_threshold: - name: g5 still threshold - g6: - move_threshold: - name: g6 move threshold - still_threshold: - name: g6 still threshold - g7: - move_threshold: - name: g7 move threshold - still_threshold: - name: g7 still threshold - g8: - move_threshold: - name: g8 move threshold - still_threshold: - name: g8 still threshold - - - - platform: template - name: DPS Temperature Offset - id: dps310_temperature_offset - restore_value: true - initial_value: 14.54 - min_value: -70.0 - max_value: 70.0 - entity_category: "CONFIG" - unit_of_measurement: "°C" - optimistic: true - update_interval: never - step: 0.1 - mode: box -# Setting start of zone 1 occupancy - - platform: template - name: "Radar Zone 1 Start" - id: radar_z1_start - device_class: distance - min_value: 0 - max_value: 800 - step: 1 - mode: box - update_interval: never - optimistic: true - restore_value: true - initial_value: 0 - icon: "mdi:arrow-collapse-right" - entity_category: CONFIG - unit_of_measurement: "cm" - - # Setting ending of zone 1 occupancy - - platform: template - name: "Radar End Zone 1" - id: radar_z1_end - device_class: distance - min_value: 0 - max_value: 800 - step: 1 - mode: box - update_interval: never - optimistic: true - restore_value: true - initial_value: 50 - icon: "mdi:arrow-collapse-right" - entity_category: CONFIG - unit_of_measurement: "cm" - - # Setting ending of zone 2 occupancy - - platform: template - name: "Radar End Zone 2" - id: radar_z2_end - device_class: distance - min_value: 0 - max_value: 800 - step: 1 - mode: box - update_interval: never - optimistic: true - restore_value: true - initial_value: 150 - icon: "mdi:arrow-collapse-right" - entity_category: CONFIG - unit_of_measurement: "cm" - - # Setting ending of zone 3 occupancy - - platform: template - name: "Radar End Zone 3" - id: radar_z3_end - device_class: distance - min_value: 0 - max_value: 800 - step: 1 - mode: box - update_interval: never - optimistic: true - restore_value: true - initial_value: 250 - icon: "mdi:arrow-collapse-right" - entity_category: CONFIG - unit_of_measurement: "cm" - -# Buzzer -output: - - platform: ledc - pin: GPIO10 - id: buzzer -rtttl: - output: buzzer - - - -binary_sensor: - - platform: status - name: Online - id: ink_ha_connected - - platform: ld2410 - has_target: - name: Radar Target - id: radar_has_target - has_moving_target: - name: Radar Moving Target - id: radar_has_moving_target - has_still_target: - name: Radar Still Target - id: radar_has_still_target - ## Set Up Radar Zones Based On Distance - - platform: template - name: "Radar Zone 1 Occupancy" - id: radar_zone_1_occupancy - device_class: occupancy - icon: mdi:motion-sensor - lambda: |- - if ((id(radar_has_target).state) && ((id(radar_detection_distance).state < id(radar_z1_end).state) && (id(radar_detection_distance).state > id(radar_z1_start).state))){ - return true; - } else { - return false; - } - - platform: template - name: "Radar Zone 2 Occupancy" - id: radar_zone_2_occupancy - device_class: occupancy - icon: mdi:motion-sensor - lambda: |- - if ((id(radar_has_target).state) && ((id(radar_z1_end).state < id(radar_detection_distance).state) && (id(radar_detection_distance).state < id(radar_z2_end).state))) { - return true; - } else { - return false; - } - - platform: template - name: "Radar Zone 3 Occupancy" - id: radar_zone_3_occupancy - device_class: occupancy - icon: mdi:motion-sensor - lambda: |- - if ((id(radar_has_target).state) && ((id(radar_z2_end).state < id(radar_detection_distance).state) && (id(radar_detection_distance).state < id(radar_z3_end).state))) { - return true; - } else { - return false; - } - - platform: gpio - pin: - number: GPIO9 - inverted: true - ignore_strapping_warning: true - mode: - input: true - pullup: true - id: reset_button - on_press: - then: - - lambda: |- - id(button_press_timestamp) = millis(); - - on_release: - then: - - lambda: |- - if (millis() - id(button_press_timestamp) >= 1000) { - id(testCycleCount) = 0; - id(runTest) = true; - id(testScript).execute(); - } - else if (millis() - id(button_press_timestamp) >= 8000) { - id(factory_reset_switch).turn_on(); - - } - -ld2410: - id: ld2410_radar - - - -sensor: - - platform: internal_temperature - name: "ESP Temperature" - id: sys_esp_temperature - - - - platform: uptime - name: Uptime - id: sys_uptime - update_interval: 60s - - - - platform: wifi_signal - name: RSSI - id: wifi_signal_db - update_interval: 60s - entity_category: "diagnostic" - - - platform: scd4x - id: scd40 - co2: - name: "CO2" - id: "co2" - automatic_self_calibration: false - update_interval: 60s - measurement_mode: "periodic" - i2c_id: bus_a - ambient_pressure_compensation_source: dps310pressure - - - - platform: ld2410 - moving_distance: - name: Radar Moving Distance - id: moving_distance - still_distance: - name: Radar Still Distance - id: still_distance - moving_energy: - name: Radar Move Energy - id: radar_moving_energy - still_energy: - name: Radar Still Energy - id: radar_still_energy - detection_distance: - name: Radar Detection Distance - id: radar_detection_distance - g0: - move_energy: - name: g0 move energy - state_class: measurement - still_energy: - name: g0 still energy - state_class: measurement - g1: - move_energy: - name: g1 move energy - state_class: measurement - still_energy: - name: g1 still energy - state_class: measurement - g2: - move_energy: - name: g2 move energy - state_class: measurement - still_energy: - name: g2 still energy - state_class: measurement - g3: - move_energy: - name: g3 move energy - state_class: measurement - still_energy: - name: g3 still energy - state_class: measurement - g4: - move_energy: - name: g4 move energy - state_class: measurement - still_energy: - name: g4 still energy - state_class: measurement - g5: - move_energy: - name: g5 move energy - state_class: measurement - still_energy: - name: g5 still energy - state_class: measurement - g6: - move_energy: - name: g6 move energy - state_class: measurement - still_energy: - name: g6 still energy - state_class: measurement - g7: - move_energy: - name: g7 move energy - state_class: measurement - still_energy: - name: g7 still energy - state_class: measurement - g8: - move_energy: - name: g8 move energy - state_class: measurement - still_energy: - name: g8 still energy - state_class: measurement - - - platform: ltr390 - id: ltr_390 - light: - name: "LTR390 Light" - id: ltr390light - uv_index: - name: "LTR390 UV Index" - id: ltr390uvindex - - - platform: dps310 - id: dps_310 - pressure: - name: "DPS310 Pressure" - id: dps310pressure - temperature: - name: "DPS310 Temperature" - id: dps310temperature - filters: - - lambda: return x - id(dps310_temperature_offset).state; - update_interval: 30s - i2c_id: bus_a - - -light: - - platform: esp32_rmt_led_strip - id: rgb_light - name: "RGB Light" - pin: GPIO3 - rmt_channel: 0 - default_transition_length: 0s - chipset: WS2812 - num_leds: 3 - rgb_order: grb - effects: - - pulse: - name: "Slow Pulse" - transition_length: 1000ms - update_interval: 1000ms - min_brightness: 50% - max_brightness: 100% - - pulse: - name: "Fast Pulse" - transition_length: 100ms - update_interval: 100ms - min_brightness: 50% - max_brightness: 100% - - -button: - - platform: restart - icon: mdi:power-cycle - name: "ESP Reboot" - - - platform: factory_reset - disabled_by_default: True - name: "Factory Reset ESP" - id: factory_reset_all - - - platform: ld2410 - factory_reset: - name: "Factory Reset Radar" - restart: - name: "Restart Radar" - query_params: - name: query params - - platform: template - name: "Calibrate SCD40 To 420ppm" - id: set_SCD40_calibrate - on_press: - - scd4x.perform_forced_calibration: - value: 420 - id: scd40 - - -switch: - - platform: ld2410 - bluetooth: - name: "ld2410 Bluetooth" - id: radar_bluetooth - engineering_mode: - name: "Radar Engineering Mode" - - platform: template - name: "Startup Light Blink" - id: startup_light_blink - icon: mdi:lightbulb - restore_mode: RESTORE_DEFAULT_ON - optimistic: true - entity_category: "config" - - platform: factory_reset - id: factory_reset_switch - internal: true - -text_sensor: - - platform: ld2410 - version: - name: "Radar Firmware Version" - -select: - - platform: ld2410 - distance_resolution: - name: "ld2410 Gate Size" - disabled_by_default: true - - - -script: - - id: testScript - then: - if: - condition: - - lambda: "return id(runTest) == true;" - then: - - lambda: "id(runTest) = false;" - - lambda: "id(testCycleCount) = 0;" - - while: - condition: - - lambda: "return id(testCycleCount) < 5;" - then: - - if: - condition: - - lambda: "return id(dps310Passed) == false;" - then: - - if: - condition: - - lambda: "return id(dps310pressure).state > 0;" - then: - - lambda: "id(dps310Passed) = true;" - - if: - condition: - - lambda: "return id(ltr390lightPassed) == false;" - then: - - if: - condition: - - lambda: "return id(ltr390light).state > 10;" - then: - - lambda: "id(ltr390lightPassed) = true;" - - if: - condition: - - lambda: "return id(ltr390uvindexPassed) == false;" - then: - - if: - condition: - - lambda: "return !isnan(id(ltr390uvindex).state);" - then: - - lambda: "id(ltr390uvindexPassed) = true;" - - if: - condition: - - lambda: "return id(ld2410Passed) == false;" - then: - - if: - condition: - - lambda: "return (id(radar_has_target).state == true && id(radar_detection_distance).state > 10);" - then: - - lambda: "id(ld2410Passed) = true;" - - if: - condition: - - lambda: "return id(dps310Passed) && id(ltr390lightPassed) && id(ltr390uvindexPassed) && id(ld2410Passed);" - then: - - lambda: "id(testCycleCount) = 10;" - - lambda: "id(runTest) = false;" - - delay: 1s - - lambda: "id(testCycleCount) += 1;" - - #Check If Test Passed To Trigger Lights - - if: - condition: - - lambda: "return id(dps310Passed) && id(ltr390lightPassed) && id(ltr390uvindexPassed) && id(ld2410Passed);" - then: - - lambda: "id(runTest) = false;" - - light.turn_on: - id: rgb_light - red: 0% - green: 100% - blue: 0% - - delay: 5s - - light.turn_on: - id: rgb_light - red: 0% - green: 0% - blue: 0% - - light.turn_off: - id: rgb_light - - else: - - lambda: "id(runTest) = false;" - - light.turn_on: - id: rgb_light - red: 100% - green: 0% - blue: 0% - - delay: 5s - - light.turn_on: - id: rgb_light - red: 0% - green: 0% - blue: 0% - - light.turn_off: - id: rgb_light +packages: + remote_package: + url: https://github.com/ApolloAutomation/MSR-2/ + ref: SplitYaml + files: + - Integrations/ESPHome/Core.yaml + refresh: 0d \ No newline at end of file diff --git a/Integrations/ESPHome/MSR-2_Factory.yaml b/Integrations/ESPHome/MSR-2_Factory.yaml index 6f2fa71..48c23a2 100644 --- a/Integrations/ESPHome/MSR-2_Factory.yaml +++ b/Integrations/ESPHome/MSR-2_Factory.yaml @@ -1,6 +1,6 @@ substitutions: name: apollo-msr-2 - version: "24.7.5.2" + version: "24.7.6.1" device_description: ${name} made by Apollo Automation - version ${version}. esphome: @@ -27,7 +27,7 @@ esphome: name: "ApolloAutomation.MSR-2" version: "${version}" - min_version: 2024.6.0 + min_version: 2024.6.4 esp32: board: esp32-c3-devkitm-1 @@ -46,6 +46,24 @@ esp32_improv: logger: +ota: + - platform: esphome + id: ota_esphome + - platform: http_request + id: ota_managed + +http_request: + verify_ssl: true + +update: + - platform: http_request + id: firmware_update + name: Firmware Update + source: https://apolloautomation.github.io/MSR-2/artifact/manifest.json + + +safe_mode: + packages: remote_package: