Skip to content

Commit

Permalink
Add calibrated sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenpapierski committed Oct 26, 2024
1 parent f49d4f8 commit e89514f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bed-presence-mk1/sensor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ sensor:
- or:
- delta: ${reporting_delta} # only send if sensor changes by `reporting_delta` (eliminate sensor noise)
- throttle: ${reporting_interval_max} # but still update every `reporting_interval_max`
- platform: copy
source_id: bed_sensor_${sensor_id}
name: ${sensor_name} Pressure Calibrated
id: bed_sensor_${sensor_id}_calibrated
icon: mdi:scale-balance
filters:
- lambda: |- # scale between val_unoccupied and val_occupied
float cal_0 = id(val_unoccupied_${sensor_id}).state;
float cal_100 = id(val_occupied_${sensor_id}).state;
float val = (x - cal_0) * 100;
float range = cal100 - cal_0;
return val/range;
number:
- platform: template
Expand Down

0 comments on commit e89514f

Please sign in to comment.