Use HABApp for web-interaction through selenium

Im new to HABApp (and python). I think this looks like a good path to improve rule-implementation/structure over my current DSL-Openhab-rules!

The reason I started to check HABApp is that I would like to automate the control of my “LVI Yali” heat radiators which are currently accessible through a web interface.

I have played around using python + selenium and have managed to control the temp settings “manually” through selenium. Now I would like to automate/incorporate these functions in python calls from Openhab/HABApp. Whats unclear to me:

  • How do I install the selenium module so that its accessible from HABApp? (currently I run from a rPi, where HAPApp is installed through the inbuilt openhab-config-tool). This might change to a docker-installation in near future. I believe the functions should be installed for the “openhab” user (not “openhabian”)?

  • If i do my own help classes and put these files in the lib-folder, is there a way to make HABApp reload these functions other than restarting HABApp.service? My experience so far is that help classes are accessible only if defined inside the rule-file from where its called (or in the lib-folder with following restart of habapp.service)?

  • Any opinion if I am on the right path about implementing calls to python/selenium-scripts from inside HABApp to control the temp setting, or is there alternative more simple solution (ie separate implementation and accessible through MQTT for instance)?

Did you check if there is maybe some API for “LVI Yali”? Normally if a devices has some web interface you will also have, for example a REST API.

Automating with Selenium via WebUI is not something I would recommend - that more something you use for test automation for strictly defined scenarios…

Yes, I did. Unfortunately no API available and no plans to develop either.

Touch E3, Går det att integrera mot överordnat system (Openhab, Home Assistant el. liknande) - Purmo Group Sweden AB (kundo.se)

Think I solved my own 1st question. Sometimes things like the openhab-config is hiding whats really happening, so just following the manual installation sequence and repeat for selenium should solve my problem? ie:

openhabian@openhabian:/ $ cd opt/habapp
openhabian@openhabian:/opt/habapp $ source bin/activate
(habapp) openhabian@openhabian:/opt/habapp $
(habapp) openhabian@openhabian:/opt/habapp $ python3 -m pip install selenium

I’d create a fresh script to control the thermostat(s) and execute it with self.execute_python.
That way creating/debugging is much easier and it’s sufficient for the few thermostat changes per day.
You’d install the selenium driver in the venv like you posted.

If I remember correctly there is a docker container which runs the selenium worker and you can connect the selenium driver to the docker container. Just look at the selenium docker image and the selenium docks