Skip to content

Commit

Permalink
Initial 3.4.0 skyq binding
Browse files Browse the repository at this point in the history
  • Loading branch information
andan67 committed Nov 6, 2022
1 parent 2d3492b commit 0602acd
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 63 deletions.
119 changes: 69 additions & 50 deletions bundles/org.openhab.binding.skyq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,63 +25,82 @@ Use the UI to add the receiver as a thing and provide the following configuratio

## Channels

| Channel | Type | Description |
|----------|--------|----------------------------|
| control#controlCommand | String | Sends a remote control command to the device (see below) |
| control#channelPreset | String | Holds list of all channels from receiver and allows switch to a selected channel. The list and order of the channels can be configured through a file (see below).
| control#channelFavorites | String | Holds list of favorite channels from receiver and allows switch to a selected channel.
| control#power | Switch | Switches the receiver ON or OFF. Your receiver has in network standby for this to work. |
| statusChannels#currentChannelTitle | String | Shows current live TV channel title if available |
| statusChannels#powerStatus | String | Shows power state ON, OFF, or STANDBY |
| statusChannels#currentTransportState | String | State of current transport stream (PLAYING etc) |
| Channel | Type | Description |
|----------|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| control#controlCommand | String | Sends remote control commands to the device (see below) |
| control#channelPreset | String | Holds list of all channels from receiver and allows switch to a selected channel. The list and order of the channels can be configured through a file (see below).
| control#channelFavorites | String | Holds list of favorite channels from receiver and allows switch to a selected channel.
| control#power | Switch | Switches the receiver ON or OFF. Your receiver has in network standby for this to work. |
| statusChannels#currentChannelTitle | String | Shows current live TV channel title if available |
| statusChannels#powerStatus | String | Shows power state ON, OFF, or STANDBY |
| statusChannels#currentTransportState | String | State of current transport stream (PLAYING etc) |

## Control commands

The `control#controlCommand` channel supports the following commands that are defined as state options:

| Value | Label | Description |
|----------|--------|------------------------------|
| power | Power ||
| select | Select ||
| backup | Back/Up ||
| dismiss | Dismiss ||
| channelup | Channel up ||
| Value | Label | Description |
|-------------|--------|------------------------------|
| power | Power ||
| select | Select ||
| backup | Back/Up ||
| dismiss | Dismiss ||
| channelup | Channel up ||
| channeldown |Channel down ||
| interactive | Interactive ||
| sidebar | Sidebar ||
| help | Help ||
| services | Services ||
| search | Search ||
| tvguide | TV guide ||
| home | Home ||
| i | i ||
| text |Text ||
| up | Up ||
| down | Down ||
| left | Left ||
| right | Right ||
| red | Red ||
| green | Green ||
| yellow | Yellow ||
| blue | Blue ||
| 0 | 0 ||
| 1 | 1 ||
| 2 | 2 ||
| 3 | 3 ||
| 4 | 4 ||
| 5 | 5 ||
| 6 | 6 ||
| 7 | 7 ||
| 8 | 8 ||
| 9 | 9 ||
| play | Play ||
| pause | Pause ||
| stop | Stop ||
| record | Record ||
| sidebar | Sidebar ||
| help | Help ||
| services | Services ||
| search | Search ||
| tvguide | TV guide ||
| home | Home ||
| i | i ||
| text |Text ||
| up | Up ||
| down | Down ||
| left | Left ||
| right | Right ||
| red | Red ||
| green | Green ||
| yellow | Yellow ||
| blue | Blue ||
| 0 | 0 ||
| 1 | 1 ||
| 2 | 2 ||
| 3 | 3 ||
| 4 | 4 ||
| 5 | 5 ||
| 6 | 6 ||
| 7 | 7 ||
| 8 | 8 ||
| 9 | 9 ||
| play | Play ||
| pause | Pause ||
| stop | Stop ||
| record | Record ||
| fastforward | Fast forward ||
| rewind | Rewind ||
| boxoffice | Box office ||
| sky | Sky ||
| rewind | Rewind ||
| boxoffice | Box office ||
| sky | Sky ||

### Defining macros
The `controlCommand` channel supports sending multiple commands to the device. This allows the definition of macros by the following procedure:

1. Define a `String` typed item linked to the `controlCommand` channel
2. Add `State Description` metadata to the item
3. A macro is defined by each option (line) within the `Options` section. The option value represents the
semicolon separated sequence of commands of the macro, and the label the macro name
4. A special command `sleep` is used to delay the sending of the commands by a fixed but short period. This might be required for certain sequences of commands
because sometime some commands are swallowed by the box.

#### Example

State options that define macros for opening the prime video app of for showing the top series page
```
interactive;down;down;down;select=prime video
home;sleep;down;down;down;sleep;right;right=Top Series
```
Note the `sleep` command here which is required to get reproducable results.

## Configurable channel presets

Expand Down Expand Up @@ -110,7 +129,7 @@ pseudo channel to the list.
skyq.things:

```
Thing skyq:skyqreceiver:skyq1 [ hostname="192.168.178.2", configurablePresets=true, retryInterval=60, checkStatusInterval=60, refreshInterval=30 ]
Thing skyq:skyqreceiver:skyq1 [ hostname="192.168.178.2", configurrblePresets=true, retryInterval=60, checkStatusInterval=60, refreshInterval=30 ]
```

skyq.items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void handleCommand(ChannelUID channelUID, Command command) {
break;
}
// refresh states from handling event for channel id
refreshState(id);
// refreshState(id);
}

@Override
Expand Down Expand Up @@ -474,9 +474,7 @@ private void refreshState(String handledChannel) {
private void refreshState(boolean initial, String handledChannel) {
// get current system information
if (restProtocol != null) {
if (handledChannel.isEmpty()) {
refreshPowerStatus(true);
}
refreshPowerStatus(true);
if (initial || sidToSkyChannelMap.isEmpty()) {
refreshSkyChannels();
}
Expand All @@ -493,15 +491,10 @@ private void refreshState(boolean initial, String handledChannel) {
SkyChannel skyChannel = sidToSkyChannelMap.get(currentSid);
updateState(new ChannelUID(thing.getUID(), CHANNEL_GROUP_STATUS, CHANNEL_CURRENT_CHANNEL_TITLE),
new StringType(skyChannel != null ? skyChannel.title : "UNDEF"));
if (handledChannel.equals(CHANNEL_FAVORITES)) {
updateState(new ChannelUID(thing.getUID(), CHANNEL_GROUP_CONTROL, CHANNEL_PRESET),
new StringType(skyChannel != null ? skyChannel.dispNum : "UNDEF"));
}
if (handledChannel.equals(CHANNEL_PRESET)) {
updateState(new ChannelUID(thing.getUID(), CHANNEL_GROUP_CONTROL, CHANNEL_FAVORITES),
new StringType(skyChannel != null ? skyChannel.dispNum : "UNDEF"));
}

updateState(new ChannelUID(thing.getUID(), CHANNEL_GROUP_CONTROL, CHANNEL_PRESET),
new StringType(skyChannel != null ? skyChannel.dispNum : "UNDEF"));
updateState(new ChannelUID(thing.getUID(), CHANNEL_GROUP_CONTROL, CHANNEL_FAVORITES),
new StringType(skyChannel != null ? skyChannel.dispNum : "UNDEF"));
}
}
@Nullable
Expand Down

0 comments on commit 0602acd

Please sign in to comment.