Hi,
I have written some python code to get value from meter-bus device through serial port. It is using some external tools (C-executable), but I wrapped this in a python script and it is working fine
Now I am trying to integrate it in home-assistant. My first approach is to use a new sensor platform (like in doc example ),and call my python script in update function.
So I have a file located here : ~/.homeassistant/custom_components/sensor/mbus.py
and I try to use my python code from here ~/.homeassistant/custom_components/sensor/pwhandler.py
When I try to import it in mbus.py like this:
from pwhandler import PwHandler
I get a NoModuleFound python error. I guess original call path is not from sensor folder, but I can’t get the call location to fix path. By the way, Is it the right way to use an external python file for a platform?
Another things that I wonder is, I have several sensor values coming from a single call to my python code. So it will be an overhelm to call code for each sensor. Is there a way to manage this, maybe something like a service to grab all values and then every sensor request their values to this service?
Thanks,
Claude