From e7950a22fe12eb1e89bbd28759cc86bfdeb639b0 Mon Sep 17 00:00:00 2001 From: Everything Smart Home <53482654+EverythingSmartHome@users.noreply.github.com> Date: Wed, 3 Apr 2024 11:03:41 +0100 Subject: [PATCH 1/2] Add support for SEN0609 --- common/sen0609-common.yaml | 284 +++++++++++++++++++++++ everything-presence-one-beta-ble.yaml | 2 +- everything-presence-one-beta.yaml | 2 +- everything-presence-one-ble.yaml | 2 +- everything-presence-one-sen0609-ble.yaml | 23 ++ everything-presence-one-sen0609.yaml | 22 ++ everything-presence-one.yaml | 2 +- 7 files changed, 333 insertions(+), 4 deletions(-) create mode 100644 common/sen0609-common.yaml create mode 100644 everything-presence-one-sen0609-ble.yaml create mode 100644 everything-presence-one-sen0609.yaml diff --git a/common/sen0609-common.yaml b/common/sen0609-common.yaml new file mode 100644 index 0000000..8184087 --- /dev/null +++ b/common/sen0609-common.yaml @@ -0,0 +1,284 @@ +binary_sensor: + - platform: gpio + name: mmWave + id: mmwave + device_class: occupancy + pin: + number: GPIO17 + mode: INPUT_PULLDOWN + +uart: + id: uart_bus + tx_pin: GPIO14 + rx_pin: GPIO13 + baud_rate: 9600 + debug: + direction: BOTH + dummy_receiver: true + after: + delimiter: "\n" + sequence: + - lambda: UARTDebug::log_string(direction, bytes); + +light: + - platform: binary + name: mmWave LED + restore_mode: RESTORE_DEFAULT_OFF + output: mmwave_led_output + entity_category: config + disabled_by_default: False + +output: + - platform: template + id: mmwave_led_output + type: binary + write_action: + - switch.turn_off: mmwave_sensor + - delay: 1s + - if: + condition: + lambda: !lambda return state; + then: + - uart.write: "setLedMode 1 0" + else: + - uart.write: "setLedMode 1 1" + - delay: 1s + - uart.write: "saveConfig" + - delay: 3s + - switch.turn_on: mmwave_sensor + +switch: + - platform: template + name: mmWave sensor + id: mmwave_sensor + disabled_by_default: True + entity_category: config + optimistic: true + restore_mode: RESTORE_DEFAULT_ON + turn_on_action: + - uart.write: "sensorStart" + - delay: 1s + turn_off_action: + - uart.write: "sensorStop" + - delay: 1s + + - platform: template + name: UART presence output + id: uart_presence_output + entity_category: config + disabled_by_default: true + optimistic: true + turn_on_action: + - switch.turn_off: mmwave_sensor + - delay: 1s + - uart.write: "setUartOutput 1 1" + - delay: 1s + - uart.write: "saveConfig" + - delay: 3s + - switch.turn_on: mmwave_sensor + turn_off_action: + - switch.turn_off: mmwave_sensor + - delay: 1s + - uart.write: "setUartOutput 1 0" + - delay: 1s + - uart.write: "saveConfig" + - delay: 3s + - switch.turn_on: mmwave_sensor + + - platform: template + name: UART target output + id: uart_target_output + entity_category: config + disabled_by_default: true + optimistic: true + assumed_state: false + turn_on_action: + - 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: + - switch.turn_off: mmwave_sensor + - delay: 1s + - uart.write: "setUartOutput 2 0" + - delay: 1s + - uart.write: "saveConfig" + - delay: 3s + - switch.turn_on: mmwave_sensor + +number: + - platform: template + id: mmwave_distance_min + name: mmWave Minimum Distance + icon: mdi:arrow-left-right + entity_category: config + min_value: 0 + max_value: 25 + initial_value: 0 + optimistic: true + step: 0.1 + restore_value: true + unit_of_measurement: m + mode: slider + - platform: template + id: mmwave_distance_max + name: mmWave Max Distance + icon: mdi:arrow-left-right + entity_category: config + min_value: 0 + max_value: 25 + initial_value: 12 + optimistic: true + step: 0.1 + restore_value: true + unit_of_measurement: m + mode: slider + - platform: template + id: mmwave_range_reduced + name: mmWave Range Reduced + icon: mdi:arrow-left-right + entity_category: config + min_value: 0 + max_value: 25 + initial_value: 0.8 + optimistic: true + step: 0.1 + restore_value: true + unit_of_measurement: m + mode: slider + set_action: + - switch.turn_off: mmwave_sensor + - delay: 1s + - uart.write: !lambda + std::string ms = "setRangeReduced " + to_string(x); + return std::vector(ms.begin(), ms.end()); + - delay: 1s + - uart.write: "saveConfig" + - delay: 1s + - switch.turn_on: mmwave_sensor + + - platform: template + name: mmWave off latency + icon: mdi:clock-end + entity_category: config + id: mmwave_off_latency + min_value: 1 + max_value: 600 + initial_value: 15 + optimistic: true + step: 5 + restore_value: true + unit_of_measurement: seconds + mode: slider + set_action: + - switch.turn_off: mmwave_sensor + - delay: 1s + - uart.write: !lambda |- + std::string mss = "setLatency " + to_string(id(mmwave_on_latency).state) + " " + to_string(id(mmwave_off_latency).state); + return std::vector(mss.begin(), mss.end()); + - delay: 1s + - uart.write: "saveConfig" + - delay: 1s + - switch.turn_on: mmwave_sensor + + - platform: template + name: mmWave on latency + icon: mdi:clock-start + id: mmwave_on_latency + entity_category: config + min_value: 0 + max_value: 2 + initial_value: 0 + optimistic: true + step: 0.25 + restore_value: true + unit_of_measurement: seconds + mode: slider + set_action: + - switch.turn_off: mmwave_sensor + - delay: 1s + - uart.write: !lambda |- + std::string mss = "setLatency " + to_string(id(mmwave_on_latency).state) + " " + to_string(id(mmwave_off_latency).state); + return std::vector(mss.begin(), mss.end()); + - delay: 1s + - uart.write: "saveConfig" + - delay: 1s + - switch.turn_on: mmwave_sensor + + - platform: template + name: mmWave Sustain Sensitivity + icon: mdi:target-variant + id: mmwave_sensitivity + entity_category: config + min_value: 0 + max_value: 9 + initial_value: 7 + optimistic: true + step: 1 + restore_value: true + + - platform: template + name: mmWave Trigger Sensitivity + icon: mdi:target-variant + id: mmwave_trigger_sensitivity + entity_category: config + min_value: 0 + max_value: 9 + initial_value: 5 + optimistic: true + step: 1 + restore_value: true + +button: + - platform: template + name: "Set Distance" + id: set_distance + entity_category: config + on_press: + - switch.turn_off: mmwave_sensor + - delay: 1s + - uart.write: !lambda + std::string ms = "setRange " + to_string(id(mmwave_distance_min).state) + " " + to_string(id(mmwave_distance_max).state); + return std::vector(ms.begin(), ms.end()); + - delay: 1s + - uart.write: "saveConfig" + - delay: 1s + - switch.turn_on: mmwave_sensor + + - platform: template + name: "Set Sensitivity" + id: set_sensitivity + entity_category: config + on_press: + - switch.turn_off: mmwave_sensor + - delay: 1s + - uart.write: + !lambda std::string mss = "setSensitivity " + to_string(id(mmwave_sensitivity).state) + " " + to_string(id(mmwave_trigger_sensitivity).state); + return std::vector(mss.begin(), mss.end()); + - delay: 1s + - uart.write: "saveConfig" + - delay: 1s + - switch.turn_on: mmwave_sensor + + - platform: template + name: Restart mmWave Sensor + id: restart_mmwave + entity_category: config + internal: true + on_press: + - uart.write: "resetSystem" + - platform: template + name: Factory Reset mmWave + icon: mdi:cog-counterclockwise + id: factory_reset_mmwave + disabled_by_default: true + entity_category: config + on_press: + - switch.turn_off: mmwave_sensor + - delay: 1s + - uart.write: "resetCfg" + - delay: 3s + - switch.turn_on: mmwave_sensor diff --git a/everything-presence-one-beta-ble.yaml b/everything-presence-one-beta-ble.yaml index de2d03b..576b042 100644 --- a/everything-presence-one-beta-ble.yaml +++ b/everything-presence-one-beta-ble.yaml @@ -2,7 +2,7 @@ substitutions: name: "everything-presence-one" friendly_name: "Everything Presence One" project_name: "Everything Smart Technology.Everything Presence One" - project_version: "1.3.6b" + project_version: "1.3.7b" temperature_offset: "-3" humidity_offset: "5" temperature_update_interval: "60s" diff --git a/everything-presence-one-beta.yaml b/everything-presence-one-beta.yaml index 1e0ac4d..3cc253b 100644 --- a/everything-presence-one-beta.yaml +++ b/everything-presence-one-beta.yaml @@ -2,7 +2,7 @@ substitutions: name: "everything-presence-one" friendly_name: "Everything Presence One" project_name: "Everything Smart Technology.Everything Presence One" - project_version: "1.3.6b" + project_version: "1.3.7b" temperature_offset: "-3" humidity_offset: "5" temperature_update_interval: "60s" diff --git a/everything-presence-one-ble.yaml b/everything-presence-one-ble.yaml index 1ea7de2..edbfee4 100644 --- a/everything-presence-one-ble.yaml +++ b/everything-presence-one-ble.yaml @@ -2,7 +2,7 @@ substitutions: name: "everything-presence-one" friendly_name: "Everything Presence One" project_name: "Everything Smart Technology.Everything Presence One" - project_version: "1.2.2" + project_version: "1.2.3" temperature_offset: "-3" humidity_offset: "5" temperature_update_interval: "60s" diff --git a/everything-presence-one-sen0609-ble.yaml b/everything-presence-one-sen0609-ble.yaml new file mode 100644 index 0000000..b1eec1f --- /dev/null +++ b/everything-presence-one-sen0609-ble.yaml @@ -0,0 +1,23 @@ +substitutions: + name: "everything-presence-one" + friendly_name: "Everything Presence One" + project_name: "Everything Smart Technology.Everything Presence One" + project_version: "1.2.3" + temperature_offset: "-3" + humidity_offset: "5" + temperature_update_interval: "60s" + illuminance_update_interval: "2s" + hidden_ssid: "false" + factory_reset_disabled: "true" + uart_target_output_disabled: "true" + uart_presence_output_disabled: "true" + log_level: "ERROR" + +dashboard_import: + package_import_url: github://everythingsmarthome/everything-presence-one/everything-presence-one-sen0609-ble.yaml@main + import_full_config: false + +packages: + device_base: !include common/everything-presence-one-base.yaml + bluetooth_base: !include common/bluetooth-base.yaml + sen0395_base: !include common/sen0609-common.yaml \ No newline at end of file diff --git a/everything-presence-one-sen0609.yaml b/everything-presence-one-sen0609.yaml new file mode 100644 index 0000000..7c9b4e0 --- /dev/null +++ b/everything-presence-one-sen0609.yaml @@ -0,0 +1,22 @@ +substitutions: + name: "everything-presence-one" + friendly_name: "Everything Presence One" + project_name: "Everything Smart Technology.Everything Presence One" + project_version: "1.2.3" + temperature_offset: "-3" + humidity_offset: "5" + temperature_update_interval: "60s" + illuminance_update_interval: "2s" + hidden_ssid: "false" + factory_reset_disabled: "true" + uart_target_output_disabled: "true" + uart_presence_output_disabled: "true" + log_level: "ERROR" + +dashboard_import: + package_import_url: github://everythingsmarthome/everything-presence-one/everything-presence-one-sen0609.yaml@main + import_full_config: false + +packages: + device_base: !include common/everything-presence-one-base.yaml + sen0395_base: !include common/sen0609-common.yaml \ No newline at end of file diff --git a/everything-presence-one.yaml b/everything-presence-one.yaml index 9e7700c..f5d9f22 100644 --- a/everything-presence-one.yaml +++ b/everything-presence-one.yaml @@ -2,7 +2,7 @@ substitutions: name: "everything-presence-one" friendly_name: "Everything Presence One" project_name: "Everything Smart Technology.Everything Presence One" - project_version: "1.2.2" + project_version: "1.2.3" temperature_offset: "-3" humidity_offset: "5" temperature_update_interval: "60s" From 7fa569328e9d5604d5960c886d88379d239847cc Mon Sep 17 00:00:00 2001 From: Everything Smart Home <53482654+EverythingSmartHome@users.noreply.github.com> Date: Wed, 3 Apr 2024 11:07:32 +0100 Subject: [PATCH 2/2] Add workflow --- .github/workflows/publish.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d37fbe6..c904687 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -60,3 +60,23 @@ jobs: clean: false esphome_version: latest directory_name: everything-presence-one-ble-beta-esp32 + publish-everything-presence-one-sen0609-no-ble-stable: + name: Publish Everything Presence One - SEN0609 - HA - Stable + uses: EverythingSmartHome/everything-presence-lite/.github/workflows/esphome-build.yml@main + with: + files: everything-presence-one-sen0609.yaml + name: Everything Presence One - SEN0609 - HA - Stable + manifest_filename: everything-presence-one-sen0609-manifest.json + clean: false + esphome_version: latest + directory_name: everything-presence-one-sen0609-esp32 + publish-everything-presence-one-sen0609-ble-stable: + name: Publish Everything Presence One - SEN0609 - HA - BLE - Stable + uses: EverythingSmartHome/everything-presence-lite/.github/workflows/esphome-build.yml@main + with: + files: everything-presence-one-sen0609-ble.yaml + name: Everything Presence One - SEN0609 - HA - BLE - Stable + manifest_filename: everything-presence-one-sen0609-ble-manifest.json + clean: false + esphome_version: latest + directory_name: everything-presence-one-sen0609-ble-esp32