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
73.58k stars 30.75k forks source link

[androidtv] Platform androidtv does not generate unique IDs #26125

Closed fireinice closed 5 years ago

fireinice commented 5 years ago

Home Assistant release with the issue:0.97.2

Last working Home Assistant release (if known):None

Operating environment (Hass.io/Docker/Windows/etc.):Docker

Component/platform:androidtv

Description of problem: two androidtv entity in conf file. and error in log when start。only one androidtv entity can be found

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

- platform: androidtv
  name: living_room_box
  host: x.x.x.x
  get_sources: false  
  device_class: androidtv
  adbkey: /config/adb/adbkey

- platform: androidtv
  name: bedroom_box
  host: x.x.x.x
  get_sources: false  
  device_class: androidtv
  adbkey: /config/adb/adbkey

Traceback (if applicable):

2019-08-21 19:58:56 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 393, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.living_room_box. Platform androidtv does not generate unique IDs

Additional information: it seems caused by the device manufacturer do not properly place serialno: with

adb connect x.x.x.x
adb get-serialno

i got result as(x.x.x.x is the ip of the media player):

x.x.x.x:5555

However if i use command:

adb shell getprop | grep serialno

the result is:

[ro.serialno]: []

It returns empty here. So maybe there should be some codes to catch this situation and use ip(?) for the unique_id

JeffLIrion commented 5 years ago

What's the output of this command? You can redact any personal info, although there's no harm in posting the device's local IP address.

adb shell getprop ro.product.manufacturer && getprop ro.product.model && getprop ro.serialno && getprop ro.build.version.release && ip addr show wlan0 | grep -m 1 ether && ip addr show eth0 | grep -m 1 ether
fireinice commented 5 years ago
adb shell "getprop ro.product.manufacturer && getprop ro.product.model && getprop ro.serialno && getprop ro.build.version.release && ip addr show wlan0 | grep -m 1 ether && ip addr show eth0 | grep -m 1 ether"
realtek
ZIDOO_X9S

6.0.1
    link/ether 0a:be:26:3c:d8:b0 brd ff:ff:ff:ff:ff:ff
    link/ether 71:03:80:59:2a:ca brd ff:ff:ff:ff:ff:ff
probot-home-assistant[bot] commented 5 years ago

Hey there @JeffLIrion, mind taking a look at this issue as its been labeled with a integration (androidtv) you are listed as a codeowner for? Thanks!