home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.68k stars 29.95k forks source link

Philips TV unavailable #115429

Closed GethDeeo closed 4 months ago

GethDeeo commented 5 months ago

The problem

I've added my TV (Philips 65PUS8545 Android 11) to HA via philips_js integration (API 6). It quickly recognized the TV, then switched to "Unavailable" state. I've attached everything I could, it seems to me that HA is continuously getting some invalid JSON from the TV...

What version of Home Assistant Core has the issue?

core-2024.4.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Philips TV

Link to integration documentation on our website

https://www.home-assistant.io/integrations/philips_js

Diagnostics information

{
  "home_assistant": {
    "installation_type": "Unsupported Third Party Container",
    "version": "2024.4.2",
    "dev": false,
    "hassio": false,
    "virtualenv": false,
    "python_version": "3.12.2",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Budapest",
    "os_name": "Linux",
    "os_version": "5.15.0-102-generic",
    "run_as_root": false
  },
  "custom_components": {
    "hacs": {
      "version": "1.34.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    }
  },
  "integration_manifest": {
    "domain": "philips_js",
    "name": "Philips TV",
    "codeowners": [
      "@elupus"
    ],
    "config_flow": true,
    "documentation": "https://www.home-assistant.io/integrations/philips_js",
    "iot_class": "local_polling",
    "loggers": [
      "haphilipsjs"
    ],
    "requirements": [
      "ha-philipsjs==3.1.1"
    ],
    "is_built_in": true
  },
  "data": {
    "entry": {
      "entry_id": "bb8d5242d9647c6b8f6630041cef5852",
      "version": 1,
      "minor_version": 1,
      "domain": "philips_js",
      "title": "**REDACTED**",
      "data": {
        "host": "tv.g1bb0nz.home.arpa",
        "api_version": 6,
        "system": {
          "notifyChange": "http",
          "menulanguage": "English",
          "name": "tv",
          "country": "Hungary",
          "serialnumber": "**REDACTED**",
          "softwareversion": "TPM191E_R.201.000.248.217",
          "model": "65PUS8545/12",
          "deviceid": "**REDACTED**",
          "nettvversion": "9.0.0",
          "epgsource": "broadcast",
          "api_version": {
            "Major": 6,
            "Minor": 4,
            "Patch": 0
          },
          "featuring": {
            "jsonfeatures": {
              "editfavorites": [
                "TVChannels",
                "SatChannels"
              ],
              "recordings": [
                "List",
                "Schedule",
                "Manage"
              ],
              "ambilight": [
                "LoungeLight",
                "Hue",
                "Ambilight",
                "HueStreaming"
              ],
              "menuitems": [
                "Setup_Menu"
              ],
              "textentry": [
                "not_available"
              ],
              "applications": [
                "TV_Apps",
                "TV_Games",
                "TV_Settings"
              ],
              "pointer": [
                "not_available"
              ],
              "inputkey": [
                "key"
              ],
              "activities": [
                "intent"
              ],
              "channels": [
                "preset_string"
              ],
              "mappings": [
                "server_mapping"
              ]
            },
            "systemfeatures": {
              "tvtype": "consumer",
              "content": [
                "dmr",
                "pvr"
              ],
              "tvsearch": "intent",
              "pairing_type": "digest_auth_pairing",
              "secured_transport": "true",
              "companion_screen": "true"
            }
          },
          "os_type": "MSAF_2019_P"
        },
        "username": "**REDACTED**",
        "password": "**REDACTED**"
      },
      "options": {},
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "unique_id": "**REDACTED**",
      "disabled_by": null
    },
    "data": {
      "system": {
        "notifyChange": "http",
        "menulanguage": "English",
        "name": "tv",
        "country": "Hungary",
        "serialnumber": "**REDACTED**",
        "softwareversion": "TPM191E_R.201.000.248.217",
        "model": "65PUS8545/12",
        "deviceid": "**REDACTED**",
        "nettvversion": "9.0.0",
        "epgsource": "broadcast",
        "api_version": {
          "Major": 6,
          "Minor": 4,
          "Patch": 0
        },
        "featuring": {
          "jsonfeatures": {
            "editfavorites": [
              "TVChannels",
              "SatChannels"
            ],
            "recordings": [
              "List",
              "Schedule",
              "Manage"
            ],
            "ambilight": [
              "LoungeLight",
              "Hue",
              "Ambilight",
              "HueStreaming"
            ],
            "menuitems": [
              "Setup_Menu"
            ],
            "textentry": [
              "not_available"
            ],
            "applications": [
              "TV_Apps",
              "TV_Games",
              "TV_Settings"
            ],
            "pointer": [
              "not_available"
            ],
            "inputkey": [
              "key"
            ],
            "activities": [
              "intent"
            ],
            "channels": [
              "preset_string"
            ],
            "mappings": [
              "server_mapping"
            ]
          },
          "systemfeatures": {
            "tvtype": "consumer",
            "content": [
              "dmr",
              "pvr"
            ],
            "tvsearch": "intent",
            "pairing_type": "digest_auth_pairing",
            "secured_transport": "true",
            "companion_screen": "true"
          }
        },
        "os_type": "MSAF_2019_P"
      },
      "powerstate": "On",
      "context": null,
      "application": {
        "component": {
          "packageName": "org.droidtv.playtv",
          "className": "org.droidtv.playtv.PlayTvActivity"
        }
      },
      "applications": {
        "com.google.android.finsky.tvmainactivity.TvMainActivity-com.android.vending": {
          "label": "Play Store",
          "intent": {
            "component": {
              "packageName": "com.android.vending",
              "className": "com.google.android.finsky.tvmainactivity.TvMainActivity"
            },
            "action": "android.intent.action.MAIN"
          },
          "order": 0,
          "id": "com.google.android.finsky.tvmainactivity.TvMainActivity-com.android.vending",
          "type": "app"
        },
        "com.spocky.projengmenu.ui.home.MainActivity-com.spocky.projengmenu": {
          "label": "Projectivy Launcher",
          "intent": {
            "component": {
              "packageName": "com.spocky.projengmenu",
              "className": "com.spocky.projengmenu.ui.home.MainActivity"
            },
            "action": "android.intent.action.MAIN"
          },
          "order": 0,
          "id": "com.spocky.projengmenu.ui.home.MainActivity-com.spocky.projengmenu",
          "type": "app"
        },
        "com.liskovsoft.smartyoutubetv2.tv.ui.main.SplashActivity-com.teamsmart.videomanager.tv": {
          "label": "SmartTube",
          "intent": {
            "component": {
              "packageName": "com.teamsmart.videomanager.tv",
              "className": "com.liskovsoft.smartyoutubetv2.tv.ui.main.SplashActivity"
            },
            "action": "android.intent.action.MAIN"
          },
          "order": 0,
          "id": "com.liskovsoft.smartyoutubetv2.tv.ui.main.SplashActivity-com.teamsmart.videomanager.tv",
          "type": "app"
        },
        "org.droidtv.channels.ChannelsActivity-org.droidtv.channels": {
          "label": "TV Guide",
          "intent": {
            "component": {
              "packageName": "org.droidtv.channels",
              "className": "org.droidtv.channels.ChannelsActivity"
            },
            "action": "android.intent.action.MAIN"
          },
          "order": 0,
          "id": "org.droidtv.channels.ChannelsActivity-org.droidtv.channels",
          "type": "app"
        },
        "org.droidtv.contentexplorer.MainActivity-org.droidtv.contentexplorer": {
          "label": "Media",
          "intent": {
            "component": {
              "packageName": "org.droidtv.contentexplorer",
              "className": "org.droidtv.contentexplorer.MainActivity"
            },
            "action": "android.intent.action.MAIN"
          },
          "order": 0,
          "id": "org.droidtv.contentexplorer.MainActivity-org.droidtv.contentexplorer",
          "type": "app"
        },
        "org.droidtv.playtv.PlayTvActivity-org.droidtv.playtv": {
          "label": "TV",
          "intent": {
            "component": {
              "packageName": "org.droidtv.playtv",
              "className": "org.droidtv.playtv.PlayTvActivity"
            },
            "action": "android.intent.action.MAIN"
          },
          "order": 0,
          "id": "org.droidtv.playtv.PlayTvActivity-org.droidtv.playtv",
          "type": "app"
        },
        "com.lonelycatgames.Xplore.Browser-com.lonelycatgames.Xplore": {
          "label": "X-plore",
          "intent": {
            "component": {
              "packageName": "com.lonelycatgames.Xplore",
              "className": "com.lonelycatgames.Xplore.Browser"
            },
            "action": "android.intent.action.MAIN"
          },
          "order": 0,
          "id": "com.lonelycatgames.Xplore.Browser-com.lonelycatgames.Xplore",
          "type": "app"
        },
        "com.spocky.projengmenu.ui.guidedActions.activities.input.SourceHDMI1Activity-com.spocky.projengmenu": {
          "label": "HDMI 1",
          "intent": {
            "component": {
              "packageName": "com.spocky.projengmenu",
              "className": "com.spocky.projengmenu.ui.guidedActions.activities.input.SourceHDMI1Activity"
            },
            "action": "android.intent.action.MAIN"
          },
          "order": 0,
          "id": "com.spocky.projengmenu.ui.guidedActions.activities.input.SourceHDMI1Activity-com.spocky.projengmenu",
          "type": "app"
        },
        "com.spocky.projengmenu.ui.guidedActions.activities.input.SourcePopupActivity-com.spocky.projengmenu": {
          "label": "Input sources popup",
          "intent": {
            "component": {
              "packageName": "com.spocky.projengmenu",
              "className": "com.spocky.projengmenu.ui.guidedActions.activities.input.SourcePopupActivity"
            },
            "action": "android.intent.action.MAIN"
          },
          "order": 0,
          "id": "com.spocky.projengmenu.ui.guidedActions.activities.input.SourcePopupActivity-com.spocky.projengmenu",
          "type": "app"
        },
        "a.a-flar2.homebutton": {
          "label": "Button Mapper",
          "intent": {
            "component": {
              "packageName": "flar2.homebutton",
              "className": "a.a"
            },
            "action": "android.intent.action.MAIN"
          },
          "order": 0,
          "id": "a.a-flar2.homebutton",
          "type": "app"
        },
        "org.xbmc.kodi.Splash-org.xbmc.kodi": {
          "label": "Kodi",
          "intent": {
            "component": {
              "packageName": "org.xbmc.kodi",
              "className": "org.xbmc.kodi.Splash"
            },
            "action": "android.intent.action.MAIN"
          },
          "order": 0,
          "id": "org.xbmc.kodi.Splash-org.xbmc.kodi",
          "type": "app"
        },
        "com.spocky.projengmenu.ui.settings.SettingsActivity-com.spocky.projengmenu": {
          "label": "Projectivy Launcher",
          "intent": {
            "component": {
              "packageName": "com.spocky.projengmenu",
              "className": "com.spocky.projengmenu.ui.settings.SettingsActivity"
            },
            "action": "android.intent.action.MAIN"
          },
          "order": 0,
          "id": "com.spocky.projengmenu.ui.settings.SettingsActivity-com.spocky.projengmenu",
          "type": "app"
        }
      },
      "source_id": null,
      "sources": {
        "content://android.media.tv/channel": {
          "name": "Watch TV"
        },
        "content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW5": {
          "name": "HDMI 1"
        },
        "content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW6": {
          "name": "HDMI 2"
        },
        "content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW7": {
          "name": "HDMI 3"
        },
        "content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW8": {
          "name": "HDMI 4"
        }
      },
      "ambilight_styles": {
        "FOLLOW_AUDIO": {
          "styleName": "FOLLOW_AUDIO",
          "algorithms": [
            "ENERGY_ADAPTIVE_BRIGHTNESS",
            "ENERGY_ADAPTIVE_COLORS",
            "VU_METER",
            "SPECTRUM_ANALYZER",
            "KNIGHT_RIDER_CLOCKWISE",
            "KNIGHT_RIDER_ALTERNATING",
            "RANDOM_PIXEL_FLASH",
            "STROBO",
            "PARTY"
          ],
          "maxTuning": 2,
          "menuSettings": [
            "ENERGY_ADAPTIVE_BRIGHTNESS",
            "VU_METER",
            "RANDOM_PIXEL_FLASH"
          ]
        },
        "Lounge light": {
          "styleName": "Lounge light",
          "algorithms": [
            "MANUAL_HUE",
            "AUTOMATIC_HUE"
          ],
          "maxSpeed": 255,
          "menuSettings": [
            "HOT_LAVA",
            "DEEP_WATER",
            "FRESH_NATURE",
            "ISF",
            "CUSTOM_COLOR"
          ]
        },
        "FOLLOW_VIDEO": {
          "styleName": "FOLLOW_VIDEO",
          "menuSettings": [
            "STANDARD",
            "VIVID",
            "IMMERSIVE",
            "NATURAL",
            "GAME"
          ]
        }
      },
      "ambilight_topology": null,
      "ambilight_current_configuration": null,
      "ambilight_mode_raw": null,
      "ambilight_modes": [
        "internal",
        "manual",
        "expert",
        "lounge"
      ],
      "ambilight_power_raw": null,
      "ambilight_power": null,
      "ambilight_cached": {
        "layer1": {
          "left": {
            "0": {
              "r": 0,
              "g": 0,
              "b": 0
            },
            "1": {
              "r": 0,
              "g": 0,
              "b": 0
            },
            "2": {
              "r": 0,
              "g": 0,
              "b": 0
            },
            "3": {
              "r": 0,
              "g": 0,
              "b": 0
            }
          },
          "top": {
            "0": {
              "r": 0,
              "g": 0,
              "b": 0
            },
            "1": {
              "r": 0,
              "g": 0,
              "b": 0
            },
            "2": {
              "r": 0,
              "g": 0,
              "b": 0
            },
            "3": {
              "r": 0,
              "g": 0,
              "b": 0
            },
            "4": {
              "r": 0,
              "g": 0,
              "b": 0
            },
            "5": {
              "r": 0,
              "g": 0,
              "b": 0
            },
            "6": {
              "r": 0,
              "g": 0,
              "b": 0
            },
            "7": {
              "r": 0,
              "g": 0,
              "b": 0
            },
            "8": {
              "r": 0,
              "g": 0,
              "b": 0
            }
          },
          "right": {
            "0": {
              "r": 0,
              "g": 0,
              "b": 0
            },
            "1": {
              "r": 0,
              "g": 0,
              "b": 0
            },
            "2": {
              "r": 0,
              "g": 0,
              "b": 0
            },
            "3": {
              "r": 0,
              "g": 0,
              "b": 0
            }
          }
        }
      },
      "ambilight_measured": null,
      "ambilight_processed": null,
      "screenstate": null,
      "on": false,
      "channel": {
        "channel": {
          "ccid": 2400,
          "preset": "42",
          "name": "Galaxy4"
        },
        "channelList": {
          "id": "1",
          "version": "213"
        }
      }
    }
  }
}

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-04-11 18:02:46.704 DEBUG (MainThread) [haphilipsjs] Get succeded: activities/current -> {"component":{"packageName":"org.droidtv.playtv","className":"org.droidtv.playtv.PlayTvActivity"}}
2024-04-11 18:02:46.772 DEBUG (MainThread) [haphilipsjs] Get succeded: context -> Context Service not started
2024-04-11 18:02:46.772 DEBUG (MainThread) [haphilipsjs] Invalid json received, trying adjusted version
2024-04-11 18:02:46.773 ERROR (MainThread) [homeassistant.components.philips_js] Unexpected error fetching philips_js data: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/homeassistant/components/philips_js/__init__.py", line 191, in _async_update_data
    await self.api.update()
  File "/usr/local/lib/python3.12/site-packages/haphilipsjs/__init__.py", line 736, in update
    await self.getContext()
  File "/usr/local/lib/python3.12/site-packages/haphilipsjs/__init__.py", line 832, in getContext
    r = cast(Optional[ContextType], await self.getReq(f"context"))
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/haphilipsjs/__init__.py", line 577, in getReq
    return decode_xtv_response(resp)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/haphilipsjs/__init__.py", line 133, in decode_xtv_response
    return decode_xtv_json(text)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/haphilipsjs/__init__.py", line 116, in decode_xtv_json
    data = json.loads(text)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2024-04-11 18:02:46.782 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 2.037 seconds (success: False)

Additional information

My HA instance is a completely new containerized instance, this is my first integration, tried the "usual" workarounds from similar issues (restarting this and that, unplugging TV, etc).

home-assistant[bot] commented 5 months ago

Hey there @elupus, mind taking a look at this issue as it has been labeled with an integration (philips_js) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `philips_js` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign philips_js` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


philips_js documentation philips_js source (message by IssueLinks)

elupus commented 5 months ago

Weird reply "Context Service not started". Something is not active on that tv. Should be possible to work around.