Custom_updater - IndexError: list index out of range

Hello!

Everytime when i click the button - “Update all” i receive this error:

grafik

Error executing service <ServiceCall custom_updater.update_all (c:fc004d1640dd47349b587bd389f3a59c)>

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1185, in _event_to_service_call
    await self._hass.async_add_executor_job(execute_service)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1182, in execute_service
    service_handler.func(service_call)
  File "/config/custom_components/custom_updater.py", line 94, in update_all_service
    card_controller.update_all()
  File "/config/custom_components/custom_updater.py", line 149, in update_all
    self.custom_url)
  File "/config/deps/lib/python3.6/site-packages/pyupdate/ha_custom/custom_cards.py", line 87, in update_all
    upgrade_single(base_dir, name, custom_repos)
  File "/config/deps/lib/python3.6/site-packages/pyupdate/ha_custom/custom_cards.py", line 97, in upgrade_single
    local_file = get_card_dir(base_dir, name) + name + '.js'
  File "/config/deps/lib/python3.6/site-packages/pyupdate/ha_custom/custom_cards.py", line 135, in get_card_dir
    card = line.split('!resource ')[1].split(name + '.js')
IndexError: list index out of range

the path to the file are:
\192.168.0.128\config\www\custom_ui
grafik

See someone the problem?

Thanks for your help!

How does your ui-lovelace.yaml file look? (the resource section of it)

# This file is automatically generated by lovelace-gen.py
# https://github.com/thomasloven/homeassistant-lovelace-gen
# Any changes made to it will be overwritten the next time the script is run.

This is my ui-lovelace.yaml (ressource part)

resources:
- {type: js, url: '/local/custom_ui/dark-sky-weather-card.js?v=7'}
- {type: module, url: '/local/custom_ui/button-card.js?v=0.0.2'}
- {type: js, url: '/local/custom_ui/tracker-card.js?v=0.1.5'}
- {type: js, url: '/local/custom_ui/monster-card.js?=0.2.3'}
- {type: js, url: '/local/custom_ui/vertical-style-card.js?=0.0.2'}
title: Lovelace
views:

Can you turn on “debug” logging for it?
and paste the content of /config/lovelace/main.yaml?

debug: https://github.com/custom-components/custom_updater/wiki/Debug

the Log:

2018-10-08 08:23:04 DEBUG (SyncWorker_1) [pyupdate.ha_custom.custom_cards] get_sensor_data: [{'domain': 'custom_cards', 'has_update': ['monster-card'], 'tracker-card': {'local': '0.1.5', 'remote': '0.1.5', 'has_update': False, 'not_local': False, 'repo': 'https://github.com/custom-cards/tracker-card', 'change_log': 'https://github.com/custom-cards/tracker-card/blob/master/changelog.md'}, 'monster-card': {'local': '0.2.2', 'remote': '0.2.3', 'has_update': True, 'not_local': False, 'repo': 'https://github.com/ciotlosm/custom-lovelace/tree/master/monster-card', 'change_log': 'https://github.com/ciotlosm/custom-lovelace/tree/master/monster-card/changelog.md'}, 'button-card': {'local': '0.0.2', 'remote': '0.0.2', 'has_update': False, 'not_local': False, 'repo': 'https://github.com/kuuji/button-card', 'change_log': 'https://github.com/kuuji/button-card/releases/latest'}, 'vertical-style-card': {'local': '0.0.2', 'remote': '0.0.2', 'has_update': False, 'not_local': False, 'repo': 'https://github.com/matisaul/vertical-style-card', 'change_log': 'https://github.com/matisaul/vertical-style-card/releases/latest'}}, 1]
2018-10-08 08:23:04 INFO (SyncWorker_1) [pyupdate.ha_custom.custom_cards] update_all: "['monster-card']"
2018-10-08 08:23:04 DEBUG (SyncWorker_1) [pyupdate.ha_custom.custom_cards] upgrade_single started: "monster-card"
2018-10-08 08:23:04 DEBUG (SyncWorker_1) [pyupdate.ha_custom.common] get_repo_data: "['https://raw.githubusercontent.com/custom-cards/information/master/repos.json', 'https://raw.githubusercontent.com/awesome-developer/my-awesome-repo/master/custom_cards.json', 'https://raw.githubusercontent.com/kuuji/button-card/0.0.2/tracker.json', 'https://raw.githubusercontent.com/matisaul/vertical-style-card/master/tracker.json']"
2018-10-08 08:23:05 DEBUG (SyncWorker_1) [pyupdate.ha_custom.custom_cards] get_info_all_cards: {'aftership-card': ['aftership-card', '0.0.2', 'https://raw.githubusercontent.com/custom-cards/aftership-card/master/aftership-card.js', 'https://github.com/custom-cards/aftership-card', 'https://github.com/custom-cards/aftership-card/releases/latest'], 'beer-wishlist-card': ['beer-wishlist-card', '0.0.2', 'https://raw.githubusercontent.com/custom-cards/aftership-card/master/aftership-card.js', 'https://github.com/custom-cards/aftership-card', 'https://github.com/custom-cards/aftership-card/releases/latest'], 'button-entity-row': ['button-entity-row', '0.1.3', 'https://raw.githubusercontent.com/custom-cards/button-entity-row/master/button-entity-row.js', 'https://github.com/custom-cards/button-entity-row', 'https://github.com/custom-cards/button-entity-row/releases/latest'], 'canvas-gauge-card': ['canvas-gauge-card', '0.0.2', 'https://raw.githubusercontent.com/custom-cards/canvas-gauge-card/master/canvas-gauge-card.js', 'https://github.com/custom-cards/canvas-gauge-card', 'https://github.com/custom-cards/canvas-gauge-card/releases/latest'], 'circle-sensor-card': ['circle-sensor-card', '1.2.0', 'https://raw.githubusercontent.com/custom-cards/circle-sensor-card/master/circle-sensor-card.js', 'https://github.com/custom-cards/circle-sensor-card', 'https://github.com/custom-cards/circle-sensor-card/releases/latest'], 'ext-weblink': ['ext-weblink', '0.3.2', 'https://raw.githubusercontent.com/custom-cards/ext-weblink/master/ext-weblink.js', 'https://github.com/custom-cards/ext-weblink', 'https://github.com/custom-cards/ext-weblink/releases/latest'], 'light-entity-row': ['light-entity-row', '0.2.2', 'https://raw.githubusercontent.com/custom-cards/light-entity-row/master/light-entity-row.js', 'https://github.com/custom-cards/light-entity-row', 'https://github.com/custom-cards/light-entity-row/releases/latest'], 'list-card': ['list-card', '0.0.6', 'https://raw.githubusercontent.com/custom-cards/list-card/master/list-card.js', 'https://github.com/custom-cards/list-card', 'https://github.com/custom-cards/list-card/releases/latest'], 'rmv-card': ['rmv-card', '999', 'https://raw.githubusercontent.com/custom-cards/marquee-state-element/master/marquee-state-element.js', 'https://github.com/custom-cards/marquee-state-element', 'https://github.com/custom-cards/marquee-state-element/releases/latest'], 'state-attribute-element': ['state-attribute-element', '0.1.0', 'https://raw.githubusercontent.com/custom-cards/state-attribute-element/master/state-attribute-element.js', 'https://github.com/custom-cards/state-attribute-element', 'https://github.com/custom-cards/state-attribute-element/releases/latest'], 'state-element': ['state-element', '0.0.1', 'https://raw.githubusercontent.com/custom-cards/state-element/master/state-element.js', 'https://github.com/custom-cards/state-element', 'https://github.com/custom-cards/state-element/releases/latest'], 'surveillance-card': ['surveillance-card', '0.0.1', 'https://raw.githubusercontent.com/custom-cards/surveillance-card/master/surveillance-card.js', 'https://github.com/custom-cards/surveillance-card', 'https://github.com/custom-cards/surveillance-card/releases/latest'], 'text-element': ['text-element', '0.0.2', 'https://raw.githubusercontent.com/custom-cards/text-element/master/text-element.js', 'https://github.com/custom-cards/text-element', 'https://github.com/custom-cards/text-element/releases/latest'], 'tracker-card': ['tracker-card', '0.1.5', 'https://raw.githubusercontent.com/custom-cards/tracker-card/master/tracker-card.js', 'https://github.com/custom-cards/tracker-card', 'https://github.com/custom-cards/tracker-card/blob/master/changelog.md'], 'upcoming-media-card': ['upcoming-media-card', '0.2.1', 'https://raw.githubusercontent.com/custom-cards/upcoming-media-card/master/upcoming-media-card.js', 'https://github.com/custom-cards/upcoming-media-card', 'https://github.com/custom-cards/upcoming-media-card/releases/latest'], 'username-element': ['username-element', '0.0.1', 'https://raw.githubusercontent.com/custom-cards/username-element/master/username-element.js', 'https://github.com/custom-cards/username-element', 'https://github.com/custom-cards/username-element/releases/latest'], 'vertical-stack-in-card': ['vertical-stack-in-card', '0.0.6', 'https://raw.githubusercontent.com/custom-cards/vertical-stack-in-card/master/vertical-stack-in-card.js', 'https://github.com/custom-cards/vertical-stack-in-card', 'https://github.com/custom-cards/vertical-stack-in-card/blob/master/changelog.md'], 'card-modder': ['card-modder', 'e6b175', 'https://raw.githubusercontent.com/thomasloven/lovelace-card-modder/master/card-modder.js', 'https://github.com/thomasloven/lovelace-card-modder', 'https://github.com/thomasloven/lovelace-card-modder'], 'color-glance-card': ['color-glance-card', '64be02', 'https://raw.githubusercontent.com/thomasloven/lovelace-color-glance-card/master/color-glance-card.js', 'https://github.com/thomasloven/lovelace-color-glance-card', 'https://github.com/thomasloven/lovelace-color-glance-card'], 'column-card': ['column-card', '7221e1', 'https://raw.githubusercontent.com/thomasloven/lovelace-column-card/master/column-card.js', 'https://github.com/thomasloven/lovelace-column-card', 'https://github.com/thomasloven/lovelace-column-card'], 'folding-group-entity-row': ['folding-group-entity-row', '98faea', 'https://raw.githubusercontent.com/thomasloven/lovelace-folding-group-entity-row/master/folding-group-entity-row.js', 'https://github.com/thomasloven/lovelace-folding-group-entity-row', 'https://github.com/thomasloven/lovelace-folding-group-entity-row'], 'lovelace-fullykiosk': ['lovelace-fullykiosk', '96feda', 'https://raw.githubusercontent.com/thomasloven/lovelace-fullykiosk/master/lovelace-fullykiosk.js', 'https://github.com/thomasloven/lovelace-fullykiosk', 'https://github.com/thomasloven/lovelace-fullykiosk'], 'long-press': ['long-press', '252428', 'https://raw.githubusercontent.com/thomasloven/lovelace-long-press/master/long-press.js', 'https://github.com/thomasloven/lovelace-long-press', 'https://github.com/thomasloven/lovelace-long-press'], 'lovelace-player': ['lovelace-player', 'c2a43b', 'https://raw.githubusercontent.com/thomasloven/lovelace-player/master/lovelace-player.js', 'https://github.com/thomasloven/lovelace-player', 'https://github.com/thomasloven/lovelace-player'], 'slider-entity-row': ['slider-entity-row', '2d9e00', 'https://raw.githubusercontent.com/thomasloven/lovelace-slider-entity-row/master/slider-entity-row.js', 'https://github.com/thomasloven/lovelace-slider-entity-row', 'https://github.com/thomasloven/lovelace-slider-entity-row'], 'time-input-row': ['time-input-row', 'f503b7', 'https://raw.githubusercontent.com/thomasloven/lovelace-time-input-row/master/time-input-row.js', 'https://github.com/thomasloven/lovelace-time-input-row', 'https://github.com/thomasloven/lovelace-time-input-row'], 'toggle-lock-entity-row': ['toggle-lock-entity-row', 'a57ac1', 'https://raw.githubusercontent.com/thomasloven/lovelace-toggle-lock-entity-row/master/toggle-lock-entity-row.js', 'https://github.com/thomasloven/lovelace-toggle-lock-entity-row', 'https://github.com/thomasloven/lovelace-toggle-lock-entity-row'], 'useful-markdown-card': ['useful-markdown-card', '54a046', 'https://raw.githubusercontent.com/thomasloven/lovelace-useful-markdown-card/master/useful-markdown-card.js', 'https://github.com/thomasloven/lovelace-useful-markdown-card', 'https://github.com/thomasloven/lovelace-useful-markdown-card'], 'monster-card': ['monster-card', '0.2.3', 'https://raw.githubusercontent.com/ciotlosm/custom-lovelace/master/monster-card/monster-card.js', 'https://github.com/ciotlosm/custom-lovelace/tree/master/monster-card', 'https://github.com/ciotlosm/custom-lovelace/tree/master/monster-card/changelog.md'], 'gauge-card': ['gauge-card', '0.2.0', 'https://raw.githubusercontent.com/ciotlosm/custom-lovelace/master/gauge-card/gauge-card.js', 'https://github.com/ciotlosm/custom-lovelace/tree/master/gauge-card', 'https://github.com/ciotlosm/custom-lovelace/tree/master/gauge-card/changelog.md'], 'entity-attributes-card': ['entity-attributes-card', '0.1.1', 'https://raw.githubusercontent.com/ciotlosm/custom-lovelace/master/entity-attributes-card/entity-attributes-card.js', 'https://github.com/ciotlosm/custom-lovelace/tree/master/entity-attributes-card', 'https://github.com/ciotlosm/custom-lovelace/tree/master/entity-attributes-card/changelog.md'], 'group-card': ['group-card', '0.0.2', 'https://raw.githubusercontent.com/ciotlosm/custom-lovelace/master/group-card/group-card.js', 'https://github.com/ciotlosm/custom-lovelace/tree/master/group-card', 'https://github.com/ciotlosm/custom-lovelace/tree/master/group-card/changelog.md'], 'thermostat-card': ['thermostat-card', '0.1.1', 'https://raw.githubusercontent.com/ciotlosm/custom-lovelace/master/thermostat-card/thermostat-card.js', 'https://github.com/ciotlosm/custom-lovelace/tree/master/thermostat-card', 'https://github.com/ciotlosm/custom-lovelace/tree/master/thermostat-card/changelog.md'], 'plan-coordinates': ['plan-coordinates', '0.1.0', 'https://raw.githubusercontent.com/ciotlosm/custom-lovelace/master/plan-coordinates/plan-coordinates.js', 'https://github.com/ciotlosm/custom-lovelace/tree/master/plan-coordinates', 'https://github.com/ciotlosm/custom-lovelace/tree/master/plan-coordinates/changelog.md'], 'alarm_control_panel-card': ['alarm_control_panel-card', '0.4.0', 'https://raw.githubusercontent.com/ciotlosm/custom-lovelace/master/alarm_control_panel-card/alarm_control_panel-card.js', 'https://github.com/ciotlosm/custom-lovelace/tree/master/alarm_control_panel-card', 'https://github.com/ciotlosm/custom-lovelace/tree/master/alarm_control_panel-card/changelog.md'], 'bignumber-card': ['bignumber-card', '0.0.1', 'https://raw.githubusercontent.com/ciotlosm/custom-lovelace/master/bignumber-card/bignumber-card.js', 'https://github.com/ciotlosm/custom-lovelace/tree/master/bignumber-card', 'https://github.com/ciotlosm/custom-lovelace/tree/master/bignumber-card/changelog.md'], 'home-setter': ['home-setter', '0.0.1', 'https://raw.githubusercontent.com/ciotlosm/custom-lovelace/master/home-setter/home-setter.js', 'https://github.com/ciotlosm/custom-lovelace/tree/master/home-setter', 'https://github.com/ciotlosm/custom-lovelace/tree/master/home-setter/changelog.md'], 'beer-card': ['beer-card', '0.2.3', 'https://raw.githubusercontent.com/ciotlosm/custom-lovelace/master/beer-card/beer-card.js', 'https://github.com/ciotlosm/custom-lovelace/tree/master/beer-card', 'https://github.com/ciotlosm/custom-lovelace/tree/master/beer-card/changelog.md'], 'button-card': ['button-card', '0.0.2', 'https://raw.githubusercontent.com/kuuji/button-card/master/button-card.js', 'https://github.com/kuuji/button-card', 'https://github.com/kuuji/button-card/releases/latest'], 'vertical-style-card': ['vertical-style-card', '0.0.2', 'https://raw.githubusercontent.com/matisaul/vertical-style-card/master/vertical-style-card.js', 'https://github.com/matisaul/vertical-style-card', 'https://github.com/matisaul/vertical-style-card/releases/latest']}
2018-10-08 08:23:05 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall custom_updater.update_all (c:8e16d565d3eb4eceb141568e44918a28)>

the main.yaml

resources:
  - url: /local/custom_ui/dark-sky-weather-card.js?v=7
    type: js
  - url: /local/custom_ui/button-card.js?v=0.0.2
    type: module
  - url: /local/custom_ui/tracker-card.js?v=0.1.5
    type: js
  - url: /local/custom_ui/monster-card.js?=0.2.2
    type: js
  - url: /local/custom_ui/vertical-style-card.js?=0.0.2
    type: js
    
title: Lovelace

views:
  - title: Home
    id: home
    cards:
    - !include weather.yaml
    - !include presence.yaml
    - !include clients.yaml
    - !include card-track.yaml
    - !include monster.yaml
1 Like

You are defining your resources the wrong way.
Have a look at the documentation and examples here:
https://github.com/thomasloven/homeassistant-lovelace-gen#example

Once you have corrected the structure of main.yaml the updater should start working again :slight_smile:

I also get a similar error when trying to update:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1185, in _event_to_service_call
await self._hass.async_add_executor_job(execute_service)
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1182, in execute_service
service_handler.func(service_call)
File "/config/custom_components/custom_updater.py", line 94, in update_all_service
card_controller.update_all()
File "/config/custom_components/custom_updater.py", line 199, in update_all
if (self.hass.data[CARD_DATA][name]['has_update'] and
TypeError: list indices must be integers or slices, not str

sorry, but what is my problem? the !resource?

I try it with the !resource-tag (monster-card) but everytime i generate the ui-lovelace.yaml i receive a “3” Error

title: Lovelace

resources:
  - url: /local/custom_ui/dark-sky-weather-card.js?v=7
    type: js
  - url: /local/custom_ui/button-card.js?v=0.0.2
    type: module
  - url: /local/custom_ui/tracker-card.js?v=0.1.5
    type: js
  - url: !resource /cards/monster-card.js?=0.2.2
    type: js
  - url: /local/custom_ui/vertical-style-card.js?=0.0.2
    type: js
    

views:
  - title: Home
    id: home
    cards:
    - !include weather.yaml
    - !include presence.yaml
    - !include clients.yaml
    - !include card-track.yaml
    - !include monster.yaml

image

You have a bad version, that can not be updated, you need to do that manually :confused:

Yes, the component expects you to be using that if you are using lovelace-gen.
But I not using it myself so not sure how it should be :man_shrugging:

i do it like this;
https://github.com/isabellaalstrom/HomeAssistantConfiguration/blob/master/lovelace/main.yaml#L34

and now it’s work :slight_smile:

1 Like

The way Python indexing works is that it starts at 0, so the first number of your list would be [0]. Index Error: List index out of range means you are trying to get an item in a list that doesn’t exist. It means that you are referring to n-th element of the python list, while the length of the list is smaller than n. whenever you get this type of error please cross check with items that comes between/middle in range, and insure that their index is not last if you get output then you have made perfect error that mentioned.

An index in Python refers to a position within an ordered list . To retrieve an element of the list, you use the index operator ([]) . Using indexing you can easily get any element by its position.