I can’t figure out how to get the syntax correct for this lambda call. I am trying to use a DFROBOT EC sesnosr in esp home.
DFROBOT sensor
https://wiki.dfrobot.com/Analog_EC_Meter_SKU_DFR0300
my current yaml
# Temperature Compensated Voltage
- platform: template
name: "OG EC TCV"
id: temp01_comp_v
unit_of_measurement: 'v'
accuracy_decimals: 3
lambda: 'return ((id(ogec_raw).state) / (1 + (0.0185 * ((id(probe01).state) - 25.0))));'
update_interval: 10s
internal: true
# Temperature Compensated EC
- platform: template
name: "OG EC"
id: ogec01
icon: "hass:water-opacity"
unit_of_measurement: 'PPM'
accuracy_decimals: 0
lambda:
if (temp01_comp_v<=448) {ogec01 =6.84*temp01_comp_v-64.32; #1ms/cm<EC<=3ms/cm
} else if(temp01_comp_v<=1457) {ogec01=6.98*temp01_comp_v-127; #3ms/cm<EC<=10ms/cm
}else ogec01=5.3*temp01_comp_v+2278; #10ms/cm<EC<20ms/cm
ogec01/=1000;
Anyone able to help?