Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SEN0609 #167

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
284 changes: 284 additions & 0 deletions common/sen0609-common.yaml
Original file line number Diff line number Diff line change
@@ -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<unsigned char>(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<unsigned char>(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<unsigned char>(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<unsigned char>(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<unsigned char>(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
2 changes: 1 addition & 1 deletion everything-presence-one-beta-ble.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion everything-presence-one-beta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion everything-presence-one-ble.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
23 changes: 23 additions & 0 deletions everything-presence-one-sen0609-ble.yaml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions everything-presence-one-sen0609.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion everything-presence-one.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading