Use python packages in python script?

Hi!

I want to use an external python package in a python script like this:

from atmos import calculate
RH = hass.states.get('input_slider.keller_humid')
T  = hass.states.get('input_slider.keller_temp') + 273.15
p  = hass.states.get('sensor.yr_pressure')
AH = calculate('AH', RH=RH, p=p, T=T, debug=True)[0]
logger.info('Absolute Humidity Keller: '+AH+' g/m3')
hass.states.set('sensor.asbhum_in',AH)

When calling the script, I get ImportError: __import__ not found. Do I have to install the atmos package in homeassistant somehow?

Best, vrs01

No, it is not supported to include external libraries. If you need full python scripting capabilities please have a look at AppDaemon.
https://home-assistant.io/docs/ecosystem/appdaemon/

2 Likes

ok good to know! Thanks