Skip to content

Commit

Permalink
Merge pull request #152 from iobroker-community-adapters/151-add-appi…
Browse files Browse the repository at this point in the history
…d-to-status

#151 Add appId to status
  • Loading branch information
raintonr committed Jan 12, 2023
2 parents 4330bf9 + 7c7b952 commit 7794df2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Build on top of the following projects:

### **WORK IN PROGRESS**
* (raintonr) Allow YouTube videos ([#75](https://github.com/iobroker-community-adapters/ioBroker.chromecast/issues/75))
* (raintonr) Add appId to status ([#151](https://github.com/iobroker-community-adapters/ioBroker.chromecast/issues/151))

### 3.1.0 (2022-11-12)
* (bluefox) Refactoring done
Expand Down
14 changes: 14 additions & 0 deletions lib/chromecastDevice.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,15 @@ module.exports = async function (adapter, webPort) {
role: 'info.standby',
desc: '(HDMI only) TV is standby'
},
'status.appId': {
name: `${channels.status.name} appId`,
def: '',
type: 'string',
read: true,
write: false,
role: 'info',
desc: 'Chromecast player application ID'
},
'status.displayName': {
name: `${channels.status.name} displayName`,
def: '',
Expand Down Expand Up @@ -637,6 +646,11 @@ module.exports = async function (adapter, webPort) {
if (status.hasOwnProperty('applications')) {
let currentApplicationObject = status.applications[0];
if (currentApplicationObject !== undefined) {
adapter.log.info(JSON.stringify(currentApplicationObject));
await adapter.setStateAsync(`${this.id}.status.appId`, {
val: ('appId' in currentApplicationObject ? currentApplicationObject.appId : ''),
ack: true
});
await adapter.setStateAsync(`${this.id}.status.displayName`, {
val: ('displayName' in currentApplicationObject ? currentApplicationObject.displayName : ''),
ack: true
Expand Down

0 comments on commit 7794df2

Please sign in to comment.