Hi all,
I’m running this script here on a RPi4
It basically measures radon levels (Airthings Wave Plus) and adjust the radon fan speed using the mcp4725 based on the level of radon. The radon fan uses a DAC (digital to analogue controller) and accepts values from 0.00 to10.00, which corresponds to fan speed of 0 to 100%. It also logs pressure from a Honeywell AMBP Sensor and sends alerts (via gmail) when any of the values are out of range. Here’s my actual setup, you can see the components:
Here’s what I did to try and get this into HA via HAOS. I created 2 custom addons
- For reading the Honeywell Pressure sensor using this code only:
Summary
if __name__ == '__main__':
print("Press CTRL+C to exit...")
try:
abp = SensorHnyAbp("060MG2") # 0 to 60 mbar gage I2C
# abp = SensorHnyAbp("001PDS") # -1 to +1 psi diff SPI
while True:
"""
result = abp.readAbp()
print('Press: {0:7.3f} {1:s} {2:7.2f} in.wc'.
format(round(result,3), abp.PRES_UNITS, round(abp.pres2inwc(result),2)) )
status, result = abp.readAbpStatus()
print('Status: {0:d} Press: {1:7.3f} {2:s} {3:7.2f} in.wc'.
format(status, round(result,3), abp.PRES_UNITS, round(abp.pres2inwc(result),2)) )
"""
status, result, tempC = abp.readAbpStatusTemp()
if 0 : # mbar
print('Status: {0:d} Press: {1:7.3f} {2:s} {3:7.2f} in.wc {4:5.1f} degF'.
format(status, round(result,3), abp.PRES_UNITS, round(abp.pres2inwc(result),2), round(abp.c2f(tempC),1)) )
else : # psi
print('Status: {0:d} Press: {1:7.3f} {2:s} {3:7.2f} in.wc {4:5.1f} degF'.
format(status, round(result,3), abp.PRES_UNITS, round(abp.pres2inwc(result),2), round(abp.c2f(tempC),1)) )
time.sleep(1) # Print out every second
except KeyboardInterrupt:
sys.exit(" Exit")
- For setting the value for the DAC fan speed
Summary
if __name__ == '__main__':
print("Press CTRL+C to exit...")
try:
dac = mcp4725()
# initialize bus
i2c_ch = 1 # i2c channel
dac.bus=smbus.SMBus(i2c_ch) # Initialize I2C (SMBus)
while True:
print("Enter value (0.0 - 1.0): ")
value = float(input())
dac.writeDAC(value)
except KeyboardInterrupt:
print(" Keyboard interrupt caught, exiting.")
dac.bus.close()
By creating these 2 addons, I was able to see the pressure being logged every few seconds and I was able to control the fan speed, but there was a couple of issues:
-
I was not able to get the pressure data into HA, it was just being shown/logged in the addon logs and not like an entity with a history date/time etc.
-
I had to publish a new version of the addon to change the value of the DAC it was not like a number input, for example
I believe there needs to be an integration that has to be created to bring these two features into HA.
The rest of the script is extra because I can use for example the Airthings, Gmail integrations to take care of the rest.
If I can get these two into HA, it would basically be all that I need to replace the script.
Any takers? Perhaps fee for service?
thanks