From a23f6eccc155166aaa993f19a7ff2281f5e6f36d Mon Sep 17 00:00:00 2001 From: Trevor Schirmer Date: Sat, 6 Jul 2024 22:08:31 -0400 Subject: [PATCH 1/4] Split Up YAML --- .github/workflows/build.yml | 4 +- .github/workflows/ci.yml | 1 + Integrations/ESPHome/Core.yaml | 521 ++++++++++++++++++++++ Integrations/ESPHome/MSR-1_BLE.yaml | 550 +----------------------- Integrations/ESPHome/MSR-1_Factory.yaml | 65 +++ 5 files changed, 601 insertions(+), 540 deletions(-) create mode 100644 Integrations/ESPHome/Core.yaml create mode 100644 Integrations/ESPHome/MSR-1_Factory.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5113c7b..92bcd88 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,14 +23,14 @@ jobs: uses: esphome/build-action@v3.0.0 id: esphome-build with: - yaml_file: Integrations/ESPHome/${{ env.UPPERCASE_DEVICE_NAME }}.yaml + yaml_file: Integrations/ESPHome/${{ env.UPPERCASE_DEVICE_NAME }}_Factory.yaml version: 'latest' cache: true - name: Read version from YAML file id: read_version run: | - version=$(awk '/substitutions:/ {found=1} found && /version:/ {print $2; exit}' Integrations/ESPHome/${{ env.UPPERCASE_DEVICE_NAME }}.yaml | tr -d '"') + version=$(awk '/substitutions:/ {found=1} found && /version:/ {print $2; exit}' Integrations/ESPHome/${{ env.UPPERCASE_DEVICE_NAME }}_Factory.yaml | tr -d '"') echo "project_version=$version" >> $GITHUB_ENV - name: Move generated files to output diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79be94a..08b572d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,7 @@ jobs: file: - Integrations/ESPHome/MSR-1.yaml - Integrations/ESPHome/MSR-1_BLE.yaml + - Integrations/ESPHome/MSR-1_Factory.yaml steps: - name: Checkout source code uses: actions/checkout@v4.1.7 diff --git a/Integrations/ESPHome/Core.yaml b/Integrations/ESPHome/Core.yaml new file mode 100644 index 0000000..f5ee999 --- /dev/null +++ b/Integrations/ESPHome/Core.yaml @@ -0,0 +1,521 @@ +substitutions: + name: apollo-msr-1 + version: "24.7.5.1" + device_description: ${name} made by Apollo Automation - version ${version}. + +esp32: + board: esp32-c3-devkitm-1 + framework: + type: arduino +captive_portal: + +web_server: + port: 80 + +api: + on_client_connected: + - delay: 1s + - light.turn_off: rgb_light + - lambda: 'id(cycleCounter) = 30;' + 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;' + +globals: + - id: cycleCounter + type: int + restore_value: no + initial_value: '0' + - id: button_press_timestamp + restore_value: no + type: uint32_t + initial_value: '0' + +i2c: + sda: GPIO1 + scl: GPIO0 + id: bus_a + +uart: + tx_pin: GPIO21 + rx_pin: GPIO20 + baud_rate: 256000 + parity: NONE + stop_bits: 1 + +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: BME280 Humidity Offset + id: bme280_humidity_offset + restore_value: true + initial_value: -18.86 + min_value: -70.0 + max_value: 70.0 + entity_category: "CONFIG" + unit_of_measurement: "%" + optimistic: true + update_interval: never + step: 0.1 + mode: box + + - platform: template + name: BME280 Temperature Offset + id: bme280_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) >= 5000) { + // Remove Wifi + 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: bme280pressure + + + - 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 + still_energy: + name: g0 still energy + g1: + move_energy: + name: g1 move energy + still_energy: + name: g1 still energy + g2: + move_energy: + name: g2 move energy + still_energy: + name: g2 still energy + g3: + move_energy: + name: g3 move energy + still_energy: + name: g3 still energy + g4: + move_energy: + name: g4 move energy + still_energy: + name: g4 still energy + g5: + move_energy: + name: g5 move energy + still_energy: + name: g5 still energy + g6: + move_energy: + name: g6 move energy + still_energy: + name: g6 still energy + g7: + move_energy: + name: g7 move energy + still_energy: + name: g7 still energy + g8: + move_energy: + name: g8 move energy + still_energy: + name: g8 still energy + + - platform: bme280_i2c + id: bme_280 + temperature: + name: "BME280 Temperature" + id: bme280temperature + filters: + - lambda: return x - id(bme280_temperature_offset).state; + pressure: + name: "BME280 Pressure" + id: bme280pressure + humidity: + name: "BME280 Humidity" + id: bme280humidity + filters: + - lambda: return x - id(bme280_humidity_offset).state; + update_interval: 60s + i2c_id: bus_a + address: 0x76 + + + - platform: ltr390 + id: ltr_390 + uv_index: + name: "LTR390 UV Index" + id: ltr390uvindex + light: + name: "LTR390 Light" + id: ltr390light + update_interval: 5s + + +light: + - platform: neopixelbus + id: rgb_light + type: GRB + variant: WS2812x + pin: GPIO3 + num_leds: 1 + name: "RGB Light" + method: + type: esp32_rmt + channel: 0 + + +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: "Radar Control 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: "Radar Distance Resolution" + disabled_by_default: true + + + +#Used To Control RGB Light On Startup. Tells User Status Of Device +interval: + - interval: 1s + then: + - if: + condition: + - binary_sensor.is_off: ink_ha_connected + - lambda: 'return id(cycleCounter) < 30;' + - switch.is_on: startup_light_blink + + then: + - light.toggle: + id: rgb_light + - lambda: 'id(cycleCounter) += 1;' + + - interval: 1s + then: + - if: + condition: + - binary_sensor.is_off: ink_ha_connected + - lambda: 'return id(cycleCounter) > 30;' + - lambda: 'return id(cycleCounter) < 31;' + - switch.is_on: startup_light_blink + + then: + - light.turn_off: + id: rgb_light + - lambda: 'id(cycleCounter) += 1;' diff --git a/Integrations/ESPHome/MSR-1_BLE.yaml b/Integrations/ESPHome/MSR-1_BLE.yaml index 28a83de..c03d21b 100644 --- a/Integrations/ESPHome/MSR-1_BLE.yaml +++ b/Integrations/ESPHome/MSR-1_BLE.yaml @@ -1,9 +1,3 @@ -#Define Project -substitutions: - name: apollo-msr-1 - version: "24.7.5.1" - device_description: ${name} made by Apollo Automation - version ${version}. - esphome: name: "${name}" friendly_name: Apollo Multisensor Mk1 (MSR-1) @@ -22,549 +16,29 @@ esphome: name: "ApolloAutomation.MSR-1" version: "${version}" - min_version: 2024.6.0 + min_version: 2024.6.4 -# Define Board -esp32: - board: esp32-c3-devkitm-1 - framework: - type: arduino - dashboard_import: - package_import_url: github://ApolloAutomation/MSR-1/Integrations/ESPHome/MSR-1.yaml + package_import_url: github://ApolloAutomation/MSR-1/Integrations/ESPHome/MSR-1_BLE.yaml import_full_config: false - -globals: - - id: cycleCounter - type: int - restore_value: no - initial_value: '0' - - id: button_press_timestamp - restore_value: no - type: uint32_t - initial_value: '0' - -# Enable Home Assistant API -# Also Add Buzzer Service Connection -api: - on_client_connected: - - delay: 1s - - light.turn_off: rgb_light - - lambda: 'id(cycleCounter) = 30;' - 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 password: "apolloautomation" -bluetooth_proxy: - active: true wifi: - - # Enable fallback hotspot (captive portal) in case wifi connection fails + power_save_mode: none ap: ssid: "Apollo MSR1 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: BME280 Humidity Offset - id: bme280_humidity_offset - restore_value: true - initial_value: -18.86 - min_value: -70.0 - max_value: 70.0 - entity_category: "CONFIG" - unit_of_measurement: "%" - optimistic: true - update_interval: never - step: 0.1 - mode: box - - - platform: template - name: BME280 Temperature Offset - id: bme280_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) >= 5000) { - // Remove Wifi - 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: bme280pressure - - - - 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 - still_energy: - name: g0 still energy - g1: - move_energy: - name: g1 move energy - still_energy: - name: g1 still energy - g2: - move_energy: - name: g2 move energy - still_energy: - name: g2 still energy - g3: - move_energy: - name: g3 move energy - still_energy: - name: g3 still energy - g4: - move_energy: - name: g4 move energy - still_energy: - name: g4 still energy - g5: - move_energy: - name: g5 move energy - still_energy: - name: g5 still energy - g6: - move_energy: - name: g6 move energy - still_energy: - name: g6 still energy - g7: - move_energy: - name: g7 move energy - still_energy: - name: g7 still energy - g8: - move_energy: - name: g8 move energy - still_energy: - name: g8 still energy - - - platform: bme280_i2c - id: bme_280 - temperature: - name: "BME280 Temperature" - id: bme280temperature - filters: - - lambda: return x - id(bme280_temperature_offset).state; - pressure: - name: "BME280 Pressure" - id: bme280pressure - humidity: - name: "BME280 Humidity" - id: bme280humidity - filters: - - lambda: return x - id(bme280_humidity_offset).state; - update_interval: 60s - i2c_id: bus_a - address: 0x76 - - - - platform: ltr390 - id: ltr_390 - uv_index: - name: "LTR390 UV Index" - id: ltr390uvindex - light: - name: "LTR390 Light" - id: ltr390light - update_interval: 5s - - -light: - - platform: neopixelbus - id: rgb_light - type: GRB - variant: WS2812x - pin: GPIO3 - num_leds: 1 - name: "RGB Light" - method: - type: esp32_rmt - channel: 0 - - -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: "Radar Control 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: "Radar Distance Resolution" - disabled_by_default: true - - - -#Used To Control RGB Light On Startup. Tells User Status Of Device -interval: - - interval: 1s - then: - - if: - condition: - - binary_sensor.is_off: ink_ha_connected - - lambda: 'return id(cycleCounter) < 30;' - - switch.is_on: startup_light_blink - - then: - - light.toggle: - id: rgb_light - - lambda: 'id(cycleCounter) += 1;' - - - interval: 1s - then: - - if: - condition: - - binary_sensor.is_off: ink_ha_connected - - lambda: 'return id(cycleCounter) > 30;' - - lambda: 'return id(cycleCounter) < 31;' - - switch.is_on: startup_light_blink +bluetooth_proxy: + active: true - then: - - light.turn_off: - id: rgb_light - - lambda: 'id(cycleCounter) += 1;' +packages: + remote_package: + url: https://github.com/ApolloAutomation/MSR-1/ + ref: SplitYAML + files: + - Integrations/ESPHome/Core.yaml + refresh: 0d \ No newline at end of file diff --git a/Integrations/ESPHome/MSR-1_Factory.yaml b/Integrations/ESPHome/MSR-1_Factory.yaml new file mode 100644 index 0000000..8fd746b --- /dev/null +++ b/Integrations/ESPHome/MSR-1_Factory.yaml @@ -0,0 +1,65 @@ +esphome: + name: "${name}" + friendly_name: Apollo Multisensor Mk1 (MSR-1) + comment: Apollo Multisensor Mk1 (MSR-1) + name_add_mac_suffix: true + platformio_options: + board_build.flash_mode: dio + + on_boot: + - priority: 900.0 + then: + - lambda: |- + id(radar_bluetooth).turn_off(); + + project: + name: "ApolloAutomation.MSR-1" + version: "${version}" + + min_version: 2024.6.4 + +dashboard_import: + package_import_url: github://ApolloAutomation/MSR-1/Integrations/ESPHome/MSR-1_Factory.yaml + import_full_config: false + +improv_serial: + +esp32_improv: + authorizer: none + +wifi: + on_connect: + - delay: 5s + - ble.disable: + on_disconnect: + - ble.enable: + ap: + ssid: "Apollo MSR1 Hotspot" + +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-1/artifact/manifest.json + + +safe_mode: + +packages: + remote_package: + url: https://github.com/ApolloAutomation/MSR-1/ + ref: SplitYAML + files: + - Integrations/ESPHome/Core.yaml + refresh: 0d \ No newline at end of file From ba8cc7a6005e6b18d9e09d75edf6b81de585b99e Mon Sep 17 00:00:00 2001 From: Trevor Schirmer Date: Sat, 6 Jul 2024 22:22:32 -0400 Subject: [PATCH 2/4] Drop Managed Updates --- Integrations/ESPHome/MSR-1_BLE.yaml | 2 +- Integrations/ESPHome/MSR-1_Factory.yaml | 15 +-------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/Integrations/ESPHome/MSR-1_BLE.yaml b/Integrations/ESPHome/MSR-1_BLE.yaml index c03d21b..04b2ff4 100644 --- a/Integrations/ESPHome/MSR-1_BLE.yaml +++ b/Integrations/ESPHome/MSR-1_BLE.yaml @@ -38,7 +38,7 @@ bluetooth_proxy: packages: remote_package: url: https://github.com/ApolloAutomation/MSR-1/ - ref: SplitYAML + ref: main files: - Integrations/ESPHome/Core.yaml refresh: 0d \ No newline at end of file diff --git a/Integrations/ESPHome/MSR-1_Factory.yaml b/Integrations/ESPHome/MSR-1_Factory.yaml index 8fd746b..3ea1e37 100644 --- a/Integrations/ESPHome/MSR-1_Factory.yaml +++ b/Integrations/ESPHome/MSR-1_Factory.yaml @@ -41,25 +41,12 @@ 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-1/artifact/manifest.json - - -safe_mode: packages: remote_package: url: https://github.com/ApolloAutomation/MSR-1/ - ref: SplitYAML + ref: main files: - Integrations/ESPHome/Core.yaml refresh: 0d \ No newline at end of file From bddc1423c572e202411ac2784f5ea1edccec4919 Mon Sep 17 00:00:00 2001 From: Trevor Schirmer Date: Mon, 15 Jul 2024 14:23:38 -0400 Subject: [PATCH 3/4] Update Import URL --- .github/workflows/build.yml | 4 ++-- Integrations/ESPHome/Core.yaml | 2 +- Integrations/ESPHome/MSR-1_Factory.yaml | 2 +- PULL_REQUEST_TEMPLATE.md | 2 +- README.md | 8 +++++++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 92bcd88..5113c7b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,14 +23,14 @@ jobs: uses: esphome/build-action@v3.0.0 id: esphome-build with: - yaml_file: Integrations/ESPHome/${{ env.UPPERCASE_DEVICE_NAME }}_Factory.yaml + yaml_file: Integrations/ESPHome/${{ env.UPPERCASE_DEVICE_NAME }}.yaml version: 'latest' cache: true - name: Read version from YAML file id: read_version run: | - version=$(awk '/substitutions:/ {found=1} found && /version:/ {print $2; exit}' Integrations/ESPHome/${{ env.UPPERCASE_DEVICE_NAME }}_Factory.yaml | tr -d '"') + version=$(awk '/substitutions:/ {found=1} found && /version:/ {print $2; exit}' Integrations/ESPHome/${{ env.UPPERCASE_DEVICE_NAME }}.yaml | tr -d '"') echo "project_version=$version" >> $GITHUB_ENV - name: Move generated files to output diff --git a/Integrations/ESPHome/Core.yaml b/Integrations/ESPHome/Core.yaml index f5ee999..9e28b17 100644 --- a/Integrations/ESPHome/Core.yaml +++ b/Integrations/ESPHome/Core.yaml @@ -1,6 +1,6 @@ substitutions: name: apollo-msr-1 - version: "24.7.5.1" + version: "24.7.15.1" device_description: ${name} made by Apollo Automation - version ${version}. esp32: diff --git a/Integrations/ESPHome/MSR-1_Factory.yaml b/Integrations/ESPHome/MSR-1_Factory.yaml index 3ea1e37..1b43fba 100644 --- a/Integrations/ESPHome/MSR-1_Factory.yaml +++ b/Integrations/ESPHome/MSR-1_Factory.yaml @@ -19,7 +19,7 @@ esphome: min_version: 2024.6.4 dashboard_import: - package_import_url: github://ApolloAutomation/MSR-1/Integrations/ESPHome/MSR-1_Factory.yaml + package_import_url: github://ApolloAutomation/MSR-1/Integrations/ESPHome/MSR-1.yaml import_full_config: false improv_serial: diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 27f9af4..599e42f 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -10,4 +10,4 @@ Breaks: Checks: - [ ] Documentation Updated -- [ ] Build Number Incremented In MSR-1.yaml \ No newline at end of file +- [ ] Build Number Incremented In Core.yaml \ No newline at end of file diff --git a/README.md b/README.md index 7432301..4ad0fd1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,13 @@ This sensor offers a wide range of functionality for Home Assistant in a very tiny package. +YAML Files: +- MSR-1.yaml: This file is a minimal config. It doesn't have the bluetooth or OTA components. Use this if you are looking to add BLE proxy or BLE tracking. +- MSR-1_BLE.yaml: This file contains BLE proxy code. We use it as an automated test during our build process. But can be an example for adding BLE proxy to your device. +- MSR-1_Factory.yaml: This is the firmware flashed by us on new devices. It contains the components for ESP improve, allowing easy adoption in Home Assistant. When you load the device in ESPHome addon, it will grab the firmware from MSR-1.yaml which no longer has the improve. + Links: \ Discord (Support/feedback/discussion/future products): [https://discord.gg/8PpS4yUaUh](https://discord.gg/mMNgQPyF94) \ Shop: [https://apolloautomation.com](https://apolloautomation.com) \ -Wiki: [https://wiki.apolloautomation.com](https://wiki.apolloautomation.com/) \ No newline at end of file +Wiki: [https://wiki.apolloautomation.com](https://wiki.apolloautomation.com/) \ +3D Files: [https://www.printables.com/model/564297-apollo-automation-msr-1-mmwave-co2-multisensor-for](https://www.printables.com/model/564297-apollo-automation-msr-1-mmwave-co2-multisensor-for) \ No newline at end of file From d80f4f1801e5c53d660539cf1719517123eef7ab Mon Sep 17 00:00:00 2001 From: Trevor Schirmer Date: Mon, 15 Jul 2024 14:24:09 -0400 Subject: [PATCH 4/4] Update Version --- Integrations/ESPHome/MSR-1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Integrations/ESPHome/MSR-1.yaml b/Integrations/ESPHome/MSR-1.yaml index a2ded7d..db7e487 100644 --- a/Integrations/ESPHome/MSR-1.yaml +++ b/Integrations/ESPHome/MSR-1.yaml @@ -1,7 +1,7 @@ #Define Project substitutions: name: apollo-msr-1 - version: "24.7.5.1" + version: "24.7.15.1" device_description: ${name} made by Apollo Automation - version ${version}. esphome: