STOP tv from charging input when is already on the correct one

Basically I have script that run turn my tv charges input to hdmi

Problem I have is

If the is already on with the hdmi port select how do stop it from run again because it keep charging to hdmi 2

The Marketplace category is a place to publish rule templates and such, not a place to ask questions.

You will have to post a lot more information. What sort of script? This TV is connected to OH? How does OH know what input the TV is set to? Items, Things, rules, etc? What have you tried so far?

Please don’t post screen shots of code. It’s pretty much useless. When posting a rule click on the “Code” tab and paste the text using code fences.

code goes here

I asked a lot of questions in my reply. You’ve half answered one of them. It’s really no fun having to drag out of you with much effort all the information we need to even begin to help.

It’s difficult for us to help when there’s minimal information provided, because we have to make a lot of guesses about your system. So in general, you should lean toward providing any information you think might be relevant. That helps us understand what you’re looking at and what’s missing.

In this case, it’s important to know that you’re using the Samsung binding, as there are a variety of ways to connect openHAB to TVs. I can also see that you’re using the keycode channel, which means you’re just sending one-way commands to the TV.

If your TV informs openHAB of the current input in a channel, you can use that to determine if you should send the command. I’m guessing that this is not the case.

If your TV doesn’t inform openHAB, then there’s nothing you can really do about this, since there’s not enough information for openHAB to make a decision. However, the odds are that your TV has the ability to detect when an HDMI input receives a signal, in which case it can automatically switch to that input. Look in your TV’s settings for this option (it may only be available for some HDMIs and not others). Then you just have to have your PS5 connected to that port.

Again, please use code fences when posting logs or code.

Able to set it but is it able to see it?

Ultimately it’s pretty straight forward. In order to not changing the input if it’s already on the correct input, you need an Item that tells you what input the TV is already on. If you don’t have that, it cannot be done.

If you do have that, what Item is it (nothing listed above seems to be it)? What state does that Item carry?

I don’t know, maybe answer some of the questions that have already been asked?