Skip to content

Commit

Permalink
Make expand_range for left and right sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenpapierski committed Oct 26, 2024
1 parent 8cc828a commit dd0a540
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bed-presence-mk1/sensor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ sensor:
- sliding_window_moving_average:
window_size: ${averaging_window_samples}
send_every: 1
- lambda: |- # clamp to a min_value of 0 unless expand_negative_range is True
if (x >= 0 || id(expand_negative_range).state) {
- lambda: |- # clamp to a min_value of 0 unless expand_range is True
if (x >= 0 || id(expand_${sensor_id}_range).state) {
return x;
} else {
return 0;
Expand All @@ -104,7 +104,7 @@ number:
optimistic: true
restore_value: true
initial_value: 0
min_value: -210 # -210 == 0 pulses/minute (expand_negative_range)
min_value: -210 # -210 == 0 pulses/minute (expand_range)
max_value: 110
step: 1.0
mode: box
Expand All @@ -121,7 +121,7 @@ number:
optimistic: true
restore_value: true
initial_value: 100
min_value: -210 # -210 == 0 pulses/minute (expand_negative_range)
min_value: -210 # -210 == 0 pulses/minute (expand_range)
max_value: 110
step: 1.0
mode: box
Expand All @@ -135,7 +135,7 @@ number:
optimistic: true
restore_value: true
initial_value: 50
min_value: -210 # -210 == 0 pulses/minute (expand_negative_range)
min_value: -210 # -210 == 0 pulses/minute (expand_range)
max_value: 110
step: 1.0
mode: box
Expand Down Expand Up @@ -169,8 +169,8 @@ button:

switch:
- platform: template
name: "Expand Negative Range"
id: expand_negative_range
name: Expand ${sensor_name} Range
id: expand_${sensor_id}_range
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF

Expand Down

0 comments on commit dd0a540

Please sign in to comment.