Lovelace: Versatile Swiss Army Knife Custom Card

is it possible to use other custom cards inside the sak card?

Hi me again,

Maybe this topic/ problems has already passed in this forum, but if ok I will ask again. :slight_smile:
I have installed sak in hybride mode.
After doing some test with the sak sakeX examples I have built some custom cards in my own dashboard.
They are working fine, butā€¦

After I login to my devices and open my specific dashboard with sak cards I get following error;

I can solve this after I do a ā€œreconfigerā€ under the sak example dashboard, and also do a refresh of my HA.

Then the results are fine, like this;

But after I have logout and go back and login in to my HA, I get the same results, see first screenshot!

Is there something wrong with my pathā€™s? Do I missed some sak configurations?

Thanks to help me out here! :wink:

Jurgen

I donā€™t see this condition regularly but it has appeared occasionally and only when using templates for layouts or toolsets. Iā€™m thinking it has something to do with the speed and order in which the various !include statements are processed by the SAK environment. As you mentioned, a refresh of the view or reloading the page seems to fix it. I havenā€™t looked into it any further than this though.

I have this problem each time if I swap to another device or logout and login again to HA!
It is not occasionally! :wink:
Maybe there are still some pathā€™s who are not ok on my sak environment?

I guess most problems I have is if I use templates from the default sak directory.

Is there anything I can check?

Sorry, Man! Iā€™m honestly not sure on thatā€¦ Perhaps @AmoebeLabs may be able to comment.

It does not appear so. If you want the visual appearance of multiple cards as the same card, have a look at the stack-in card. I have not tried this card yet but have been looking at it. Depending on what your goal is, it might be worth experimenting with.

Ok no problem James! :wink:

Ok I will try this! :slight_smile:

@jwaz73 & @AmoebeLabs - and whomever may know something about this card.

Thereā€™s a billion things I need to understandā€¦ but to ask 1 thing that puzzles meā€¦

On the website - looking at the documentation for lightsā€¦ I see an example card that calls a decluttering templateā€¦

  1. how the devil do I interpret the template?
  2. having installed the example dashboard(s) ā€¦ and playing around with thatā€¦ I notice that in the dashboard examples the decluttering template is NOT used - all the template code is directly in the example yaml?
    I took the code from the example and made a template fileā€¦ and after moving stuff around so indentation etc. was correct I can use that template in my card.

I must sayā€¦ the learning curve for this is hugeā€¦ at least when youā€™re not a template/css guruā€¦

92% of everything I do not understandā€¦

Hi, I installed the Examples dashboards and the sake5 is working but when i use it on my dashboard ā€œstorageā€ de card only shows when I do a refresh on sake5 page.
On my phone nevers appears on my dashboard.

Can anyone help?
I canā€™t put the
sak_sys_templates:
!include www/community/swiss-army-knife-card/sak_templates.yaml
sak_user_templates:
!include lovelace/sak_templates/sak_templates.yaml
on my ui dashboard because its not YAML

Hello, I donā€™t have the same as osvaldocipriano, but itā€™s close.
I cannot get the cards to work at all. I also use ā€œstorage modeā€
In the installation, I get to step 2b and donā€™t know where to put the sak_sys_templates: !include and the sak_user_templates: !include.
I tried putting in the raw edit of the Lovelace UI, but Iā€™m not able to save them there.
When I save them, I get the error ā€œYAML Exception: unknown tag !<!include>ā€.
So any help please!

If you are using this magnificent card, you have probably noticed that it doesnā€™t work since upgrading to Home Assistant 2023.4.0 or above. Well, have no fear, for I have found the issue.

This appears to be caused by a change in 2023.4.0 that makes custom-card-tools (which swiss-army-knife-card uses) break. I have a pull request in against custom-card-tools to fix this here:

In the meantime, to get swiss-army-knife-card working, you can grab the file from here:

https://raw.githubusercontent.com/cerebrate/custom-card-helpers/master/dist/index.m.js

place it in the www/community/swiss-army-knife-card/ directory under your Home Assistant configuration directory under the name custom-card-helpers.m.js, and then very carefully find the part at the top of swiss-army-knife-card.js in the same directory that reads

import{fireEvent,stateIcon,getLovelace}from"https://unpkg.com/[email protected]/dist/index.m.js?module";

and change that and only that to

import{fireEvent,stateIcon,getLovelace}from"/local/community/swiss-army-knife-card/custom-card-helpers.m.js?module";

Since the browser will use the compressed version of the .js file if it can, after you have edited swiss-army-knife-card.js, delete swiss-army-knife-card.js.gz, and then make a new compressed version of your edited file with

gzip -k swiss-army-knife-card.js

Donā€™t omit the -k, because you need both the .js and the .js.gz there. Youā€™ll need to do this any time you edit the .js.

Clear caches, reload resources, refresh, etc., and otherwise do the needful to get your browser to notice the changes, and you should have a working swiss-army-knife-card again.

Hope this is of use.

3 Likes

try to get this work but no luckā€¦

on my location
\192.168.x.x\config\www\community\swiss-army-knife-card
I put the custom-card-helpers.m.js module

in the swiss-army-knife-card.js

I had the rule changed to
import{fireEvent,stateIcon,getLovelace}from"/local/community/swiss-army-knife-card/custom-card-helpers.m.js?module";

but also to
import{fireEvent,stateIcon,getLovelace}from"/config/www/community/swiss-army-knife-card/custom-card-helpers.m.js?module"

without any luckā€¦

on my github put the helpers file should be okay in my opinion.
Github dvine2000

reboot, reload and try other browser nothing makes this fix workā€¦
I think I do something wrong

back to old version with this line
import{fireEvent,stateIcon,getLovelace}from"/config/www/community/swiss-army-knife-card/custom-card-helpers.m.js?module"

and cards are workingā€¦

So think to location and helpers.n.js are working and okay

Just realized after people couldnā€™t get this to work that I accidentally forgot to mention a step. If youā€™re having trouble with this, check you did the gzip step Iā€™ve edited into the above procedure.

1 Like

yes that seems to work.

I did it with 7-zip in windows there is a option to archive to .gz
lots of clear cache, restarts needed but goog to go now.

Question,
when I implement e toggle switch, always when I click on it, the -more dialog- box pops up. So instead of toggling the switch, the dialog box pops up and there I can turn the switch. I used helper switch, real switch but no succes.

- toolset: colomn-XAB
          position:
            cx: 150
            cy: 145
          tools:
            - type: switch   
              entity_index: 6                # #3
              position:
                cx: 50
                cy: 50
                # track:
                #   width: 100
                #   height: 30
                #   radius: 1
                # thumb:
                #   width: 25
                #   height: 25
                #   radius: 1
                #   offset: 12
                orientation: 'horizontal'
              user_actions:
              tap_action:
                haptic: light
                actions:
                  - action: call-service
                    service: switch.toggle       

wehereas entity_index 6 =


      # 6 als test switch, weer te verwijderen bij werkende config
      - entity: switch.ac_1c1331f_3

Thanks for any help

Indentation errorā€¦ fixed it. tap_action was not correct indeted

user_actions:
     tap_action:
          haptic: light
          actions:
              - action: call-service
                service: switch.toggle      

Works like a charm !

1 Like

Did you manage to use the new function which allows to have several entity_index:? I canā€™t get it to work.

          - type: state
            position:
              cx: 82
              cy: 60
            entity_indexes:
              - entity_index: 6
              - entity_index: 7
              - entity_index: 8
              - entity_index: 9
              - entity_index: 10
              - entity_index: 11
              - entity_index: 12
              - entity_index: 13
            show:
              uom: none
            derived_entity:
              state: |
                [[[ if (state == 'cool') return 'Climatisation'
                    if (state == 'heat') return 'Chauffage'
                    if (state == 'dry') return 'DĆ©shumidification'
                    if (state == 'off') return 'Hors fonction'
                    return 'Inconnu'
                ]]]
            styles:
              state:
                text-anchor: start
                font-size: 10em
                font-weight: 500
                opacity: 0.7
            animations:
              - state: 'off'
                entity_index: 7
                reuse: true 
                styles:
                  icon:
                    fill: gray
              - state: 'off'
                entity_index: 8
                reuse: true 
                styles:
                  icon:
                    fill: gray
              - state: 'off'
                entity_index: 9
                reuse: true 
                styles:
                  icon:
                    fill: gray
              - state: 'off'
                entity_index: 10
                reuse: true 
                styles:
                  icon:
                    fill: gray
              - state: 'off'
                entity_index: 11
                reuse: true 
                styles:
                  icon:
                    fill: gray
              - state: 'off'
                entity_index: 12
                reuse: true 
                styles:
                  icon:
                    fill: gray
              - state: 'off'
                entity_index: 13
                reuse: true 
                styles:
                  icon:
                    fill: gray

Iā€™m working on a thermostat card intended to mimic the nest thermostats, but have a couple of problems Iā€™m hoping someone out there will have some thoughts on.

  1. Wondering if anyone has any ideas on how I could add scale markers to either a circular slider or a segmented arc? The markers in the screenshot are colorlist items with a gap of 1. I put this in here so I could get a sense of the look and feel whilst I was working, but it would be awesome if someone could think of a way to get them at actual scale points (one line every half degree, for example). The nest thermostat also uses slightly bolder lines for the markers between the actual and target temperatures, so Iā€™m hoping getting standard markers will get me one step closer to achieving that.

  2. Iā€™m assuming that because Iā€™ve not seen any in the documentation that templating isnā€™t supported? Iā€™ve tested a template to return a different colour depending on whether the system is heating or cooling, but got a black background when I tried to replace the orange value with the template.

Thanks so much in advance for your help :slight_smile: