Skip to content

Commit

Permalink
add unit of measure to pH
Browse files Browse the repository at this point in the history
  • Loading branch information
mzakharo committed Jan 12, 2024
1 parent 7ea31ff commit 4f8d2e0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions tubby.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,14 @@ sensor:
- platform: template
name: pH
force_update: true
device_class: "ph"
lambda: |
auto PH_MID_CAL = id(ph_7).state;
auto PH_LOW_CAL = id(ph_4).state;
auto PH_HIGH_CAL = id(ph_10).state;
if (id(ph_raw).state > PH_MID_CAL) return 7.0 - 3.0 / (PH_LOW_CAL - PH_MID_CAL) * (id(ph_raw).state - PH_MID_CAL);
else return 7.0 - 3.0 / (PH_MID_CAL - PH_HIGH_CAL) * (id(ph_raw).state - PH_MID_CAL);
icon: "mdi:ph"
unit_of_measurement: pH
id: "ph"
update_interval: 2s
accuracy_decimals: 2
Expand All @@ -204,7 +204,6 @@ sensor:
lambda: |
auto ppm = static_cast <LightSleep *> (id(custom_id))->predict_ppm(id(orp).state, id(ph).state);
return ppm * id(ppm_factor).state;
unit_of_measurement: ppm
icon: "mdi:test-tube"
update_interval: 2s
Expand Down

0 comments on commit 4f8d2e0

Please sign in to comment.