More HVAC monitoring

Yeah it’s just measuring a differential between the two ports on the sensor, so it is signed. Sounds like it might be easier for you to negate the value.

I didn’t get a chance last night to test switching ports, but would this be appropriate?

#include <cmath>

float pressure = std::abs((output - this->output_min_) * (this->pressure_max_ - this->pressure_min_) /
                          (this->output_max_ - this->output_min_) + this->pressure_min_);

I didn’t mean changing the sensor code, just where ever you are using the value, use -value instead. Assuming it is in home assistant use a number helper or something to negate the value.

Ah ok, I think I’ll still try in the c code if possible, I’ve been cleaning up helpers and other sensors that aren’t strictly necessary. My thought process is, since the addition of the values are absolute, that casting to unsigned (may cause unexpected results) or piping through abs() (should be safe) at the source would be better than having Hass manipulate the values and reduce extra, unneeded entities.

I’m a hobbyist python dev, not much experience in c, so I may be way out to left field.

Actually, after typing this out, I think I can pass the value through an abs filter in Jinja templates within the esphome config.

Edit: so it turns out I did fat finger the tubes back onto the same nipples. I dismounted the sensor so I could actually see it instead of going by feel and the readings are positive.

1 Like