Switch item=BraviaInput label="Input"icon="receiver" mappings=[HDMI2="HDMI2" , HDMI4="HDMI4"]
and on basicui/app i can switch with no problem from input sources.
what do i have to do or add on my items file “which is a string type” so that Alexa can send command through openhab ??
My approach for voice control is generally a different approach than for example a site map, and I would suggest the same in this case.
I would create an item labeled HDMI2 and an item labeled HDMI4, expose those to Alexa and with rules make it such that whenever those items receive an ON command, the right value is sent to the BeaviaInput item.
@yortiz1979
Whatever you do - Remember to use code fences when posting codes in a thread.
It makes it alot easier to read and easy to copy for others to use.
Ok I’m sharing here my solution so im sure it will be of a lot of help for some other user and will save them some gray hair
this is an example of my items file:
the first one is the real item which is the string and the second is a dummy item which i create as a dimmer and tagged as Switchable so that can appear in Alexa. since its a dimmer you can creat rule now on any value from 0=ON 1-99 100=OFF and then created a rules as follow:
// Input for "Alexa HDMI"
rule "BraviaInputAlexa"
when
Item BraviaInputAlexa received command
then
switch (receivedCommand)
{
case 1: BraviaInput.sendCommand("HDMI2")
case 4: BraviaInput.sendCommand("HDMI4")
}
end
Using the reply box in the forum, its easy… Look at this screendump… Notice the red square I have inserted, (unfortunatly there is no icons, but place your mouse on it and you´ll see).