Hello OH community. I am new at this, and I am trying to create some scripts that will control my TV. I’ve already installed the Samsung bindings, but unfortunately, my TV isn’t supported for the source switching. I can control power, volume and mute though. With that said, I have a linux server dedicated to my OpenHAB install and I’ve installed samsungctl (a linux tool that does support my TV).
After some research, I found that I can execute command line scripts from OH. Well, to my surprise, I can’t get it working within my OH scripts. Can someone please point me in the right direction on getting these rules to work properly. Thanks.
home.items:
Number tv_control "TV Control"
String tv_command "TV Command" { command="/usr/bin/samsungctl --host 192.168.1.110 --id banshee %2$s" }
home.rules:
rule "TV Source"
when
Item tv_control received command
then
switch(receivedCommand) {
case 1 : tv_command.sendCommand("tv")
case 2 : tv_command.sendCommand("hdmi1")
case 3 : tv_command.sendCommand("hdmi2")
case 4 : tv_command.sendCommand("hdmi3")
case 5 : tv_command.sendCommand("hdmi4")
}
end
home.sitemap:
Frame label="TV" {
...
Selection item=tv_control icon="receiver" label="TV Control" mappings=[1="TV", 2="Roku", 3="PS4", 4="Steam", 5="Nintendo"]
}
My intention was to create number place-holder so that I could see what input my TV was on, then change it with a selection but use a rule to pass the argument in so that I could keep track of the source.
Maybe I am way off, but I really felt like I was on to something. Thanks again for the help.
Will