Set ESPHOME calibrate_linear values using HA

I am trying to control ESPHOME calibrate_linear values using HA.
I am recieving PH data vrom my ads1115 module and doing the initial callibration with calibrate_linear filter. My code looks like this:

  - address: 0x48
  - platform: ads1115
    multiplexer: 'A0_GND'
    name: "ADS1115 Channel A0-GND"
      - calibrate_linear:
          # Map 0.0 (from sensor) to 0.0 (true value)
          - 0.0 -> 0.0
          - 120.0 -> 4.01
          - 245.0 -> 7.01

I want to calibrate it using home assistant. I was thinking about global variables, but I can not understand how to implement it using HA. I would create the input number component in home assistant, then would apply the value of it to the sensro. In ESPHOME I would create the homeassistant component which would read the value of the sensor. But how can I assitn it to the map value from sensor in the calibrate linear of the ESPHOME?

Or maybe it is better to get raw data from ESPHOME and then calibrate it in homeassistant?

Thank you in advance.

My personal experience with linear calibration for current and power is not very positive… I think the algorithm “close to 0” does not calibrate very well and despite me also having 0 -> 0 makes it display negative values when it should be 0.

1 Like

i 've run into the same problem as you. And also to calibrate a pH probe linear to the ADS voltage.
Did you find any solution for your calibration from HA?
As far as i am in my research seems calibration_linear isn’t “templatable” :-/
so we can’t use (global) variables …yet. Hopefully in a soon coming update :slight_smile:

Old thread, but for those coming from a search engine:

Just report back the voltage to HA, then use a template sensor to do the linear calculations yourself. You can utilize helpers like ph_calibration_voltage_7, 4 and 10. Then just update those values when you go to recalibrate.