Xiaomi TV integration using Android TV

HI,
I Connected my xiaomi tv (MITV-MSSP3 43in).
I used same method with my nvidia shield with no issue.
Problem is that i can turn TV off but when it is off it can not be connected and then turn on again.
What is the best way to connect to this tv and be able to turn on and off and also choose an input ?

I have MITV-MSSP2. I use android integration for it.
I solved that problem in tv developer mode. I enabled wake on lan to prevent tv from going into deep sleep. This is what is going on with your tv. When you turn it off you can’t turn it on again. To use wake on lan I connected tv with powerline adapter to router.
You can try wake on wan but in my case it worked very unstable, randomly turning tv on.

nice , i enabled both wake on lan and wake on wlan and my tv is connected using wifi…
for now it is working thank you …
I will keep an eye for randomly turning on my tv!!!
thank you

OK I can confirm same issue for me with the tv turning on by itself…
So I tried connecting my tv to the near by LAN splitter i have and then turning wifi off and the turn on LAN on.
Now i have the same issue as in the beginning when i can not turn on my TV when it is off

The only thing I have enabled in developer mode is wake on lan and usb debugging.
Wifi is off and tv is connected over lan. I think I gave it a static ip on router but not sure now.
Edit:
I knew I created post about it.
Here it is
https://community.home-assistant.io/t/android-tv-wol/407231/11

You have to add to binary_sensor.yaml

# android tv
- platform: ping
  host: 192.168.31.5
  name: Android TV
  count: 1
  scan_interval: 15

sorry i am new to HA, where can i find my binary_sensor.yaml ???
this is not in the configuration file ?

well in configuration.yaml if you don’t have it add a line

binary_sensor: !include binary_sensor.yaml

In the same directory create file binary_sensor.yaml and paste code there and restart ha.

getting a Configuration invalid! error

try to add a line below default_config:

didn’t help also

It can’t read file. I don’t know. Try this. Delete everything from binary_sensor file and check again.

That didnt help also :pleading_face:

I don’t know. I use binary sensor file to ping my tv so that is doesn’t go in to the deep sleep. I can post you my configuration.yaml but before you copy/paste it be shure to add # before your config lines if something goes wrong that you can revert it back to your configuration
Part of my configration.yaml file. This is begging of a file

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
mobile_app:
discovery:
websocket_api:
# Text to speech
tts:
  - platform: google_translate
    language: "en"
#
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor: !include sensors.yaml
binary_sensor: !include binary_sensor.yaml
template: !include templates.yaml 

I was finally able to config the binary sensor.yaml file .
but still not able to turn on tv.
question do i need to change the name: to the same name the android tv app named my tv like in the pic attached .

FYI, the xiaomi tv in the one with the IP 192.168.68.154

binary sensor

Hi.
I’m glad you make it.
I don’t use any of this config from your configuration.yaml file. No media player, no wake on lan config.
I just ping tv with binary file, I connected tv with lan cable to my router using powerline adapter and that was it.
Sometimes less is more.

So just include the binary sensor file and in that file add your code like in the second pic i added ?
Is the code in the binary sensor file i posted ok ?
The name: set up correctly ?

I think you can name it as you wish. The bottom line I found out with this tv is to prevent it from going into deep sleep. If it does you won’t be able to turn it on. When it doesn’t go to deep sleep chromecast is on so you can cast or turn it on when ever you like.
This is my experience with it. I think we have the same tv except your have bigger screen.
Edit:
I think that config on binary sensor file is oke, get rid off useless config from configuration.yaml file.
But make it sure that binary sensor file is working, that it’s pinging the tv and that tv is connected to a router with lan cable.
Edit 2
Maybe the easiest way to tell if tv went to deep sleep or it doesn’t is the red status light. On my tv red light is blinking all the time. If you shut down tv with remote led light will turn itself off and tv went to deep sleep.

for me if i turn it off and immediately turn it on it’s still doesn’t work. and the red light isn’t on also when i turn off.
maybe the issue is with the off command which is deep sleep ?
i configure everything you said and still it doesn’t work

I gave you everything I know. Ok maybe sometimes that’s not enough.
Im not pay for this. I’m on my vacation. Maybe someone with more knowledge and experience can help you.

I appriciate your help and support and sorry i had so many questions i am new to home assistant