Hi,
I have xiaomi android tv. I set up my tv via android tv integration and chromecast integration. Tv has a build chromecast. I have alexa echo dot set up via hacs integration - alexa media player. Alexa is connected to tv with bluetooth. I enabled on tv developer options and enabled wake on wan and wake on lan.
The problem I’m facing is random turning on tv, I believe that home assistant is checking for device and sending magic cookie to it… What I’m tried to achieve is that home assistant doesnt check for tv outside scan interval and that it doesnt send magic cookie to tv and turn it on.
I have in my configuration.yaml
# wake on lan
switch:
- platform: wake_on_lan
mac: XXXXXXXXXXX
name: Android TV
host: XXXXXXXXXXX
broadcast_address: 192.168.31.255
androidtv:
- platform: androidtv
entity: media_player.android_tv_XXXXXXXX
scan_interval: 86400
I’m probably doing something wrong or my config is wrong. Can someone help me out?
I found somewhere in documentation that you can set scan interval to define how often hassio should check for device. That is why I have it. It’s not alexa related. Alexa is connected to tv over bluetooth. Tv is turned on when home assistant checks for TV. I get error in logs on android tv, cant post error now, and after that tv is turned on, probably by alexa.
This is the error I get before alexa turns on tv
Failed to execute an ADB command. ADB connection re-establishing attempt in the next update. Error: Reading from 192.168.XXX:5555 timed out (9.0 seconds)
[Bedroom TV(192.168.XXX):8009] Failed to connect to service ServiceInfo(type='mdns', data='MiTV-MSSP2-b6f64baef9fdb817d359c221419bcfae._googlecast._tcp.local.'), retrying in 5.0s
[Bedroom TV(192.168.XXX):8009] Failed to connect to service ServiceInfo(type='host', data=('192.168.XX', 8009)), retrying in 5.0s
Ok, when I wrote my post I didnt got error. When error came up I edited my post. Maybe I wasnt clear.
I have android tv with build in chormecast. I use android tv and chromecast integration in my home assistant. I aslo have alexa dot 4. I paired my alexa to tv over bluetooth. I can turn tv on/off, volume up/down over alexa.
The problem is that home assistant over alexa is turning tv on because android tv integration is trying to reconnect to tv when tv is off… This is my latest errors
Failed to execute an ADB command. ADB connection re-establishing attempt in the next update. Error: Reading from 192.168.XX:5555 timed out (9.0 seconds)
[Bedroom TV(192.168.XX):8009] Failed to connect to service ServiceInfo(type='host', data=('192.168.XX', 8009)), retrying in 5.0s
[Bedroom TV(192.168.XX):8009] Failed to connect to service ServiceInfo(type='mdns', data='MiTV-MSSP2-b6f64baef9fdb817d359c221419bcfae._googlecast._tcp.local.'), retrying in 5.0s
When I get adb error alexa is turning tv on. Only alexa can do that as it is connected to tv over bluetooth.
My question is how to stop or change scan interval on andoid tv integration.
Beside if you want help with “connection” problems/errors" it’s not particular smart to hide “Private” ip numbers … everybody has them, they are in certain “range” and is called “Private” because they only work internally “behind” peoples Router/Firewall … there’s absolutely nothing “Private” about them
I have 2 xiaomi android TVs connected via android TV component and I have exactly the same problem.
They just randomly turn on. I switch them off and half hour later or whenever I check they’re back on.
I would agree its probably related to how they work with this integration. Regardless I have not been able to resolve the issue.
I ended up connecting them to a WiFi plug because I didn’t want them turning on in the middle of the night in my kids rooms.
This didn’t happen when I had them connected via lan.
Well maybe I’m on to something. I tested various configurations and nothing seems to work. I have two sparing powerline adapters. I use one set for paring my local router to gateway router. I paired this set of powerline adapters together. If you have more than two powerline adapters they will by default connect to master one, the one that is connected to router with internet access. But you can pair them to connect to each other.
I plugged one powerline adapter to my local router and another to tv. I disabled wifi on tv and in developer mode I enabled wake on lan.
For a two or so hours there is no random powering of tv. I also remove all setting from my configuration yaml file from the first post.
As I can see I have two devices, one is bedroom tv - casting device, and another is android tv - tv box.
I can turn on/off tv over alexa but my casting device is still on. And that is what I want.
I have an automation that notify me over alexa that someone came home and turn on tv to show me picture of a person coming home.
For now this is working. But some longer testing is needed.
Yes this works.
I had them connected via ethernet before and I didn’t have the random turn on.
In the new house they’re in a location without convenient ethernet access
Well there is very little code.
I gave my tv a static ip on router. Maybe this is not needed but just to be on a safe side.
I added my tv on ha with android tv integration.
On tv I enabled wake on lan entering developer mode.
I connected tv with powerline adapter to my router. One adapter on tv side one on router side.
I ping tv with binary sensor file so that it doesn’t go in deep sleep.
I posted the code.
And that is it. The only code I use is for binary sensor file. Nothing in configuration yaml etc.
You don’t need powerline adapters if you can connect your tv to router with lan cable. I use it simply because they are in different rooms.
You need to ping tv. This is important. Without a ping it will go into deep sleep and you want be able to turn it on.
If everything is working you will see on tv that your red led is blinking every sec or two.
Well it’s not the same tv. If you enabled developer options on your tv and there is no option wake on lan you have old software or its hardware just doesn’t support that. My xiaomi have chromecast built in.
You can try with adb but this is something that never worked for me.
Or just try to trade it for a newer version.