Change the State of a Device

Hi, I would like some help.
I need to change the state of a TV (on/off) when using an IR (IE Broadlink) There an Integration called Smart IR with which I can control my TV but it it’s not able to change the state of the TV from ON to OFF or OFF to ON because of the way it’s controlling the TV.
I was thinking is there’s any integration that I can use or change in the config with which I can set the value of the energy status of the determined TV. I did not found any topic with Smart Plug, and that’s the only Idea I currently have.

Some devices have explicit on and off IR codes. Your remote might even have separate buttons corresponding to that, but most just send a toggle code. There are some IR websites and databases you can search. If you can find it, you’d be able to send it with your Broadlink. But, the fundamental problem will remain: You won’t know if it’s on or off, unless you can monitor it with CEC over an HDMI connection, or just use a smart plug with an energy/power monitor. Personally, my TV gets its CEC commands from an Apple TV, which avoids these issues.

That’s the thing, I could use CEC commands but I’m not using an Apple TV directly with my Samsung TV, i’m connecting every source to a Yamaha Amplifier and then connecting it to the TV.
I need an integration to use a Smart Plug as a Status changer.

I don’t know about an integration. But if you have a smart plug with energy monitor function connected, you could make an automation that sets the TV state to ON if it draws more than 1W for example. And OFF when it draws less than 1W.

I’m confused, can you explain your setup in more detail. It’s not clear what is integrated with HA and how, and what you mean by “set the value of the energy status of the determined TV”.

I’m assuming you have setup up the amplifier with SmartIR, and have an automation to turn it on and/or change inputs. The amplifier should be able to control the TV being on/off through CEC. If you’ve got the amplifier’s CEC control turned off…

Is your TV integrated with HA? If so, can’t you just switch it on/off at the same time as your automation for the amplifier? If it’s not integrated, can’t you also add it to SmartIR and control it that way?

I’m not sure where the smart plug fits in and what you want to do with it. Is it connected to the amplifier, and when you see it consuming power you want to turn the TV on? Or are you wanting to calculate the energy use of your TV - if so, have a look at PowerCalc.