Integrating advanced math solver from a python library

Hi all, my final aim is to output a sensor for the thermal comfort parameter based on six variables that I will have sensors for (i.e. temp, humidity, air velocity,…). The python library that already does this can be found here:

Previously I have done something similar with simple math equations using value templates, creating new sensors that are based on one or more other sensors. I realised that the thermal comfort python library function requires an iterative solver, thus I’m not sure if that will be possible with value templates.

Can I seek advice on which would be a good way forward?

  1. Is porting everything onto hass even possible including the iterative solver?
  2. Get the python script to run within hass, sensors from hass will pass inputs and python will find the solution and will output as another sensor. I think this is possible with pyscript/appdaemon but not very familiar with them.
  3. Any other better way, I also have a separate running raspberry pi so could possibly run the python scripts over there.

There are two methods of support for python scripts in ha’

Appdaemon and pyscript.

Or you could create a custom component.

What about this integration?

1 Like

Hi thanks, between Appdaemon and pyscript which would work better in this case?

I suspect probably appdaemon.

But as there is a pypi package, why not make a custom component?

I am not very familiar with developing a custom component, will look into it

Sorry I still cant find info on how to start, can you share more on adding pypi pkgs as custom component?

There are literally hundreds of integrations to crib from here core/homeassistant/components at dev · home-assistant/core · GitHub. In each integration look at manifest.json, that is where the pypi package is specified.