moin,
I created a template to remot control my Kodi Media Center. Iโm a beginner with OH2 and HABPanel and it was a good exercise to learn basic things
OH2 runs on a RPi3, Kodi on a RPi2.
You need the Kodi binding installed.
In the things folder create a file kodi.things:
kodi:kodi:MediaCenter [ipAddress="192.168.178.22", port="9090"]
Of course you had to adopt the IP adress to your needs
You should see in PaperUI a thing "Kodi Media Center"
link at least the following channels.
(sorry, dont know, why the link isnโt shown)
in items folder create a file kodi.items:
String Kodi_input "Input" { channel="kodi:kodi:MediaCenter:input" }
String Kodi_inputtext "Inputtext" { channel="kodi:kodi:MediaCenter:inputtext" }
String Kodi_systemcommand "Systemcommand" { channel="kodi:kodi:MediaCenter:systemcommand" }
Player Kodi_control "Control" { channel="kodi:kodi:MediaCenter:control" }
In HABPanael create a template:
<style>
table {
width: 90%
}
</style>
<table>
<tr>
<td>
<strong>Media-Center</strong>
</td>
</tr>
</table>
<table>
<tr>
<td>
<button style="width: 100%; height: 3em;
border: 0; color: white; background: grey;
font-size: 30px" ng-click="sendCmd('KodiMute', 'ON')">
<i class="glyphicon glyphicon-volume-off"></i>
</button>
</td>
<td>
<button style="width: 100%; height: 3em;
border: 0; color: white; background: midnightblue;
font-size: 30px" ng-click="sendCmd('Kodi_input', 'Up')">
<i class="glyphicon glyphicon-menu-up"></i>
</button>
</td>
<td>
<button style="width: 100%; height: 3em;
border: 0; color: white; background: grey;
font-size: 30px" ng-click="sendCmd('KodiMute', 'OFF')">
<i class="glyphicon glyphicon-volume-up"></i>
</button>
</td>
</tr>
<tr>
<td>
<button style="width: 100%; height: 3em;
border: 0; color: white; background: midnightblue;
font-size: 30px" ng-click="sendCmd('Kodi_input', 'Left')">
<i class="glyphicon glyphicon-menu-left"></i>
</button>
</td>
<td>
<button style="width: 100%; height: 3em;
border: 0; color: white; background: blue;
font-size: 30px" ng-click="sendCmd('Kodi_input', 'Select')">
<i class="glyphicon glyphicon-screenshot"></i>
</button>
</td>
<td>
<button style="width: 100%; height: 3em;
border: 0; color: white; background: midnightblue;
font-size: 30px" ng-click="sendCmd('Kodi_input', 'right')">
<i class="glyphicon glyphicon-menu-right"></i>
</button>
</td>
</tr>
<tr>
<td>
<button style="width: 100%; height: 3em;
border: 0; color: white; background: grey;
font-size: 30px" ng-click="sendCmd('Kodi_input', 'Back')">
<i class="glyphicon glyphicon-arrow-left"></i>
</button>
</td>
<td>
<button style="width: 100%; height: 3em;
border: 0; color: white; background: midnightblue;
font-size: 30px" ng-click="sendCmd('Kodi_input', 'Down')">
<i class="glyphicon glyphicon-menu-down"></i>
</button>
</td>
<td>
<button style="width: 100%; height: 3em;
border: 0; color: white; background: grey;
font-size: 30px" ng-click="sendCmd('Kodi_input', 'ShowOSD')">
<i class="glyphicon glyphicon-menu-hamburger"></i>
</button>
</td>
</tr>
</table>
<table>
<tr>
<br></br>
<td>{{itemValue('Kodi_title')}}
</td>
</tr>
</table>
<table>
<tr>
<td>
<button style="width: 100%; height: 2em;
border: 0; color: white; background: darkgrey;
font-size: 20px" ng-click="sendCmd('Kodi_control', 'PREVIOUS')">
<i class="glyphicon glyphicon-step-backward"></i>
</button>
</td>
<td>
<button style="width: 100%; height: 2em;
border: 0; color: white; background: darkgrey;
font-size: 20px" ng-click="sendCmd('Kodi_control', 'REWIND')">
<i class="glyphicon glyphicon-backward"></i>
</button>
</td>
<td>
<button style="width: 100%; height: 2em;
border: 0; color: white; background: darkgrey;
font-size: 20px" ng-click="sendCmd('KodiStop', 'ON')">
<i class="glyphicon glyphicon-stop"></i>
</button>
</td>
<td>
<button style="width: 100%; height: 2em;
border: 0; color: white; background: darkgrey;
font-size: 20px" ng-click="sendCmd('Kodi_control', 'PAUSE')">
<i class="glyphicon glyphicon-pause"></i>
</button>
</td>
<td>
<button style="width: 100%; height: 2em;
border: 0; color: white; background: darkgrey;
font-size: 20px" ng-click="sendCmd('Kodi_control', 'PLAY')">
<i class="glyphicon glyphicon-play"></i>
</button>
</td>
<td>
<button style="width: 100%; height: 2em;
border: 0; color: white; background: darkgrey;
font-size: 20px" ng-click="sendCmd('Kodi_control', 'FASTFORWARD')">
<i class="glyphicon glyphicon-forward"></i>
</button>
</td>
<td>
<button style="width: 100%; height: 2em;
border: 0; color: white; background: darkgrey;
font-size: 20px" ng-click="sendCmd('Kodi_control', 'NEXT')">
<i class="glyphicon glyphicon-step-forward"></i>
</button>
</td>
</tr>
</table>
The Volume i a normal Slider widget in HABPanel. Itโs linked to kodi_vol item.
It is very simple but perhaps for an other beginner helpfull.