Squeezebox IR

Hi all,

I try to get the last IR code from my Squeezeboxes using OH 2.1 & the respective binding:

String ItemRadioIRCodeKueche "IR Code (Küche) [%s]" <remote> (GroupRadioIRCode) {
  channel="squeezebox:squeezeboxplayer:D841762A-D007-4609-988D-EC0A58A82A56:DEADBEEEF:ircode"
}

Other squeezebox channels work ok; anybody managed to get this working?
with kind regards,
Patrik

I’ve never used this, but I took a quick look at the code. I’m not quite sure why irCodeChangeEvent calls postCommand when every other change event calls updateChannel.

@digitaldan By any chance, do you remember why irCodeChangeEvent is handled differently than the other change events?

Strange, I have no idea why its like that, but it does not look right. Also irCodeChangeEvent is a good candidate for a trigger channel since I don’t think is makes sense to store state here or tie it to a item. I think the idea is that you trigger a rule when a new ir code event comes in. . So we would change the thing channel definition to

<channel-type id="ircode" advanced="true">
  <kind>trigger</kind>
  <label>IR Code</label>
  <description>Trigger channel for the last IR code sent (string)</description>
  <event></event>
</channel-type>

The code would change to:

 if (isMe(mac)) {
  triggerChannel(CHANNEL_IRCODE, ircode);
}

and then rules would look like

rule "IR Code"
    when
        Channel "squeezebox:squeezeboxplayer:D841762A-D007-4609-988D-EC0A58A82A56:DEADBEEEF:ircode" triggered
    then
        logInfo("TEST","IR Code Received " + receivedEvent.event);
end

wdyt?

I hadn’t thought about setting it up as a trigger event, but that makes really good sense.

@patrik_gfeller Does that make sense for the use case you were trying to accomplish?

Thank you for your reply - do I understand correctly; the example given does not work yet with the current 2.1.0 binding (@ least it did not work for me).

I could use this to update the item … but using the known pattern of just having an item bound to the channel would be prefered - but that would work as well:

val fileName = "IR.rules"

rule "IR Code Küche"
  when
    Channel "squeezebox:squeezeboxplayer:D841762A-D007-4609-988D-EC0A58A82A56:DEADBEEF:ircode" triggered
  then
    logInfo(fileName,"IR: " + receivedEvent.event)
    ItemRadioIRCodeKueche.postUpdate(receivedEvent.event)   
  end

with kind regards,
Patrik

Correct. The functionality described above doesn’t exist yet.

Shall I create an Issue for this? If so, can you please point me to the correct location?

thanks & kind regards,
Patrik