Hi There,
Have some pressure sensors in my pool which are transmitting data from an Arduino via MQTT to HASS. I am curious where is the suggested place to perform math and calibration functions?
The raw sensor data is simply a voltage reading, there is some maths to convert this to KPA.
As there are 3x sensors each requires it’s own offset value.
Maths is pretty straightforward:
Offset = 0.483 (or whatever you tested 0 pressure at)
V = SensorVal * 5.00 / 1024
Pressure = (V-Offset) * 250
I have attempted to do this in developer tools / templates but still learning the ropes on how to put a complete math formula in one line:
{% set val = states('sensor.pressuretesting_filter') %}
{% set val = states('sensor.pressuretesting_filter') %}
foo = {{val}}
Pressure sensor value is {{states('sensor.pressuretesting_filter')}}
Pressure sensor value x 5 is {{val | float * 5 }}
{% set newVal = val | float * 5 / 1024 - 0.470 %}
{% set finalVal = newVal | float * 250 %}
New value is {{ newVal}}
Final value is {{finalVal}}