Your template needs to convert the sensor’s state value to a number (using either the float or int) before it can be properly divided by another number, like 1000.
If you look at the example I posted above, it provides each float filter with a default value. Your version doesn’t which will result in an error if the value returned by the states() function is ever none. I suggest you adopt the habit of providing Jinja2 functions, like float, with a default value.
Your original template didn’t round the computed value and you didn’t ask for it to be rounded. You asked for help to divide the computed value by 10 and that’s what I demonstrated how to do.
Yes.
NOTE
You should consider using a Template Sensor’s availability option to guard against errors caused by unavailable entities.
I have a pool with a PH-W2839 (Wireless WiFi Online Control Detector Water Quality Detector 3-in-1 pH/ORP/TEMP Controller Water Quality Tester BNC Type Probe). It’s working wonderfull with Home Assistant but i want to know the free chlorine PPM. I found a math equation from an AI (poe.com and it’s (ORP+PH-600) / 10 but according to other convertion charts for example:
it’s not even close to this. For examble with ORP 800 and pH 7.5 (800+7.5-600)/10 we have 20.75ppm. As you see above it has 4ppm. The gap is HUGE! When i ask it why it give the 600 and what is it I’m getting this:
The value of 600 in the formula is a constant and represents the theoretical redox potential of a solution containing both chlorine and hypochlorous acid (HOCl) at a pH of 7. This value is often used as a reference point for redox measurements in swimming pools, where the predominant form of chlorine is HOCl.
The value of 600 is subtracted from the sum of the mV and pH values in the formula to account for the contribution of hypochlorous acid to the redox potential. This leaves only the contribution of free chlorine to the redox potential, which can then be used to estimate the free chlorine concentration in the pool water.
It’s worth noting that the value of 600 is an approximation, and the actual redox potential of a solution containing chlorine and HOCl will depend on factors such as temperature, pressure, and the concentration of other ions in the solution. However, for practical purposes, the value of 600 is a reasonable approximation that is widely used in the swimming pool industry.
The question is how can I have a sensor which calculate with the data from the above chart in Home Assistant?
Easy, if you hire one for the project cause who wants to work for free for you ?
I guess you will need and want an expert so be prepared for a nice price and do not start counting beans that the parts are so cheap and the price is ridiculous.
It is not - only the expectations are ususally too high.
And due to the behaviour to not really honor the effort other have invested and wrote replies and ideas I doubt that any one will want to work on such a project cause so many replies of others had not been rewarded by you so there is not much hope that you will get anything except you will pay for it.
Usually people tend to present their results when they have asked a question and let others think for them. But I doubt chat gpt is able to deliver anything usefull based on what you had asked for .
But who knows as long as chat gpt is not taking over and also replying here.
Would be genuinely fascinated to see the results. Here’s my attempt (luckily, the the table was searchable and the text copyable!) — paste this into Developer Tools / Template to play: