openHAB 2 Enigma2 Integration

Smart Home – openHAB 2 Enigma2 Integration

This post all about the openHAB 2 Enigma2 integration. It explains how to integrate Enigma2 boxes like for example a VU, Octagon, Xtrend or Gigablue in openHAB 2 by using the HTTP Binding and a Regex Transformation. You will receive step by step instructions how to send commands like mute or others to the Enigma box. Furthermore, you will learn how current information is shown, like the current station or program. You will also learn how to send a message to the box to immediately receive important information from your Smart Home as another integration. The only prerequisite for the box is a system operating with openWebIf. I use openATV 6.2 on my box.

Integration of Enigma 2 is only an example. As long as your other devices are able to work with http requests you can control anything. Even with your voice!

Smart Home – openHAB 2 Enigma2 Hardware

As I’ve mentioned already, you can practically control any Enigma 2 box. A little while ago, I searched for a good Enigma 2 box.  Please keep in mind to pick the correct receiver like DCB-S2, DVB-C/T2.

There are lot of good ones, but I have gone for the Gigablue HD Quad.

GigaBlue UHD Quad 4 K 2XDVB: FBC Ultra HD E2 Linux HEVC H.265 Receiver 4TB HDD

With pride we present our latest model Gigablue UHD Quad 4 K. 2 x CI, 2 x card reader, large TFT colour display, gigabit LAN port, 2 x HDMI, SD Card and 4 x USB Ports which ...

Last update was on: 5. April 2019 8:34
out of stock

 

openHAB 2 Enigma2 – Paper UI Binding and Transformation

openHAB 2 Enigma2 Configuration – HTTP Binding

First, you install the HTTP binding through the Paper UI. Call up extensions and bindings.

After that, install the binding with a click to ‘install’ right next to the binding. If everything worked, you will see the following.

openhab-2-engima2-http-binding

 

openHAB 2 Enigma2 Configuration – RegEx Transformation

Now click on transformations and install the RegEx transformation.

openhab-2-engima2-regex-transformation

openHAB 2 Enigma2 Configuration – SmartHome Designer

To control everything with openHAB 2 we now need the relevant items, the adaptation of the sitemap and the rules.

openHAB 2 Enigma2 – SmartHome Designer Item

It’s best if you create a group in your items configuration to bundle the functions.

Following that, you define the items. The first two items retrieve the information from OpenWebIf via HTTP request and RegEx transformation. There are loads of possibilities to access the information on the Enigma2 box. You will find a useful reference to the web interface with this link. Referenz zum Webinterface. The second item triggers a rule, which will be explained later.

So what is happening with these first two items?

  • The first part is the HTTP request via the HTTP binding { http=”<[]” }. It executes the HTTP binding and delivers the value (<) of the URL in the square brackets back to the item.
  • http://<ENIGMA_BOX_IP>:<PORT>/web/getcurrent is the original URL, which retrieves a XML formatted text from OpenWebIf.
  • The following part “:3000:REGEX(.*?<e2eventname>(.*?)</e2eventname>.*)” is very cryptic at first glance and not self-explanatory. This passage takes care that the relevant content is extracted from the XML via RegEx transformation, passing it on to the item as a value.
To get a better grasp, here’s a small example. If the URL http://<ENIGMA_BOX_IP>:<PORT>/web/vol is called up, according to Reference to Webinterface you receive the following XML text.

You now have the chance to extract the value from this XML structure. For that, the text from the element is read by entering the relevant syntax. For example, if we want the status “mute” to show on openHAB, we would use the following syntax.

This implies that all the content between <e2ismuted> and </e2ismuted> is being read. The syntax isn’t exactly simple, but it is logical. I can recommend the following aid. If you would like to now about Regex, read this Regex tutorial. The site RegEx 101 contains a very useful tool for testing your queries. There are also examples.

Use the tool as follows.

openhab-2-engima2-regex-interpreter

  1. On the right choose python under flavor. This will save you the use of the so-called escape characters, which you have to use for the slash in the example above if you don’t change it.
  2. Enter the RegEx expression, in our case:
  3. Enter the RegEx text, from which you want to read.
  4. Check the results. Here you see the result in the brackets as Group 1. In this case, the Engima2 box would not be mute (ismuted = False).

openHAB 2 Enigma2 – SmartHome Designer Sitemap

Now integrate the group into a frame on your sitemap.

As soon as you have done this, you will see the items within the group with their relevant values, if your Enigma2 box is switched on.

openhab-2-engima2-items

 openHAB 2 Enigma2 – SmartHome Designer Rule

In the next two chapters, we will define a rule for sending a command and for sending a message.

 openHAB 2 Enigma2 Rule – Send a Command

Below you see the rule for the third item GB_sendMute. Whenever this item receives a command, the rule will be executed. If the command is ON (case ON 🙂 or OFF (case OFF :), the HTTP request sendHttpGetRequest(“http://192.168.0.219:219/web/vol?set=mute”) is sent. This will take care of muting your Enigma2 box. In both cases it is the same HTTP request. This way it is switched back and forth between mute / not mute as soon as the switch is activated.

 openHAB 2 Enigma2 Rule – Voice Control

Althoughit is in german the following video demonstrates the control of various commands via voice control. How to realize the voice control, you can read in the post KNX Speech Recognition.

 

To control the Enigma2 box via voice openHAB uses the following item, for example.

Now enter the relevant rule.

As soon as this item receives a command, the rule will be executed. If the command ON is received, I switch on the box with an HTTP request. That way you can control your box solely by voice.

If you experience any problems, this might be because of active authorization. Try to add the user root and your password like this.

http://root:passwort@192.168.xxx.xxx:80/…

 openHAB 2 Enigma2 Rule – Send a Message

We also use a rule for sending a message. I have thought of the following. If I’m sitting in front of the TV, relaxed and absorbed, I don’t notice if someone comes to visit. Which is why I want to check if the motion sensor in my driveway is detecting motion. If this is the case, I send the relevant message to the box and can see it on my TV. With the aid of my webcam I can then decide whether the visitor is worth getting up for.  =)


Whar are your projects and ideas about using the HTTP Binding?

 openHAB 2 Enigma 2 – Ressource

I showed only an extract of what is possible. If you would like what is possible please check the resources.

Thomas has build its own Smarthome in 2010. In 2016 he started a German blog about Smarthome to share his knowledge. 2017  he started consulting customers that needed help setting up their own Smarthome. In 2018 the first German course about cloudless Smarthome was launched at Udemy. This course became one of the top rated Smarthome courses. This Smarthome course is now also available in English.

We will be happy to see your thoughts

      Leave a reply