Heos (Denon) support

Indeed, I forgot that you should re-add it. Otherwise it wil kind of keep the old definition, thanks a lot!

1 Like

Is there a way to use the PLAYLISTS - Item in a Sitemap without firing the command to actually start playing? I’d like to just select a playlist and ask the state in a rule.

Could you elaborate on that, I do not have a clear view of steps you would like to take? Could you maybe sketch them more step-by-step?

I also forgot that! I would be really happy if this would be somehow solved in OH3, so it knows when a Thing configuration changed during update/bundle update.

@PhilippRoessner

I think I understand what he tries to do. He want to fetch the available playlists in a rule.
Right now the easiest way I think is to execute the RAW CLI command for this and parse the returned JSON for yourself in your rule. Then you can do anything with the available playlists and it will not have any influence on the currently played medium.

@rkrisi @martinvw
I created a recurring alarm control (see full example)

This is now my modified sitemap

sitemap default label="HomeControl"
{
    Switch item=State_Presence_Rules label="Presence Rules" 
    Default item=Network_PhilippPixel_Lastseen label="Pixel zuletzt gesehen"
    Frame label="Wecker" {
        Selection item=ALARM1_PERSON1_D label="Tage" mappings=[0="  Aus  ", 1="  Mo - Fr  ", 2="  Sa - So  ", 3="  Alle Tage  "]
        Setpoint item=ALARM1_PERSON1_H label="Stunde" minValue=0 maxValue=23 step=1
        Setpoint item=ALARM1_PERSON1_M label="Minuten" minValue=0 maxValue=55 step=5
        Selection item=ALARM1_PLAYLIST label="Playlist"
    }
}

What I would like to do now is to select a playlist within that control. When the alarm (timer) fires, I just want to read the selected value from that item and send it to the playlist command. When I select the playlist right now it fires immediately the play command.

@rkrisi I am gonna have a look at that tomorrow, you know some similar example I could check?

I understand your use case noem however I would not know how to support it. So ideally we would either suppress/change the behavior using profiles or create a proxy item with the same options in the dropdown list. If you find someone who knows how to do it on Spotify that could work because we use the same way. I’ll try to read some more about using profiles maybe it could also help us to support the options which the HEOS app gives you when running a playlist (add, play next, replace, etc)

Maybe @rlkoshak has some briljant idea to solve or workaround this.

Unfortunenatly re-adding the things does not solve my problem.
I hope I made it in the correct way.
I do not use Paper UI, I use text files for the things and items.
So I have deleted the things file and the item file as well. (In PaperUI still showing HEOS things).
Restarted OpenHAB. Things were gone. Maintained the things and item files again.
==> things and items available again but the same error for the Favorites.

To be honest: I can absolutely live with maintaining the four favorites I have as comma separated file in HABPanel.

I would be really curious how it shows in the REST API when viewing the item?

grafik

That’s where you’ve gone wrong then.

Allow PaperUI to add the New Thing, so that you can see what the lovely new features are.

AKA

“How can you possibly create the correctly formatted Thing (text) file, if you don’t know what to add?”

For example

{
  "statusInfo": {
    "status": "ONLINE",
    "statusDetail": "NONE"
  },
  "editable": true,
  "label": "Lounge-AV-Amp HEOS",
  "bridgeUID": "heos:bridge:07c42678-e5e2-1ce8-0080-0005cde91312",
  "configuration": {
    "pid": "368816113"
  },
  "properties": {
    "IP Address": "192.168.1.50",
    "serialNumber": "AUYxxxxxxxxxx",
    "modelId": "Denon AVR-X4400H",
    "vendor": "Denon",
    "Connection": "wired",
    "pid": "368816113",
    "firmwareVersion": "1.562.281",
    "Name": "Lounge-AV-Amp"
  },
  "UID": "heos:player:368816113",
  "thingTypeUID": "heos:player",
  "channels": [
    {
      "linkedItems": [
        "HeosPlayerLoungeAVAmp_Control"
      ],
      "uid": "heos:player:368816113:Control",
      "id": "Control",
      "channelTypeUID": "system:media-control",
      "itemType": "Player",
      "kind": "STATE",
      "label": "Media Control",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [],
      "uid": "heos:player:368816113:Volume",
      "id": "Volume",
      "channelTypeUID": "system:volume",
      "itemType": "Dimmer",
      "kind": "STATE",
      "label": "Volume",
      "description": "Change the sound volume of a device",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [],
      "uid": "heos:player:368816113:Mute",
      "id": "Mute",
      "channelTypeUID": "system:mute",
      "itemType": "Switch",
      "kind": "STATE",
      "label": "Mute",
      "description": "Mute audio of the device",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [],
      "uid": "heos:player:368816113:Inputs",
      "id": "Inputs",
      "channelTypeUID": "heos:input",
      "itemType": "String",
      "kind": "STATE",
      "label": "External Inputs",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [
        "HeosPlayerLoungeAVAmp_Song"
      ],
      "uid": "heos:player:368816113:Title",
      "id": "Title",
      "channelTypeUID": "system:media-title",
      "itemType": "String",
      "kind": "STATE",
      "label": "Media Title",
      "description": "Title of a (played) media file",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [
        "LoungeAVAmpHEOS_MediaArtist"
      ],
      "uid": "heos:player:368816113:Artist",
      "id": "Artist",
      "channelTypeUID": "system:media-artist",
      "itemType": "String",
      "kind": "STATE",
      "label": "Media Artist",
      "description": "Artist of a (played) media file",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [
        "HeosPlayerLoungeAVAmp_Album"
      ],
      "uid": "heos:player:368816113:Album",
      "id": "Album",
      "channelTypeUID": "heos:album",
      "itemType": "String",
      "kind": "STATE",
      "label": "Album",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [
        "LoungeAVAmpHEOS_Cover"
      ],
      "uid": "heos:player:368816113:Cover",
      "id": "Cover",
      "channelTypeUID": "heos:cover",
      "itemType": "Image",
      "kind": "STATE",
      "label": "Cover",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [
        "LoungeAVAmpHEOS_TrackPosition"
      ],
      "uid": "heos:player:368816113:CurrentPosition",
      "id": "CurrentPosition",
      "channelTypeUID": "heos:currentPosition",
      "itemType": "Number:Time",
      "kind": "STATE",
      "label": "Track Position",
      "description": "The current track position",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [
        "LoungeAVAmpHEOS_TrackDuration"
      ],
      "uid": "heos:player:368816113:Duration",
      "id": "Duration",
      "channelTypeUID": "heos:duration",
      "itemType": "Number:Time",
      "kind": "STATE",
      "label": "Track Duration",
      "description": "The overall duration of the track",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [
        "LoungeAVAmpHEOS_Type"
      ],
      "uid": "heos:player:368816113:Type",
      "id": "Type",
      "channelTypeUID": "heos:type",
      "itemType": "String",
      "kind": "STATE",
      "label": "Type",
      "description": "The media currently played type (station, song, ...)",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [
        "HeosPlayerLoungeAVAmp_TheStationName"
      ],
      "uid": "heos:player:368816113:Station",
      "id": "Station",
      "channelTypeUID": "heos:station",
      "itemType": "String",
      "kind": "STATE",
      "label": "Station",
      "description": "The name of the station currently played",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [
        "LoungeAVAmpHEOS_PlayURL"
      ],
      "uid": "heos:player:368816113:PlayUrl",
      "id": "PlayUrl",
      "channelTypeUID": "heos:playUrl",
      "itemType": "String",
      "kind": "STATE",
      "label": "Play URL",
      "description": "Plays a media file from URL",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [],
      "uid": "heos:player:368816113:Shuffle",
      "id": "Shuffle",
      "channelTypeUID": "heos:shuffleMode",
      "itemType": "Switch",
      "kind": "STATE",
      "label": "Shuffle",
      "description": "Sets the shuffle mode",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [],
      "uid": "heos:player:368816113:RepeatMode",
      "id": "RepeatMode",
      "channelTypeUID": "heos:repeatMode",
      "itemType": "String",
      "kind": "STATE",
      "label": "Repeat Mode",
      "description": "Set the repeat mode",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [
        "LoungeAVAmpHEOS_Favorites"
      ],
      "uid": "heos:player:368816113:Favorites",
      "id": "Favorites",
      "channelTypeUID": "heos:favorites",
      "itemType": "String",
      "kind": "STATE",
      "label": "Favorites",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [
        "LoungeAVAmpHEOS_Playlists"
      ],
      "uid": "heos:player:368816113:Playlists",
      "id": "Playlists",
      "channelTypeUID": "heos:playlists",
      "itemType": "String",
      "kind": "STATE",
      "label": "Playlists",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [],
      "uid": "heos:player:368816113:Queue",
      "id": "Queue",
      "channelTypeUID": "heos:queue",
      "itemType": "String",
      "kind": "STATE",
      "label": "Queue",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [],
      "uid": "heos:player:368816113:ClearQueue",
      "id": "ClearQueue",
      "channelTypeUID": "heos:clearQueue",
      "itemType": "Switch",
      "kind": "STATE",
      "label": "Clear Queue",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    }
  ],
  "location": "Lounge"
}

It would be nice if we could use the _control item to start and stop the player with ON and OFF.
The readme said it should work this way:

Control	Player	Play (also ON) / Pause (also OFF) / Next / Previous

It works for me with Play and Pause, but not with ON and OFF.

I am in the process of switching from squeezebox to HEOS. I have KNX Wall-Switches and used them to
switch off all lights and the squeezeboxes when i left a room. I could do this without any rules just with the items. I understand that the HEOS Boxes are not really powered off, but it would be nice to have an OFF Command to Pause the box.

I haven’t read the full thread and likely do not have all the details to answer. But perhaps the following will shed some light on the situation.

When you perform any action on the sitemap it results in a command. So of course, when you select a playlist on the sitemap, it is going to become a command that goes out to start playing that playlist.

If I understand correctly, you want to select a playlist that will play later based on some event (alarm). So you need an Item on the sitemap that is not linked to the device which lets you select the playlist. Since this Item is not linked to a device, nothing will happen when you select a playlist from the sitemap.

Something you’ll have to figure out is how to populate that playlist with the selection. That’s not something I’ve ever tried. Next you will have a rule triggered on your alarm event. Finally, that rule will send the current state of the Alarm Playlist Item to the Item actually linked to the device as command.

2 Likes

thanks for your reply!

Me neither and I fear that that might troublesome, I thought along the way of a second item and trying things with auto-update and profiles but I think that neither of those will work. The main thing it should do is populate the item but not forward commands.

That should be rather straight forward I’ll try to look into the support for ON / OFF this week!

Oh I get it now…

I’ve got something similar going on with a ChromeCast audio device in our bathroom.

The logic being

When the shower flow gets hot, query the playlist / station choice Item and play the relevant stream.

I think I have about 10 options to choose from. (I have even got a schedule setup to avoid certain stations at certain times / days, but that’s a different subject.

So here’s how I’ve done it.

I have a orphan number item that stores my choice.

In HabPanel I have a selection widget with a comma separated list, linked to the Orphan number Item

something like

1=Radio 1,2=BBC Radio 2,3=Absolute radio

and so on

When the shower water flow gets hot, it triggers a rule, which I guess could be a switch case arrangement or a Node-RED flow. Whatever you are more comfortable with.

I’m a beginner in programming, so my pair of rules look something like this

rule "Radio choice"
when
Item ShowerTemp changed to ON
then
if (ShowerRadioChoice.state == 1) { 
ShowerFavorite.sendCommand("BBC Radio 1")
}
if (ShowerRadioChoice.state == 2) { 
ShowerFavorite.sendCommand("BBC Radio 2")
}

if (ShowerRadioChoice.state == 3) { 
ShowerFavorite.sendCommand("Absolute Radio")
}
else
{
ShowerFavorite.sendCommand("Planet Rock")
}

end

rule "Shower Radio OFF"
when
Item ShowerTemp changed to OFF
then
ShowerMusicPlayer.sendCommand("STOP") // it actually does something far cooler than just stop, but again, that's for a different thread
end

In the interest in learning:

In the original code, don’t forget about else if.

if (ShowerRadioChoice == 1) { 
    ShowerFavorite.sendCommand("BBC Radio 1")
}
else if (ShowerRadioChoice == 2) { 
    ShowerFavorite.sendCommand("BBC Radio 2")
}

As a switch statement:

rule "Shower Radio ON"
when
    Item ShowerTemp changed to ON
then
    // Indentation is important to help the person reading the code understand the what lines correspond with what context.

    // Let's put the command at the end so, if in the future you want to do other stuff before sending 
    // the command you only have to do it once. So first record a default:
    var choice = "Planet Rock"

    // A switch statement is often more concise in this sort of if/else statements
    switch(ShowerRadioChoice.state as Number) { // I assume ShowerRadioChoice is an Item?
        case 1: choice = "BBC Radio 1"
        case 2: choice = "BBC Radio 2"
        case 3: choice = "Absolute Radio"
    } 

    ShowerFavorite.sendCommand(choice)
end

As a lookup using a Map:

import java.util.Map

val Map<String, String> stations = newHashMap("1" -> "BBC Radio1",
                                              "2" -> "BBC Radio 2",
                                              "3" -> "Absolute Radio")
rule "Shower Radio ON"
when
    Item ShowerTemp changed to ON
then    
    var choice = stations.get(ShowerRadioChoice.state.toString())
    if(choice == null) choice = "Planet Rock"
    ShowerFavorite.sendCommand(choice)
end

As a lookup using a List:

import java.util.List

val List<String> stations = newArrayList("BBC Radio1", "BBC Radio 2", "Absolute Radio")

rule "Shower Radio ON"
when
    Item ShowerTemp changed to ON
then
    val index = ShowerRadioChoice.state as Number
    var choice = "Planet Rock"
    if(index > 0 && index < stations.size) choice = stations.get(index.intValue)
    ShowerFavorite.sendCommand(choice)
end
1 Like

I have no idea how you work such magic. :mage:

My favourite of those would be the map, the small part of my brain that is reserved for programming can see how that is structured.

Thank you once again for bringing your knowledge to the party.

@Anne11e I was too quick this is not allowed by the framework :frowning:

The code is there in the HEOS binding but the openHAB framework does not forward the ON/OFF.

It seems that if your knx things would be of the type system.rawrocker you could use a profile but most likely the knx binding has to changed for that :frowning:. I must admit that my profile knowledge is minimal but looking at this it could even make sense to add another profile but I’m not sure about it maybe @cweitkamp could tell us more about the profiles.

The profile which could help us is system:rawrocker-to-play-pause and can be seen in action in the README of the EnOcean binding.

The alternative would be to have some rules to do this.

FYI, and for completeness, in OH3 - so disregard this for now if you’re not using it - state & command options, when not provided by the link/binding, you’re able to configure them (or override if they are) with metadata on the item.

So if you have an item for the radio station and say its valid options are 1, 2, or 3:

You can specify these options in the stateDescription metadata namespace, using:

  • the UI
  • text files (for static options)
  • eventually, rules or other means (for dynamic options) - remember you can have an item defined using an .items file but have a metadata namespace for it in the JSONDB.

In the UI you would click on “State Description” under “Metadata” and provide the options in the text area:

The equivalent in an .items file would be:

String RadioStation "Radio Station" { stateDescription=" " [ options="1=BBC Radio 1,2=BBC Radio 2,3=Absolute Radio" ] }

The default widget for the item will now display the label of the corresponding option instead of the actual state. Moreover, if the item isn’t read only, the control becomes clickable and allows to select another option - sent as a command. Those are actually command options - but by default they are conveniently set to be the same as the state options. If they differ they’re configurable with the commandDescription namespace in the same manner.

3 Likes