added migrated 2.x add-ons

Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
Kai Kreuzer
2020-09-21 01:58:32 +02:00
parent bbf1a7fd29
commit 6df6783b60
11662 changed files with 1302875 additions and 11 deletions

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<binding:binding id="spotify" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:binding="https://openhab.org/schemas/binding/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/binding/v1.0.0 https://openhab.org/schemas/binding-1.0.0.xsd">
<name>Spotify Binding</name>
<description>This is the openHAB binding for Spotify used to manage Connect devices. Using the Spotify WebAPI.</description>
<author>Andreas Stenlund, Hilbrand Bouwkamp</author>
</binding:binding>

View File

@@ -0,0 +1,361 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="spotify"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Spotify Player Device -->
<bridge-type id="player">
<label>Spotify Player Bridge</label>
<description>Bridge representing the Spotify Player in the context of a user account. The bridge is associated with
one specific Spotify account. If you want to control your devices in the context of different accounts you have to
register a bridge for each account. Go to http://your openHAB address::8080/connectspotify to authorize.</description>
<channels>
<channel id="accessToken" typeId="accessToken"/>
<channel id="deviceId" typeId="activeDeviceId"/>
<channel id="deviceName" typeId="activeDeviceName"/>
<channel id="devices" typeId="activeDevices"/>
<channel id="deviceType" typeId="activeDeviceType"/>
<channel id="deviceVolume" typeId="system.volume"/>
<channel id="deviceShuffle" typeId="activeDeviceShuffle"/>
<channel typeId="playlists" id="playlists"></channel>
<channel typeId="playlistName" id="playlistName"></channel>
<channel id="trackPlay" typeId="trackPlay"/>
<channel id="trackPlayer" typeId="system.media-control"/>
<channel id="trackRepeat" typeId="trackRepeat"/>
<channel id="trackId" typeId="currentlyPlayedTrackId"/>
<channel id="trackHref" typeId="currentlyPlayedTrackHref"/>
<channel id="trackUri" typeId="currentlyPlayedTrackUri"/>
<channel id="trackName" typeId="system.media-title"/>
<channel id="trackType" typeId="currentlyPlayedTrackType"/>
<channel id="trackNumber" typeId="currentlyPlayedTrackNumber"/>
<channel id="trackDiscNumber" typeId="currentlyPlayedTrackDiscNumber"/>
<channel id="trackPopularity" typeId="currentlyPlayedTrackPopularity"/>
<channel id="trackExplicit" typeId="currentlyPlayedTrackExplicit"/>
<channel id="trackDurationMs" typeId="currentlyPlayedTrackDurationMs"/>
<channel id="trackProgressMs" typeId="currentlyPlayedTrackProgressMs"/>
<channel id="trackDuration" typeId="currentlyPlayedTrackDuration"/>
<channel id="trackProgress" typeId="currentlyPlayedTrackProgress"/>
<channel id="albumId" typeId="currentlyPlayedAlbumId"/>
<channel id="albumUri" typeId="currentlyPlayedAlbumUri"/>
<channel id="albumHref" typeId="currentlyPlayedAlbumHref"/>
<channel id="albumType" typeId="currentlyPlayedAlbumType"/>
<channel id="albumImage" typeId="currentlyPlayedAlbumImage"/>
<channel id="albumName" typeId="currentlyPlayedAlbumName"/>
<channel id="artistId" typeId="currentlyPlayedArtistId"/>
<channel id="artistUri" typeId="currentlyPlayedArtistUri"/>
<channel id="artistHref" typeId="currentlyPlayedArtistHref"/>
<channel id="artistType" typeId="currentlyPlayedArtistType"/>
<channel id="artistName" typeId="system.media-artist"/>
</channels>
<properties>
<property name="user"/>
</properties>
<representation-property>clientId</representation-property>
<config-description>
<parameter name="clientId" type="text">
<required>true</required>
<label>Application Client ID</label>
<description>This is the Client ID provided by Spotify when you add a new Application for openHAB to your Spotify
Account. Go to https://developer.spotify.com/</description>
</parameter>
<parameter name="clientSecret" type="text">
<required>true</required>
<label>Application Client Secret</label>
<description>This is the Client Secret provided by Spotify when you add a new Application for openHAB to your
Spotify Account.</description>
</parameter>
<parameter name="refreshPeriod" type="integer" min="1" max="60">
<required>true</required>
<default>10</default>
<label>Connect Refresh Period (seconds)</label>
<description>This is the frequency of the polling requests to the Spotify Connect Web API. There are limits to the
number of requests
that can be sent to the Web API. The more often you poll, the better status updates - at the risk
of running out of
your request quota.</description>
</parameter>
</config-description>
</bridge-type>
<!-- Spotify Player Device -->
<thing-type id="device">
<supported-bridge-type-refs>
<bridge-type-ref id="player"/>
</supported-bridge-type-refs>
<label>Spotify Connect Device</label>
<description>Thing representing a Spotify Connect device. The device exists in the context of the bridge and the
Spotify account associated with the bride. This means the same device can be present as a thing under each Spotify
bridge you have configured.</description>
<channels>
<channel id="trackPlay" typeId="trackPlay"/>
<channel id="deviceId" typeId="deviceId"/>
<channel id="deviceName" typeId="deviceName"/>
<channel id="deviceType" typeId="deviceType"/>
<channel id="devicePlayer" typeId="system.media-control"/>
<channel id="deviceVolume" typeId="system.volume"/>
<channel id="deviceActive" typeId="deviceActive"/>
<channel id="deviceRestricted" typeId="deviceRestricted"/>
<channel id="deviceShuffle" typeId="deviceShuffle"/>
</channels>
<representation-property>deviceName</representation-property>
<config-description>
<parameter name="deviceName" type="text">
<required>true</required>
<label>Spotify Device Name</label>
<description>This is the device name provided by Spotify.</description>
</parameter>
</config-description>
</thing-type>
<!-- Channel Types -->
<channel-type id="accessToken" advanced="true">
<item-type>String</item-type>
<label>Access Token</label>
<description>The access token used to authorize calls to the Spotify Web API. It can be used from rules or client-side
scripting make call to Web API.</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="activeDeviceId" advanced="true">
<item-type>String</item-type>
<label>Active Device Id</label>
<description>The Spotify ID of active device</description>
</channel-type>
<channel-type id="activeDeviceName">
<item-type>String</item-type>
<label>Active Device Name</label>
<description>The name of the currently active device</description>
</channel-type>
<channel-type id="activeDevices">
<item-type>String</item-type>
<label>Active Devices</label>
<description>List of active devices.</description>
</channel-type>
<channel-type id="activeDeviceType" advanced="true">
<item-type>String</item-type>
<label>Active Device Type</label>
<description>Currently active device type, such as "Computer", "Smartphone" or "Speaker".</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="activeDeviceShuffle">
<item-type>Switch</item-type>
<label>Active Device Shuffle</label>
<description>If shuffle is on or off on the active device</description>
</channel-type>
<channel-type id="playlists">
<item-type>String</item-type>
<label>Playlists</label>
<description>List of the users playlists</description>
</channel-type>
<channel-type id="playlistName">
<item-type>String</item-type>
<label>Playlist Name</label>
<description>Name of the active playlist</description>
</channel-type>
<channel-type id="trackPlay" advanced="true">
<item-type>String</item-type>
<label>Track to Play</label>
<description>Assign track, album, or playlist to play. Accepts Spotify Uri's and links.</description>
</channel-type>
<channel-type id="trackRepeat">
<item-type>String</item-type>
<label>Repeat Mode</label>
<description>'track' will repeat the current track. 'context' will repeat the current context. 'off' will turn repeat
off.</description>
<state>
<options>
<option value="track">Track</option>
<option value="context">Context</option>
<option value="off">Off</option>
</options>
</state>
</channel-type>
<channel-type id="currentlyPlayedTrackId" advanced="true">
<item-type>String</item-type>
<label>Track Id</label>
<description>Channel reports track id currently being played.</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedTrackHref" advanced="true">
<item-type>String</item-type>
<label>Track URL</label>
<description></description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedTrackUri" advanced="true">
<item-type>String</item-type>
<label>Track URI</label>
<description>The Spotify URI for the track currently played</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedTrackType" advanced="true">
<item-type>String</item-type>
<label>Track Type</label>
<description>The type of the track currently played track type</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedTrackDurationMs" advanced="true">
<item-type>Number</item-type>
<label>Track Duration (ms)</label>
<description>The duration of the currently played track (ms)</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedTrackProgressMs" advanced="true">
<item-type>Number</item-type>
<label>Track Progress (ms)</label>
<description>The progress of the currently played track (ms)</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedTrackDuration">
<item-type>String</item-type>
<label>Track Duration (m:ss)</label>
<description>The duration currently played track formatted (m:ss)</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedTrackProgress">
<item-type>String</item-type>
<label>Track Progress (m:ss)</label>
<description>The progress of the currently played track formatted (m:ss)</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedTrackNumber" advanced="true">
<item-type>Number</item-type>
<label>Track Number</label>
<description>The track number of currently played track</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedTrackDiscNumber" advanced="true">
<item-type>Number</item-type>
<label>Track Disc Number</label>
<description>The disk number of currently played track</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedTrackPopularity" advanced="true">
<item-type>Number</item-type>
<label>Track Popularity</label>
<description>The popularity of the currently played track</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedTrackExplicit" advanced="true">
<item-type>Switch</item-type>
<label>Track Explicit</label>
<description>Whether or not the track has explicit lyrics (On it does; Off it does not OR unknown)</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedAlbumId" advanced="true">
<item-type>String</item-type>
<label>Album Id</label>
<description>The Spotify ID of the album</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedAlbumHref" advanced="true">
<item-type>String</item-type>
<label>Album URL</label>
<description>A link to the Web API endpoint providing full details of the album</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedAlbumUri" advanced="true">
<item-type>String</item-type>
<label>Album URI</label>
<description>The Spotify URI for the album</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedAlbumName">
<item-type>String</item-type>
<label>Album Name</label>
<description>The name of the album</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedAlbumType" advanced="true">
<item-type>String</item-type>
<label>Album Type</label>
<description>The object type: "album"</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedAlbumImage">
<item-type>Image</item-type>
<label>Album Image</label>
<description>The cover art for the album in widest size</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedArtistId" advanced="true">
<item-type>String</item-type>
<label>Artist Id</label>
<description>The Spotify ID for the artist</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedArtistHref" advanced="true">
<item-type>String</item-type>
<label>Artist URL</label>
<description>Channel reports currently played artist href</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedArtistUri" advanced="true">
<item-type>String</item-type>
<label>Artist URI</label>
<description>A link to the Web API endpoint providing full details of the artist</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="currentlyPlayedArtistType" advanced="true">
<item-type>String</item-type>
<label>Artist Type</label>
<description>The object type: "artist"</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="deviceId" advanced="true">
<item-type>String</item-type>
<label>Device Id</label>
<description>The Spotify ID of the device</description>
</channel-type>
<channel-type id="deviceName">
<item-type>String</item-type>
<label>Device Name</label>
<description>The name of the device</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="deviceType" advanced="true">
<item-type>String</item-type>
<label>Device Type</label>
<description>Device type, such as "Computer", "Smartphone" or "Speaker".</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="deviceShuffle">
<item-type>Switch</item-type>
<label>Device Shuffle</label>
<description>If shuffle is on or off</description>
</channel-type>
<channel-type id="deviceActive" advanced="true">
<item-type>Switch</item-type>
<label>Device Active</label>
<description>If this device is the currently active device</description>
</channel-type>
<channel-type id="deviceRestricted" advanced="true">
<item-type>Switch</item-type>
<label>Device Restricted</label>
<description>Whether controlling this device is restricted. At present if this is "true" then no Web API commands will
be accepted by this device</description>
</channel-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
${pageRefresh}
<title>Authorize openHAB binding for Spotify</title>
<link rel="icon" href="img/favicon.ico" type="image/vnd.microsoft.icon">
<link>
<style>
html {
font-family: "Roboto", Helvetica, Arial, sans-serif;
}
.logo {
display: block;
margin: auto;
width: 100%;
}
.block {
border: 1px solid #bbb;
background-color: white;
margin: 10px 0;
padding: 8px 10px;
}
.error {
background: #FFC0C0;
border: 1px solid darkred;
color: darkred
}
.authorized {
border: 1px solid #90EE90;
background-color: #E0FFE0;
}
.button {
margin-bottom: 10px;
}
.button a {
background: #1ED760;
border-radius: 500px;
color: white;
padding: 10px 20px 10px;
font-size: 16px;
font-weight: 700;
border-width: 0;
text-decoration: none;
}
</style>
</head>
<body>
<svg class="logo" xmlns="http://www.w3.org/2000/svg" height="60px" version="1.1" viewBox="0 0 530 180">
<path style="stroke-width:0.625;stroke-linejoin:round;stroke:#000000;stroke-opacity:1;fill:#000000;fill-opacity:1;" d="m 195,90 l 15,10 c 0,0 -5,-5 0,-20 z m 10,3 l 120,0 l 0,-6 l -120,0 z m 130,-3 l -15,-10 c 0,0 5,5 0,20 z" />
<path style="fill:#1ed760;stroke-width:1.07472312"
d="M 439.99946,0 C 390.29519,0 350,40.295076 350,90.000539 350,139.70815 390.29519,180 439.99946,180 489.70911,180 530,139.70815 530,90.000539 530,40.2983 489.70911,0.004299 439.99839,0.004299 Z m 41.27318,129.80661 c -1.61207,2.64385 -5.07264,3.48214 -7.71642,1.85929 -21.13096,-12.90758 -47.73219,-15.83086 -79.05999,-8.67312 -3.01886,0.68783 -6.02805,-1.2037 -6.71586,-4.22371 -0.69104,-3.02001 1.19292,-6.02927 4.21931,-6.7171 34.28326,-7.83267 63.69055,-4.46015 87.41371,10.03803 2.64378,1.62285 3.48206,5.07276 1.85925,7.71661 z m 11.01578,-24.50613 c -2.03121,3.30159 -6.35154,4.34408 -9.6509,2.31283 -24.19173,-14.870044 -61.06826,-19.176511 -89.68242,-10.490495 -3.71098,1.120949 -7.63045,-0.970487 -8.75674,-4.675102 -1.1177,-3.711063 0.97476,-7.623102 4.67928,-8.751575 32.68517,-9.917663 73.31889,-5.113594 101.10015,11.958587 3.29936,2.031251 4.34183,6.351685 2.31063,9.646825 z m 0.94574,-25.51853 C 464.22773,62.552857 416.37088,60.968697 388.67667,69.374207 384.22952,70.723 379.52659,68.212417 378.1789,63.76516 c -1.34768,-4.449407 1.16069,-9.149228 5.61107,-10.501246 31.791,-9.651129 84.63988,-7.786462 118.03543,12.039193 4.00866,2.374092 5.31981,7.540347 2.9447,11.535141 -2.36436,4.000167 -7.54446,5.318868 -11.53164,2.943702 z" />
<g transform="matrix(1.0671711,0,0,1.0802403,-242.07004,-3.638968)">
<path d="m 235.55996,122.32139 65.99684,-65.245439 9.61127,-9.494429 9.61126,9.494429 48.71786,48.127399 -0.0713,0.24287 -0.96104,2.79606 -1.09061,2.7291 -1.22617,2.66469 -1.34976,2.59982 -1.22704,2.10395 -52.40328,-51.76861 c -22.86589,22.605906 -45.73092,45.21138 -68.59595,67.81602 -2.64028,-3.84168 -5.09265,-7.79865 -7.01216,-12.06586 z" style="clip-rule:evenodd;fill:#e64a19;fill-rule:evenodd;stroke-width:0.87332809" />
<path d="m 311.16893,3.3686968 c 46.45255,0 84.33469,37.4250352 84.33469,83.3154142 0,45.887409 -37.88214,83.314139 -84.33469,83.314139 -25.37318,0 -48.18501,-11.17665 -63.66633,-28.79057 l 2.98008,-2.95501 2.16319,-2.13785 2.16749,-2.14377 2.16835,-2.14209 0.0884,-0.0865 c 13.00665,15.21415 32.43854,24.9082 54.09884,24.9082 39.00964,0 70.82522,-31.42855 70.82522,-69.966579 0,-38.540154 -31.81558,-69.969554 -70.82522,-69.969554 -39.01137,0 -70.82694,31.4294 -70.82694,69.969554 0,5.189918 0.58434,10.24717 1.67968,15.121749 l -4.69923,4.65206 -6.27207,6.2012 c -2.73168,-8.18222 -4.217,-16.909931 -4.217,-25.97501 0,-45.89038 37.88214,-83.3154145 84.33556,-83.3154145 z" style="clip-rule:evenodd;fill:#474747;fill-rule:evenodd;stroke-width:0.87332809" />
</g>
</svg>
<h3>Authorize openHAB binding for Spotify</h3>
<p>On this page you can authorize your openHAB Spotify Player Bridge configured with the clientId and clientSecret of the Spotify Application on your Developer account, you have to login to your Spotify Account and authorize this binding to access your account.</p>
<p>To use this binding the following requirements apply:</p>
<ul>
<li>A Spotify Premium account.
<li>Register openHAB as an App on your Spotify Developer Dashboard.
</ul>
<p>
The redirect URI to use with Spotify for this openHAB installation is
<a href="${redirectUri}">${redirectUri}</a>
</p>
${error} ${authorizedUser} ${players}
</body>
</html>

View File

@@ -0,0 +1,4 @@
<div class="block${player.authorized}" id="${player.id}">
Connect to Spotify: <i>${player.name}${player.user}</i>
<p><div class="button"><a href=${player.authorize}>Authorize Player</a></div></p>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB