Send string to item

I have the following rule defined. When motion is detected, the input value of the receiver should be set to “AUDIO3”. When testing the receiver is turned on, but the input is not changed. What’s wrong?

rule "BePod Receiver ON and select AUDIO3 input when motion"
when
        Item mot_BePod_MeetingRoom changed to ON
then
        yamahareceiver_yamahaAV_468a2766_power.sendCommand(ON)
        yamahareceiver_yamahaAV_468a2766_input.sendCommand("AUDIO3")
end

If changing the source from yamaha side (either htrough ir or even through the app), what does the events.log show (especially for the input item)?

Assuming the rule is getting the receiver to power up, maybe it needs some time to startup before the input can be changed?

This is the log
Rule ‘BePod Receiver ON and select AUDIO3 input when motion’: An error occurred during the script execution: The name ‘AUDIO3’ cannot be resolved to an item or type.

When I change it manually in PaperUI, I see the following in the event log
Item ‘yamahareceiver_yamahaAV_468a2766_input’ received command AUDIO3

Did you try it without the quotes?

yamahareceiver_yamahaAV_468a2766_input.sendCommand(AUDIO3)

instead of

yamahareceiver_yamahaAV_468a2766_input.sendCommand("AUDIO3")

Can I test it on the command line? Can I send such a command on the command line instead of defining it in a rule and simulating that rule?

I’ve followed the instructions as described in http://docs.openhab.org/administration/runtime.html and setting the input source to AUDIO3 works.

So I guess that Scott is right. The receiver didn’t have the time to power up. Can I set a “sleep” in the rules so that the changing of the input is only triggered after 20sec?

Thread::sleep(X), where X is the time in milliseconds to sleep.

Thread::sleep(20000)

Or first send input-switching and then power on.

Sounds strange? But as the receiver is only sleeping, input selection works even if the receiver is switched of.

At least it works for me :slight_smile: regardless if switching through infrared or through openHAB.

My receiver is a RX-V575

If Item yamahareceiver_yamahaAV_468a2766_input is String - may be you should use yamahareceiver_yamahaAV_468a2766_input.postUpdate("AUDIO3") instead of .sendCommand?

No, postUpdate does only set the openHAB Item state but does not send anything to the corresponding thing (i.e. hardware)

Hi @Udo_Hartmann, can you please point me to the manual where i can find info about String Items which can receive commands, i didn’t found it.

Every item type is able to receive and/or transmit commands (ok, contact items are read only, so no transmit).

The question is, which binding do you want to use?