Several onkyo binding commands on a switch

Making my first steps in openhab programming - and would like to make a swtich to listen to internet radio.
Can this be made in items or i need scripting? What is the best way to do this?

So pressing a switch should issue

Switch onkyo_listen_radio {onkyo="ON:hometheater:POWER_ON

and than commands
SOURCE_NETWORK
SET_VOLUME=50
LISTEN_MODE_STEREO
NETUSB_OP_PLAY
onkyoNETService
and than play…

HI

You need the Items to control the receiver, so you have to create them for your topics like source, volume, etc. But as you can’t connect them directly you need rules.
So create the items first then a rule that is triggered by your onkyo_listen_radio switch and let the rule do the rest…

Regards
Dieter

Thanks got it. Started to write a rule and got stuck.
There is an item
//Source
Number onkyoSource “Source” {onkyo=“INIT:hometheater:SOURCE_QUERY, INCREASE:hometheater:SOURCE_UP, DECREASE:hometheater:SOURCE_DOWN, *:hometheater:SOURCE_SET”}

So for wxample to get the source to item 7…
Tried this rule with no luck

rule “Onkyo Listen radio”
when
Item onkyo_listen_radio changed to ON
then
sendCommand(onkyoPower, ON)
sendCommand(onkyoSource, 7)
sendCommand(Switch onkyoNETPlay, ON)

end
rule “Onkyo Listen radio”
when
Item onkyo_listen_radio changed to OFF
then
sendCommand(onkyoPower, OFF)

end

You seems to have a extra Switch word on sendCommand.

sendCommand(Switch onkyoNETPlay, ON)

You should use openHAB designer to edit rule files as it notifies you about the syntax errors.

-Pali

Thanks for that.
Seems that after powering on a pause was needed.
So Thread::sleep(1000) helped out! Really starting to love the flexibility of openhab