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?
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…
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)
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