Skip to content

Commit

Permalink
Merge pull request #166 from EverythingSmartHome/sen0395-common
Browse files Browse the repository at this point in the history
Move SEN0395 to common
  • Loading branch information
EverythingSmartHome authored Apr 3, 2024
2 parents 3a3f61d + f18e976 commit df65b08
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 202 deletions.
142 changes: 1 addition & 141 deletions common/everything-presence-one-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,120 +133,7 @@ binary_sensor:
return id(occupancy).state;
}
switch:
- platform: template
name: mmWave sensor
id: mmwave_sensor
disabled_by_default: True
entity_category: config
optimistic: true
restore_mode: DISABLED
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
internal: ${uart_presence_output_disabled}
optimistic: true
turn_on_action:
- logger.log: "UART Presence Output On"
- 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:
- logger.log: "UART Presence Output Off"
- switch.turn_off: mmwave_sensor
- delay: 1s
- uart.write: "setUartOutput 1 0"
- delay: 1s
- uart.write: "saveConfig"
- delay: 3s
- switch.turn_on: mmwave_sensor

number:
- 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:
- logger.log: "Off latency set"
- 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: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
- 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:
- logger.log: "On latency set"
- 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: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
- delay: 1s
- switch.turn_on: mmwave_sensor

- platform: template
name: mmWave 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
set_action:
- logger.log: "Sensitivity set"
- switch.turn_off: mmwave_sensor
- delay: 1s
- uart.write:
!lambda std::string mss = "setSensitivity " + to_string((int)x);
return std::vector<unsigned char>(mss.begin(), mss.end());
- delay: 1s
- uart.write: "saveConfig"
- delay: 1s
- switch.turn_on: mmwave_sensor

- platform: template
name: Occupancy off latency
icon: mdi:clock-end
Expand Down Expand Up @@ -329,35 +216,8 @@ button:
id: restart_internal
entity_category: config
internal: true
- platform: template
name: Restart mmWave sensor
id: restart_mmwave
entity_category: config
internal: true
on_press:
- uart.write: "resetSystem"
- platform: template
name: Restart
icon: mdi:restart
entity_category: config
disabled_by_default: True
on_press:
- button.press: restart_mmwave
- button.press: restart_internal
- platform: safe_mode
internal: false
name: Safe mode
entity_category: config
disabled_by_default: True
- platform: template
name: Factory reset mmWave
icon: mdi:cog-counterclockwise
id: factory_reset_mmwave
internal: ${factory_reset_disabled}
entity_category: config
on_press:
- switch.turn_off: mmwave_sensor
- delay: 1s
- uart.write: "resetCfg"
- delay: 3s
- switch.turn_on: mmwave_sensor
disabled_by_default: True
26 changes: 0 additions & 26 deletions common/everything-presence-one-sen0395-beta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,32 +74,6 @@ uart:
}
}
light:
- platform: binary
name: mmWave LED
output: mmwave_led_output
entity_category: config
disabled_by_default: True

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

number:
- platform: template
id: mmwave_zone_1_start
Expand Down
28 changes: 1 addition & 27 deletions common/everything-presence-one-sen0395-stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,6 @@ uart:
sequence:
- lambda: UARTDebug::log_string(direction, bytes);

light:
- platform: binary
name: mmWave LED
output: mmwave_led_output
entity_category: config
disabled_by_default: True

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

binary_sensor:
- platform: gpio
name: mmWave
Expand All @@ -45,7 +19,7 @@ binary_sensor:
pin:
number: GPIO15
mode: INPUT_PULLDOWN

number:
- platform: template
id: mmwave_distance
Expand Down
Loading

0 comments on commit df65b08

Please sign in to comment.