Skip to content

XMLTV Binding ​

XMLTV is an XML-based file format for describing TV listings. It's commonly used by home theater software to produce an electronic program guide (EPG). See the XMLTV project wiki for details: http://wiki.xmltv.org/index.php/Main_Page

The format separates building the guide from displaying it. The XMLTV file itself is produced by so‑called "grabbers": http://wiki.xmltv.org/index.php/HowtoUseGrabbers

Some websites provide updated XMLTV files that can be downloaded directly (for example, France and Switzerland: https://xmltv.ch/).

This binding reads an XMLTV file and creates a Thing for each channel contained in it. Channels from the XMLTV file are represented as "Media Channels" to avoid confusion with openHAB Channels.

Each channel Thing exposes information about the current program and the next one.

Supported Things ​

  • xmltvfile — Bridge to an XMLTV file (reads and parses the file)
  • channel — A TV channel defined in the XMLTV file

Discovery ​

Once the XMLTV file bridge is created, you can add all known channels by scanning for new things.

Binding Configuration ​

Configuration ParameterRequiredDescriptionDefault
filePathYesFull path (including filename) to an XMLTV file
refreshNoXMLTV file reload interval (hours)24 h
encodingYesXMLTV file encodingUTF-8

Thing Configuration ​

Configuration ParameterRequiredDescriptionDefault
channelIdYesID of the channel as presented in the XMLTV file
offsetNoOffset applied to program times (minutes; +/-)0
refreshNoRefresh interval (seconds)60

Channels ​

Channel Type IDItem TypeDescription
iconUrlStringChannel icon URL
iconImageIcon of the channel

Current program (currentprog) channel group ​

Channel Type IDItem TypeDescription
progStartDateTimeProgram start time
progEndDateTimeProgram end time
progTitleStringProgram title
progCategoryStringProgram category
progIconUrlStringURL to an image of the program
iconImageIcon of the program
elapsedTimeNumber:TimeElapsed time of the current program
remainingTimeNumber:TimeTime remaining until the end of the program
progressNumber:DimensionlessRelative progression of the current program

Next program (nextprog) channel group ​

Channel Type IDItem TypeDescription
progStartDateTimeProgram start time
timeLeftNumber:TimeTime left before program start
progEndDateTimeProgram end time
progTitleStringProgram title
progCategoryStringProgram category
progIconUrlStringURL to an image of the program
iconImageIcon of the program

Full Example ​

xmltv.things ​

dsl
Bridge xmltv:xmltvfile:france "XMLTV" @ "TV" [filePath="/etc/openhab/scripts/tvguide.xml"]
{
    Thing channel france2 "France 2" @ "TV" [channelId="C4.api.telerama.fr", offset=0, refresh=60]
}

xmltv.items ​

java
String france2_title "Titre" {channel="xmltv:channel:france:france2:currentprog#progTitle"}