core: sensor NMBS live doesn't set sensor name or friendly_name to name (but adds suffix _2, _3)

Home Assistant release with the issue:

all

Last working Home Assistant release (if known):

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

Hassio 102.2 Rpi14 Integration:

https://www.home-assistant.io/integrations/nmbs/ Description of problem:

configuring several sensors, the name set under configuration_variable name: only sets the name in the frontend, and not the backend. Hence all sensors have the identical friendly_name, and the entity_id is suffixed with _2, _3 etc…

should better be ‘sensor.name’ which would then result in the friendly_name being what is set under name: in the config

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

  - platform: nmbs
    station_from: 'Essen'
    station_to: 'Brussel-Noord'
    station_live: 'Essen'
    exclude_vias: true
    name: Essen - Brussel Noord
    show_on_map: true

  - platform: nmbs
    station_from: 'Brussel-Noord'
    station_to: 'Essen'
    station_live: 'Brussel-Noord'
    exclude_vias: true
    name: Brussel Noord - Essen
    show_on_map: true

Traceback (if applicable):


Additional information: extra reason to change: one has no clue what so ever checking the developer state entity_id which sensor / train is check.

sensor.nmbs_live_2 isnt very informative, while sensor.brussel_noord_essen_live would be much better.

Schermafbeelding 2019-12-02 om 07 10 17

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (15 by maintainers)

Most upvoted comments

Found the cause for this problem: https://github.com/home-assistant/home-assistant/blob/3f2b6bfaa4acc333a5a3caaea3955ab564f49ab2/homeassistant/components/nmbs/sensor.py#L99-L102 This only affects the additionally created live station sensors which are created by specifying a value for the station_live configuration variable. See the documentation for more details. Every additional live station sensor is assigned the same name, no matter what station it is currently monitoring. I would suggest to append the name to this default name, e.g. nmbs_live_brussel_noord_essen. @Mariusthvdb what do you think?