Hi guys, I’m new here and before going crazy trying to find things on my own, I will share with you all what I’m trying to do. I have a raspberry pi 4 b running openhabian with a Waveshare ups hat (b). The ups comes with a python script that prints out voltage/current/battery % in terminal. What would be the best way to get those values displayed in openhab instead. Thanks
If you already have a python script, then the best approach, in my opinion, would be to just modify that script to send the values directly to OH via the API. In the past, I’ve used the
requests library for things like this.
Other secondary options might be:
- If you already have mqtt running for some other reason or are comfortable using an mqtt broker, then there are mqtt libraries for python that would do the trick fairly easily as well, though I have less experience with them.
- Replicate the script you have using HabApp which will also then allow you to send the values directly to OH items (this is equivalent to my first recommendation as HabApp just uses the API, but may be slightly easier depending on your setup).
- Get the python script to write out the values to some log file and use the logReader binding to collect and parse the values.
There are so many communication routes for OH, I’m sure there are a dozen more options that are just as good as theses.
Thanks Justin for this fast response. It gives me some directions on how to target my research for this project.