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.57k stars 30.74k forks source link

Github Integration name and entity_namespace ignored #31813

Closed DavidFW1960 closed 4 years ago

DavidFW1960 commented 4 years ago

The problem

Environment

Traceback/Error logs

Additional information

Example created sensor: image

DavidFW1960 commented 4 years ago
  - platform: github
    access_token: !secret github-access-token
    entity_namespace: github
    repositories:
      - path: 'artisan-roaster-scope/artisan'
        name: Github Artisan
      - path: 'docker/compose'
        name: Github Docker Compose
      - path: 'arendst/Tasmota'
        name: Github Tasmota

I did put it above but it's ignoring it

DavidFW1960 commented 4 years ago

I also entered this description above but GONE:

I have added a Github Sensor but it is ignoring the name I define and not using that name for the sensor. It uses the name for friendly_name but not for the sensor. I also tried using untity_namespace but that is ignored.

DavidFW1960 commented 4 years ago

@frenck are you the code owner for this integration? Would you mind taking a look?

frenck commented 4 years ago

@DavidFW1960 No, I'm not. This integration has no code owner.

kuchel77 commented 4 years ago

I think this is to do with how Home Assistant handles entities and their names.

If you delete each of the

    repositories:
      - path: 'artisan-roaster-scope/artisan'
        name: Github Artisan
      - path: 'docker/compose'
        name: Github Docker Compose
      - path: 'arendst/Tasmota'
        name: Github Tasmota

Sections out of your configuration.yaml (or wherever they are). If you then restart the server. Then go to Configuration -> Entities. Then delete the current sensors, ie sensor.artisan. Then, re add the entries back into configuration.yaml (or again, wherever they are for you), restart the server again, you should have the new entities with new names. It seems that once a name is set for an entity, it doesn't change even you have changed this is the configuration.yaml.

DavidFW1960 commented 4 years ago

Excellent suggestion! I'll try that on my PC tomorrow. Thanks!

Mariusthvdb commented 4 years ago

and so you know, the entity_namespace does work fine, using this in my setup (and copy it here to be of a little help, hope it is allowed)

sensor:
  - platform: github
    access_token: !secret github_token
    entity_namespace: Github
    scan_interval: 3600
    repositories:
      - path: home-assistant/home-assistant
        name: Home-assistant
      - path: thomasloven/hass-browser_mod
        name: Browser mod
      - path: dnguyen800/air-visual-card
        name: Air visual
      - path: thomasloven/lovelace-auto-entities
        name: Auto entities
      - path: custom-cards/bar-card
        name: Bar
      - path: custom-cards/bignumber-card
        name: Big number
      - path: custom-cards/button-card
        name: Button
      - path: thomasloven/lovelace-card-mod
        name: Card mod
      - path: thomasloven/lovelace-card-tools
        name: Card tools
#      - path: custom-cards/config-template-card
#        name: Config template
      - path: maykar/custom-header
        name: Custom header
#      - path: iammexx/home-assistant-config/tree/master/ui/darksky
#        name: Darksky weather card
      - path: custom-cards/decluttering-card
        name: Decluttering
      - path: custom-cards/entity-attributes-card
        name: Entity attributes
      - path: thomasloven/hass-favicon
        name: Fav icon
      - path: thomasloven/lovelace-fold-entity-row
        name: Fold entity row
      - path: custom-cards/gauge-card
        name: Gauge
      - path: custom-cards/group-card
        name: Group
      - path: thomasloven/lovelace-layout-card
        name: Layout card
      - path: DBuit/light-popup-card
        name: Light popup
      - path: iantrich/list-card
        name: List
      - path: gadgetchnnel/lovelace-card-templater
        name: Card templater
      - path: kalkih/mini-graph-card
        name: Mini graph
      - path: kalkih/mini-media-player
        name: Mini media player
      - path: benct/lovelace-multiple-entity-row
        name: Multiple entity row
      - path: gurbyz/power-wheel-card
        name: Power wheel
      - path: iantrich/restriction-card
        name: Restriction
      - path: custom-cards/secondaryinfo-entity-row
        name: Secondary info row
      - path: nervetattoo/simple-thermostat
        name: Simple thermostat
      - path: kalkih/simple-weather-card
        name: Simple weather
      - path: thomasloven/lovelace-slider-entity-row
        name: Slider entity row
      - path: thomasloven/lovelace-state-switch
        name: State switch
#      - path: bramkragten/custom-ui/tree/master/swipe-card
#        name: Swipe
      - path: thomasloven/lovelace-template-entity-row
        name: Template entity row
#      - path: rodrigofragadf/lovelace-cards/tree/master/tiles-card
#        name: Tiles
      - path: thomasloven/lovelace-toggle-lock-entity-row
        name: Toggle lock entity row
      - path: ofekashery/vertical-stack-in-card
        name: Vertical stack in card
      - path: royto/waze-card
        name: Waze
      - path: sgttrs/lovelace-weather-card-chart
        name: Weather card chart

I did have 3 sensors, without the github prefix, but edited these manually in the storage core.entity_registry ;-)

Note there is an another issue here, hence the commented entries: if one of the configured sensors fails to connect properly, the full set of sensors isn't created, even think the platform setup errors out

DavidFW1960 commented 4 years ago

So this has fixed it. Thanks @kuchel77. I stopped HA container, edited core.entity_registry to delete the sensors and restarted HA. This then gave me Sensor.github_github_docker_compose as an example... so it IS reading both the name and entity_namespace now! So I edited the name to just Docker Compose and used the entity namespace and now I have sensors like: Sensor.github_docker_compose... Thanks very much. I should have known that as I think when I specified the entity_namespace for the custom sun2 component it did the same thing but that was a long time ago.......