mirror of
https://github.com/danieldemus/openhab-addons
synced 2026-07-29 12:34:21 +02:00
[oppo] Add semantic tags and format time display channel (#18554)
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
This commit is contained in:
@@ -142,7 +142,7 @@ Number oppo_source "Source Input [%s]" { channel="oppo:player:myoppo:source" }
|
||||
String oppo_play_mode "Play Mode [%s]" { channel="oppo:player:myoppo:play_mode" }
|
||||
Player oppo_control "Control" { channel="oppo:player:myoppo:control" }
|
||||
String oppo_time_mode "Time Mode [%s]" { channel="oppo:player:myoppo:time_mode" }
|
||||
Number:Time oppo_time_display "Time [JS(secondsformat.js):%s]" { channel="oppo:player:myoppo:time_display" }
|
||||
Number:Time oppo_time_display "Time [%s]" { channel="oppo:player:myoppo:time_display" }
|
||||
Number oppo_current_title "Current Title/Track [%s]" { channel="oppo:player:myoppo:current_title" }
|
||||
Number oppo_total_title "Total Title/Track [%s]" { channel="oppo:player:myoppo:total_title" }
|
||||
Number oppo_current_chapter "Current Chapter [%s]" { channel="oppo:player:myoppo:current_chapter" }
|
||||
@@ -163,33 +163,6 @@ String oppo_hdr_mode "HDR Mode [%s]" { channel="oppo:player:myoppo:hdr_mode" }
|
||||
String oppo_remote_button "Remote Button [%s]" { channel="oppo:player:myoppo:remote_button" }
|
||||
```
|
||||
|
||||
### `secondsformat.js` Example
|
||||
|
||||
```javascript
|
||||
(function(timestamp) {
|
||||
var totalSeconds = Date.parse(timestamp) / 1000
|
||||
|
||||
if (isNaN(totalSeconds)) {
|
||||
return '-';
|
||||
} else {
|
||||
hours = Math.floor(totalSeconds / 3600);
|
||||
totalSeconds %= 3600;
|
||||
minutes = Math.floor(totalSeconds / 60);
|
||||
seconds = totalSeconds % 60;
|
||||
if ( hours < 10 ) {
|
||||
hours = '0' + hours;
|
||||
}
|
||||
if ( minutes < 10 ) {
|
||||
minutes = '0' + minutes;
|
||||
}
|
||||
if ( seconds < 10 ) {
|
||||
seconds = '0' + seconds;
|
||||
}
|
||||
return hours + ':' + minutes + ':' + seconds;
|
||||
}
|
||||
})(input)
|
||||
```
|
||||
|
||||
### `oppo.sitemap` Example
|
||||
|
||||
```perl
|
||||
|
||||
@@ -136,8 +136,8 @@ channel-type.oppo.sub_shift.label = Subtitle Shift
|
||||
channel-type.oppo.sub_shift.description = Set the Subtitle Shift -10 to 10
|
||||
channel-type.oppo.subtitle_type.label = Subtitle Type
|
||||
channel-type.oppo.subtitle_type.description = The Current Subtitle Selected
|
||||
channel-type.oppo.time_display.label = Time Display (S)
|
||||
channel-type.oppo.time_display.description = The Playback Time Elapsed/Remaining in Seconds
|
||||
channel-type.oppo.time_display.label = Time Display
|
||||
channel-type.oppo.time_display.description = The Playback Time Elapsed/Remaining
|
||||
channel-type.oppo.time_mode.label = Time Display Mode
|
||||
channel-type.oppo.time_mode.description = Sets the Time Information Display
|
||||
channel-type.oppo.time_mode.state.option.T = Title Elapsed Time
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<description>
|
||||
Controls an Oppo Blu-ray Player
|
||||
</description>
|
||||
<semantic-equipment-tag>MediaPlayer</semantic-equipment-tag>
|
||||
|
||||
<channels>
|
||||
<channel id="power" typeId="system.power"/>
|
||||
@@ -40,6 +41,10 @@
|
||||
<channel id="remote_button" typeId="remote_button"/>
|
||||
</channels>
|
||||
|
||||
<properties>
|
||||
<property name="thingTypeVersion">1</property>
|
||||
</properties>
|
||||
|
||||
<config-description>
|
||||
<parameter name="model" type="integer" required="true">
|
||||
<label>Player Model</label>
|
||||
@@ -90,6 +95,10 @@
|
||||
<item-type>String</item-type>
|
||||
<label>Play Mode</label>
|
||||
<description>The Current Playback Mode of the Source</description>
|
||||
<tags>
|
||||
<tag>Status</tag>
|
||||
<tag>Mode</tag>
|
||||
</tags>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
@@ -116,9 +125,13 @@
|
||||
|
||||
<channel-type id="time_display">
|
||||
<item-type>Number:Time</item-type>
|
||||
<label>Time Display (S)</label>
|
||||
<description>The Playback Time Elapsed/Remaining in Seconds</description>
|
||||
<state readOnly="true" pattern="%d %unit%"/>
|
||||
<label>Time Display</label>
|
||||
<description>The Playback Time Elapsed/Remaining</description>
|
||||
<tags>
|
||||
<tag>Status</tag>
|
||||
<tag>Duration</tag>
|
||||
</tags>
|
||||
<state readOnly="true" pattern="%1$tT"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="current_title">
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<update:update-descriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:update="https://openhab.org/schemas/update-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/update-description/v1.0.0 https://openhab.org/schemas/update-description-1.0.0.xsd">
|
||||
|
||||
<thing-type uid="oppo:player">
|
||||
<instruction-set targetVersion="1">
|
||||
<update-channel id="play_mode">
|
||||
<type>oppo:play_mode</type>
|
||||
</update-channel>
|
||||
<update-channel id="time_display">
|
||||
<type>oppo:time_display</type>
|
||||
</update-channel>
|
||||
</instruction-set>
|
||||
</thing-type>
|
||||
|
||||
</update:update-descriptions>
|
||||
Reference in New Issue
Block a user