Swimming pool and OpenHAB (3/4)

After we created the controller for pool control in the previous blog article, we will now connect it to OpenHAB via the WLAN and implement the rules for smart control there.

Installing OpenHAB

OpenHAB is a "Home Automation Broker", i.e. a Smart Home Server Software. This can be installed on a Raspberry Pi. For this, there is a Blog article, which describes the installation. In addition, on the project page of openHAB there is a very good English Documentation.

We assume here that there is already a basic installation of OpenHAB.

We now need to add some addons to the installation. This is about the surface "Paper UI" in the sub-item "Add-ons".

For the integration of the pool control we need the following add-ons:

  • MQTT Binding
  • openHAB Cloud Connector (optional for Internet access via smartphone apps)
  • RRD4j Persistence
  • JSONPath Transformation
  • Basic UI

Configuration

The configuration files we are creating now are usually in the path '/etc/openhab2' on the Raspberry. The corresponding structure with the files is stored in the GitHub repository.

Connect MQTT brokers

The configuration for connecting the Mosquitto service can be located in the file 'services/mqtt.cfg'. It configures the host name and port. In our case, openHAB and Mosquitto run on the same Raspberry.

Sitemap with the items

First, we need to define the objects (items) in OpenHAB so that we can control and evaluate them on the sitemap.

pool.items

In the file pool.items measurement and control points are determined. There, for example, the links of the MQTT topics with the items are made. So there are the items for the temperatures that receive the data from MQTT and the items send the messages to switch the pumps. The larger or smaller character in the configuration indicates the direction of the messages:

Number  Sensor_Solar_Temperature "Solar"
(gPool, gTemperature, Chart_Pool_Temperature)
["CurrentTemperature", "object:solar"] {
mqtt="<[mqtt:/sensor/solar/temperature:state:JSONPATH(.value)]"
}

 

Charts

For Chart graphics and integration with Alexa are built into some other configuration elements. For example, the time period of the charts can be set via the settings.

The charts are used to visualize the temperature gradients and switching times. For the charts to work properly, this data needs a maximum of one minute. So our timer in the pool controller fits perfectly.

The measurement data is stored in a rrdb database. There is also a configuration in the repository. Since we do not need the data for long-term evaluations, this internal database of openHAB is completely sufficient.

Attention of the Asterisk * in the rrd4j.persist is not a placeholder, but indicates that all items should be stored in this group!

pool.sitemap

The items are now merged into the sitemap to create the following interface:

Pool AutomationSettings

 

What happens next?

Now we have the sitemap with the temperature values and the switching options for the two pumps.

In the final fourth article, we will discuss the rules for automated pool control.

Go to: The Smart Pool (4/4)

 

Projekte für fortgeschritteneSmart home

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN