custom-cards / button-card

❇️ Lovelace button-card for home assistant
MIT License
1.93k stars 233 forks source link

Some files left from Button-Card doesn't allow for fresh install #729

Closed dawidblum closed 1 year ago

dawidblum commented 1 year ago

Checklist

Describe the bug Uninstalling 3.5.0 version of Button-card leaves files in HA that affect new installs. Button-card

Version of the card Version: 4.0.0 Dev.10

To Reproduce Install 3.5.0 version, remove it after that it stays in web browers console. Orange text "Button Card". When installing 4.0.0 after that (or any other version) console provides this information:

Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "button-card-action-handler" has already been used with this registry

This is the configuration I used:


homeassistant:
  customize: !include customize.yaml
  auth_providers:
  - type: homeassistant
  whitelist_external_dirs:
  - /data/data/com.termux/files/home/AIS/www/

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 127.0.0.1
    - ::1

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

input_number: !include input_number.yaml
input_select: !include input_select.yaml

panel_iframe:
  coder:
    title: Code
    icon: mdi:microsoft-visual-studio-code
    url: "http://192.168.1.3:8088"

frontend:
  themes: !include_dir_merge_named themes

sensor:
  - platform: template
    sensors:
      count_lights:
        friendly_name: Włączone światła
        value_template: >
            {% set lights = [
              states.light.salon_1,
              states.light.salon_2,
              states.light.salon_3,
              states.light.kuchnia,
              states.light.hue_lightstrip_plus_1,
              states.light.korytarz,
              states.light.sypialnia,
              ] %}
            {{ lights | selectattr('state','eq','on') | list | count }}
  - platform: template
    sensors:
      count_sockets:
        friendly_name: Włączone gniazdka
        value_template: >
            {% set lights = [
              states.switch.gniazdko_5,
              states.switch.gniazdko_5_2,
              states.switch.gniazdko_3,
              states.switch.gniazdko,
              states.switch.tasmota,
              states.switch.gniazdko_zmywarka
              ] %}
            {{ lights | selectattr('state','eq','on') | list | count }}

Screenshots https://imgur.com/a/rhSxHr9

Expected behavior Button Card not appearing in console logs after uninstalling and clearing browser cache.

Desktop:

Smartphone:

RomRider commented 1 year ago

You're loading it twice. Check the resources you load (you need to enable the advanced mode in your user in the frontend and then navigate to: Settings -> Dashboard -> 3 dots on top right -> Resources)

dawidblum commented 1 year ago

Screenshot_20230726_172356_AIS Screenshot_20230726_172349_AIS

RomRider commented 1 year ago

I can still see it there, so it's not removed. You have to reload your resources also once it's done

dawidblum commented 1 year ago

This screenshot was with 4.0.0 dev version installed with hacs. When I uninstall button-card thru hacs there is no entry in resources named button-card but it still appears in console.

This screenshot was taken with button-card unistalled thru hacs and after relaod and HA restart. Button-card still appears in console.

Screenshot_20230726_194816_Home Assistant

RomRider commented 1 year ago

Yes, because you have to update your resources from the dashboard 3 dot menu and then hard reload (CTRL + R on windows) the page.

dawidblum commented 1 year ago

That's what I did, the entry in console still appears. When I click on the response in console it shows this message:

Failed to load content from the source map https://raw.githubusercontent.com/home-assistant/frontend/20230705.2/src/panels/lovelace/cards/hui-ais-button-card.js (HTTP error - status code: 404, network::ERR_HTTP_RESPONSE_CODE_FAILURE)

obraz_2023-07-27_013703934

RomRider commented 1 year ago

Restart HA, but this has nothing to do with button-card. If it still loads it's because your resources are not refreshed, that's all. Removing it from the list is not enough.

dawidblum commented 1 year ago

image Screenshot from freshly installed firefox browser. Please could you tell me how to refresh resources since I can't find any step by step instructions online

RomRider commented 1 year ago

type should be type: custom:button-card not type: button-card

dawidblum commented 1 year ago

Those screenshots are with button-card uninstalled thru hacs image

image

image

image

What do I have to provide for you to help me out? Any logs or files?

RomRider commented 1 year ago

hui-ais-button-card.js (as you can see on the right of the javascript console) is not the button-card installed through HACS. I don't know where it comes from. My best guess is that some other card/custom_component is pulling directly this card from github as an import 🤷‍♂️ Please head over to the home assistant forum to ask for help.

RomRider commented 1 year ago

So I looked further into this and you are not using home assistant but you are using their strange fork: https://github.com/sviete/AIS-home-assistant

From this company: http://www.ai-speaker.com/

Their fork embeds a lot of stuff, including this card, as is, without any credits.