Lovelace: Swiper card

I’m unsure if the issue is with the button cards or swipe one…
For those I created:

If I refresh the page while I’m on this tab, they all work (calling scripts) BUT if I come from other tab of section in the UI, none of them works until I refresh while already there (and they work again), nothing in logs either…

My card config:

  - title: lumieres
    icon: mdi:lightbulb
    cards:           
      - type: custom:swipe-card
        card_width: '185px'
        start_card: 1
        parameters:
          pagination:
            type: 'bullets'
        cards:
          - type: vertical-stack
            cards:
              - type: horizontal-stack
                cards:
                  - type: "custom:button-card"
                    entity: script.1er_lumineux
                    icon: mdi:lightbulb-on-outline
                    color: auto             
                    name: 1er lumineux
                  - type: "custom:button-card"
                    entity: script.1er_100
                    icon: mdi:lightbulb-on-outline
                    color: auto           
                    name: 1er 100% 
              - type: horizontal-stack
                cards:                    
                  - type: "custom:button-card"
                    entity: script.1er_relaxe_couleurs
                    icon: mdi:coffee-outline
                    color: auto           
                    name: 1er relaxe cycle couleurs  
                  - type: "custom:button-card"
                    entity: script.1er_relaxe
                    icon: mdi:coffee-outline
                    color: auto           
                    name: 1er relaxe                   
              - type: horizontal-stack
                cards:
                  - type: "custom:button-card"
                    entity: script.1er_dodo
                    icon: mdi:weather-night
                    color: auto             
                    name: 1er dodo
                  - type: "custom:button-card"
                    entity: script.1er_dodo_couleurs
                    icon: mdi:weather-night
                    color: auto           
                    name: 1er dodo cycle couleurs
          - type: vertical-stack
            cards:                      
              - type: horizontal-stack
                cards:                    
                  - type: "custom:button-card"
                    entity: script.1er_off
                    icon: mdi:lightbulb
                    color: auto           
                    name: 1er OFF  
                  - type: "custom:button-card"
                    entity: script.soussol_relaxe
                    icon: mdi:coffee-outline
                    color: auto           
                    name: Sous-sol relaxe 
              - type: horizontal-stack
                cards:
                  - type: "custom:button-card"
                    entity: script.soussol_off
                    icon: mdi:lightbulb
                    color: auto             
                    name: Sous-sol OFF
                  - type: "custom:button-card"
                    entity: script.bureau_100
                    icon: mdi:lightbulb-on-outline
                    color: auto           
                    name: Bureau 100%                 
              - type: horizontal-stack
                cards:                    
                  - type: "custom:button-card"
                    entity: script.bureau_relaxe
                    icon: mdi:coffee-outline
                    color: auto           
                    name: Bureau relaxe  
                  - type: "custom:button-card"
                    entity: script.bureau_off
                    icon: mdi:lightbulb
                    color: auto           
                    name: Bureau OFF  
          - type: vertical-stack
            cards:                      
              - type: horizontal-stack
                cards:
                  - type: "custom:button-card"
                    entity: script.ext_on
                    icon: mdi:lightbulb-on-outline
                    color: auto             
                    name: Ext ON
                  - type: "custom:button-card"
                    entity: script.ext_off
                    icon: mdi:lightbulb
                    color: auto           
                    name: Ext OFF  

Any idea? of a bug?

Not 100% sure but might be specific to Chrome. Didn’t have this issue on iOS HA

Try using entity-button (HA v0.80.2) instead of custom:button-card the on tap event seems to get lost sometimes with the swiper. The official uses a click event.

1 Like

That’s what you get when the element the swiper is trying to create is not loaded yet, will look if I can catch that, but if you switch tab it should be fixed.

Oh… can’t find any doc on this one. New official one for Lovelace

Update: ok, tried it it works :slight_smile: thanks!
I still didn’t find any doc on this… wouldn’t have used it if I knew…

It is not officially released yet, will be released in 0.81

1 Like

ah well, it works great along with Swiper cards :slight_smile:

The path to other files is hard coded eg. in swipe.js. So you have to use path given in the first path: /config/www/custom-lovelace/swipe-card/

That was not my problem, I misread that I had to update :wink:
Thx anyway

Hi, this card looks amazing.
I’m trying to use it but I can’t, I get this message “Custom element doesn’t exist: swipe-card” and I don’t know how to set up, I’m really newbie with this.
What I did:

What I don’t know what to do

Please help and thanks again!:slight_smile:

It goes at the top of your lovelace yaml file like this:

title: Home
resources:
  - url: /local/swipe-card.js?v=1.0
    type: js

resources: should be at the very top of the ui-lovelace.yaml before the title: Home

Nope. It works as I have shown it - it was copied and pasted out of my lovelace file. The documentation is a little missing/confusing. It most probably works either way but as I have shown it works fine.

See here too:


It is as I have shown it there.

that initial title: Home in your lovelace file is the descriptor for your first lovelace tab, ‘Home’. The resources are generic for the whole file hence why they should generally go before everything else (although the docs dont reflect this). I guess because HA doesnt really care about the position of data in a file (just that it exists in there somewhere) that it isnt important.

No it’s not the descriptor of my first card. Did you look at the doc I linked under ‘trying it out’?

Down below there are views: left justified that define the tabs. It does define the ‘title’ of the installation though…

image

oops, my bad

Thanks you guys, I did it. I add the url but it doesn’t work because I didn’t have the

frontend:
  javascript_version: latest

Once I write this and what you told me, everything works like I want it.
Thanks again!!

1 Like

New version has just been released, but it needs some editing.

Update:
swipe-card.js

The import is now type: module instead of type: js

  - url: /local/custom-lovelace/swipe-card/swipe-card.js?v=1.1.0
    type: module

and the ./js/swiper.min.js is changed and needs to be replaced by a new version.

Which files we must update?

All except the css :slight_smile: