OH3, my first steps with the HTTP Binding: switch the AC3 downmix on an enigma2 receiver

In the last two days I was trying to set up my first rule using an HTTP binding I grew a little frustrated while googling as the results were a mix of OH2 and OH3, mappings, files and no clear indication where I had to put what. So I’ll try to use my pent up frustration to write up my simple solution to a simple problem in a hopefully structured way. Here we go:

Problem: My Dreambox 7080 receiver (running Newnigma²) is mainly used with the TV speakers and volume is adjusted on the receiver. AC3 downmix has to be enabled or else the box would pass on the audio stream unaltered. Sometimes I do like to use the 5.1 set up though - so when the AVR is turned on, the Dreambox should deactivate AC3 downmix automatically - otherwise the AVR would only get a downmixed stereo signal instead of 5.1.
As of writing this, the enigma2 binding does not have a channel for AC3_downmix, so I’ll have to build my own trigger.

What I’m trying to automate:
Using a browser I csn do an http-request manually to

  • http://dreambox-ip/web/downmix

and I get

<e2simplexmlresult>
  <e2state>True</e2state>
  <e2statetext>AC3 Downmix aktiviert</e2statetext>
</e2simplexmlresult>

Extending the URL like this

  • http://dreambox-ip/web/downmix?enable=True

I can turn downmix ON and OFF by just sending enable=True or enable=False. In the XML sent by the receeiver I get the current state in the tags. Not that I really need the current state but that’s just an extra exercise.

Modules to install:
This example needs the official OpenHAB HTTP Binding and the XPath Transformation found in Bindings and Other Add-Ons respectively.

Creating the thing:




Please don’t write “dreambox-ip” but your actual IP of the receiver :wink:
Also here I just insert the base-adress without the “/web/downmix” part.

Creating a Switch channel for the thing:
Under Channel Add Channel or Configure Channel (if you’re just editing an already created one) the configuration looks like this.


The XPath-value will navigate the response XML to read the current state.
To read the current state we’ll just need /web/downmix without the ? and everything past that.
The command URL extension of course needs the part including enabled= and the parameter %2$s which contains either the onValue or offValue. We’ll also define that the onValue is True (case sensitive btw. so true or TRUE won’t work with enigma2)

And that’s all there is to it. No extra files or mappings. Hope someone will find this helpful.
Here’s final code:

UID: http:url:8300882a42
label: Dreambox 7080 HTTP commands
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: http://dreambox-ip
  delay: 0
  stateMethod: GET
  refresh: 30
  commandMethod: POST
  contentType: text/xml
  timeout: 3000
  bufferSize: 2048
location: Wohnzimmer
channels:
  - id: AC3_Downmix
    channelTypeUID: http:switch
    label: Downmix
    description: ""
    configuration:
      onValue: "True"
      mode: READWRITE
      offValue: "False"
      stateExtension: /web/downmix
      stateTransformation: XPath:/e2simplexmlresult/e2state/text()
      commandExtension: /web/downmix?enable=%2$s

FWIW, my Dreambox and how to switch it ON/OFF served as a test case for the HTTP binding.

1 Like