dwaan / homebridge-adb

Homebridge script to control remote ADB enabled Android device
MIT License
76 stars 15 forks source link

Chomecast not able to sleep or wake-up from Home app times #90

Closed Faisalthe01 closed 1 year ago

Faisalthe01 commented 1 year ago

Describe the bug I am using Chromecast with Google TV (Android 12). If i turn off from Home app tile, it fails to turn off (shows in Homebridge logs) but if i turn off my TV (connected with HDMI-CEC) then the Google TV goes into sleep mode (shows in homebridge logs) similarly, if i turn on Google TV from Home app tile, it fails to wake up (shows in logs) but if i turn on my TV then it wakes up (shows in logs)

Expected behavior Sleep mode when i turn off from Home app, and wake up when i turn on from Home app

Log output

Device (please complete the following information): Chromecast with Google TV

Additional context Add any other context about the problem here.

D44E7F41-22B9-4496-A507-4B1A74C172B1 EEDD622C-2F22-4004-81C9-ECD9471AF948 76B16EE4-D06A-4143-AAB9-0B462EB9497B

My config


  {
            "accessories": [
                {
                    "name": "GoogleTV",
                    "ip": "192.168.0.216",
                    "mac": "ac:67:84:97:28:08",
                    "interval": 1000,
                    "path": "/usr/bin/adb",
                    "timeout": 1000,
                    "playbacksensor": false,
                    "category": "TV_STREAMING_STICK",
                    "hidenumber": true,
                    "hidehome": false,
                    "hideother": true,
                    "debug": false,
                    "skipSpeaker": false,
                    "inputs": [
                        {
                            "name": "HBO Max",
                            "id": "com.hbo.hbonow"
                        },
                        {
                            "name": "Netflix",
                            "id": "com.netflix.ninja"
                        },
                        {
                            "name": "YouTube",
                            "id": "com.google.android.youtube.tv"
                        },
                        {
                            "name": "TiviMate",
                            "id": "ar.tvplayer.tv"
                        },
                        {
                            "name": "Disney",
                            "id": "com.disney.disneyplus"
                        },
                        {
                            "name": "Prime Video",
                            "id": "com.amazon.amazonvideo.livingroom"
                        },
                        {
                            "name": "Magellan TV",
                            "id": "com.abide.magellantv"
                        },
                        {
                            "name": "Aerial Dream",
                            "id": "com.coding:buffalo.aerialdream"
                        },
                        {
                            "name": "Airplay",
                            "id": "com.softmedia.receiver"
                        },
                        {
                            "name": "Discovery+",
                            "id": "com.discovery.discoveryplus.androidtv"
                        },
                        {
                            "name": "Hulu",
                            "id": "com.hulu.livingroomplus"
                        },
                        {
                            "name": "Paramount+",
                            "id": "com.cbs.ott"
                        },
                        {
                            "name": "Peacock TV",
                            "id": "com.peacocktv.peacockandroid"
                        },
                        {
                            "name": "Plex",
                            "id": "com.plexapp.android"
                        },
                        {
                            "name": "SHOWTIME",
                            "id": "com.showtime.standalone"
                        },
                        {
                            "name": "YouTube Music",
                            "id": "com.google.android.youtube.tvmusic"
                        },
                        {
                            "name": "Private VPN",
                            "id": "com.pvpn.privatevpn"
                        },
                        {
                            "name": "Aerial Views",
                            "id": "com.codingbuffalo.aerialdream"
                        },
                        {
                            "name": "Play Store",
                            "id": "com.android.vending"
                        },
                        {
                            "name": "Settings",
                            "id": "com.android.tv.settings"
                        }
                    ],
                    "playpausebutton": "KEYCODE_MEDIA_PLAY_PAUSE",
                    "backbutton": "KEYCODE_BACK KEYCODE_BACK",
                    "infobutton": "KEYCODE_HOME KEYCODE_HOME"
                }
            ],
            "platform": "HomebridgeADB",
            "_bridge": {
                "username": "0E:BA:5A:13:91:B3",
                "port": 37140
            }
        }
dwaan commented 1 year ago

Have you tried using different keycode for power off?

In the accessory config you can add: "poweroff" : "KEYCODE_POWER" And then if it's doesn't work, try other key for example: "KEYCODE_SLEEP" or "KEYCODE_SOFT_SLEEP".

Different android device sometimes use different keycode, see other keycodes possibility in this documentation https://developer.android.com/reference/android/view/KeyEvent

Faisalthe01 commented 1 year ago

Have you tried using different keycode for power off?

In the accessory config you can add: "poweroff" : "KEYCODE_POWER" And then if it's doesn't work, try other key for example: "KEYCODE_SLEEP" or "KEYCODE_SOFT_SLEEP".

Different android device sometimes use different keycode, see other keycodes possibility in this documentation https://developer.android.com/reference/android/view/KeyEvent

Thanks that power off worked to put it in sleep mode from Home App tile.

how about the other one where it doesn't turn on from Home App tile and says Wake On Lan Failed? 196441166-24cb61f9-1f23-481d-a614-913465c9c434

Faisalthe01 commented 1 year ago

Have you tried using different keycode for power off? In the accessory config you can add: "poweroff" : "KEYCODE_POWER" And then if it's doesn't work, try other key for example: "KEYCODE_SLEEP" or "KEYCODE_SOFT_SLEEP". Different android device sometimes use different keycode, see other keycodes possibility in this documentation https://developer.android.com/reference/android/view/KeyEvent

Thanks that power off worked to put it in sleep mode from Home App tile.

how about the other one where it doesn't turn on from Home App tile and says Wake On Lan Failed? 196441166-24cb61f9-1f23-481d-a614-913465c9c434

@dwaan all good bro, I removed the "mac" from config and it is now waking up normally. and i had a chance to visit your website and see your web designs and just wanted to say I loved your designs, great work!