Skip to content

OpenHAB Integration / Alexa Integration

OpenHAB is a vendor and technology agnostic open source automation software for your home. It allows you to integrate a wide range of devices and technologies, including NextCP/2 media.

NextCP/2 can be integrated into OpenHAB to control media playback, volume, and other features through a unified interface. This integration allows you to use voice commands via Amazon Alexa to control your NextCP/2 instance.

The easiest way to install OpenHAB is by using a docker image. After installation go to Settings -> Add-on Store -> Bindings and add the http binding. Then continue with the configuration of the Amazon Alexa Smart Home Skill.

Configuration steps
  • Go to Settings -> Things and add a thing by pressing the plus sign.
  • Click on http binding
  • Click on HTTP URL Thing
  • Set label to ‘NextCP2’, location to ‘server'
  • 'base-url’ must point to your NextCP/2 installation : http://192.168.1.5:8085/SimpleDeviceControl. Change host and port according to your configuration.

Go to NextCP/2 window and identify the device you want to control in the “App Settings” and copy the DEVICE_UUID. Go back to OpenHAB window.

Configuration steps
  • Click on the new added thing and click on channels.
  • Click on add channel.
  • Select Switch-Channel.
  • Configure the channel by adding a label like “Amplifier Power”.
  • Enter for “command url extension” /standby/DEVICE_UUID/%2$s
  • Enter for “status url extension” /standby/DEVICE_UUID
  • Enter for “ON value” false
  • Enter for “OFF value” true
  • SAVE
  • In the channel overview. Identify the new created channel “Amplifier Power” and click on “Add link to item”
  • Click on “create new item”. Choose an identifying name that will be used in Alexa later like “Amplifier”. Click on “link”.

Go to NextCP/2 window and identify the device you want to control in the “App Settings” and remember the DEVICE_UUID. Then identify the Radio station by clicking on “Radio” url encode the radio label and remember it. It is sufficient to copy only the first parts of the radio station label, that uniquely identifies the radio station. Go back to OpenHAB window.

Configuration steps
  • Click on the new added thing and click on channels.
  • Click on add channel.
  • Select Player channel.
  • Configure the channel by adding a label like “Play Radio FFN”.
  • Enter for “mode” WRITE ONLY
  • Enter for “playValue” playDefaultRadio/[DEVICE_UDN]/[RADIO_NAME_URL_ENCODED]
  • Enter for “pauseValue” pauseRadio/[DEVICE_UDN]
  • Enter for “commandExtension” %2$s
  • SAVE
  • In the channel overview. Identify the new created channel “Play Radio” and click on “Add link to item”
  • Click on “create new item”. Choose an identifying name that will be used in Alexa later like “PLAY FFN”. Click on “link”.

Change the baseURL, DEVICE_UDN and RADIO_NAME according to your setup.

UID: http:url:464b7fb4a0
label: NexctCP/2
thingTypeUID: http:url
configuration:
authMode: BASIC
ignoreSSLErrors: false
baseURL: http://192.168.112.5:8085/SimpleDeviceControl
delay: 0
stateMethod: GET
refresh: 30
commandMethod: GET
contentType: application/json
timeout: 3000
bufferSize: 2048
location: Server
channels:
- id: last-failure
channelTypeUID: http:request-date-time
label: Last Failure
configuration: {}
- id: last-success
channelTypeUID: http:request-date-time
label: Last Success
configuration: {}
- id: McIntosh_Standby_State
channelTypeUID: http:switch
label: McIntosh Standby
description: ""
configuration:
onValue: "false"
offValue: "true"
stateExtension: /standby/4c494e4e-3d9b-11e1-b86c-0016e808df4b
commandExtension: /standby/4c494e4e-3d9b-11e1-b86c-0016e808df4b/%2$s
- id: Play_Radio_FFN
channelTypeUID: http:player
label: Play Radio FFN
description: ""
configuration:
mode: WRITEONLY
playValue: playDefaultRadio/4c494e4e-3d9b-11e1-b86c-0016e808df4b/103.1%20%7C%20radio%20ffn
pauseValue: pauseRadio/4c494e4e-3d9b-11e1-b86c-0016e808df4b
commandExtension: "%2$s"
Configuration steps
  • Click on Settings -> Items
  • Select the create Power ON/OFF item.
  • Click “Add Metadata”
  • Select “Amazon Alexa”

Rules can be used to further customization. Let’s say if OpenHAB receives the POWER ON command for the amplifier (i.e. from Alexa), it should also play radio energy.

Configuration steps
  • Click on Settings -> Rules
  • Give a label
  • For “When” click “Add Trigger”
  • select the “Amplifier Power” item
  • For “COMMAND” enter “ON”
  • Press save
  • For “Then” click “Add Action”
  • select the “Play Radio Energy” item
  • For “COMMAND” enter “PLAY”
  • Press save

Now, the Amplifier should be visible in Alexa-App. You should be able to say “Alexa, power on Amplifier”. As a result, your device should power on and Radio Energy should be played.