Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support templating the sak tools within a toolset #1

Closed
AmoebeLabs opened this issue Oct 4, 2020 · 1 comment
Closed

Support templating the sak tools within a toolset #1

AmoebeLabs opened this issue Oct 4, 2020 · 1 comment
Assignees
Labels
before release enhancement New feature or request

Comments

@AmoebeLabs
Copy link
Owner

AmoebeLabs commented Oct 4, 2020

The Problem To Be Solved

Describing all the elements of a SAK card, ie all the toolsets and tools can be a lot of yaml. To minimize this makes maintenance and creating a complex card with repeated tools a lot easier.

So the problem to be solved is not on a card level, but on a deeper level. The decluttering template card can't be used for templating assemblies and tools.

(Optional): Suggested Solution

The decluttering card shows how templates can be implemented. The idea is to use that format to be able to template sak-tools as part of sak-toolsets.

A simple test (2020.09.30) shows that this is possible:

if (this.config.templates) {
	if (this.config.toolsets) {
		let tools= Templates.replaceVariables(this.config.toolsets[1].variables,
                                       this.config.templates[0]);
		console.log('template, tools are: ', tools);
	}
}

with the following yaml to define the card templates:

templates:
  # Define template for an assembly with 3 tools
  - template: template1
    defaults: 
      - entity0: 0
      - entity1: 1
      - entity2: 2
    tools:
      - tool: state
         id: 4
         entity_index: '[[entity0]]'
      - tool: state
         id: 5
         entity_index: '[[entity1]]'
      - tool: state
         id: 6
         entity_index: '[[entity2]]'

toolsets:
  # Both toolsets use the first template
  - toolset: toolset1
     template: template1
      position:
        xpos: 25
        ypos: 60

  - toolset: toolset2
    template: template1
    position:
       xpos: 12.5
       ypos: 60
       variables:
         - entity0: 3
         - entity1: 4
         - entity2: 5
@AmoebeLabs AmoebeLabs added the enhancement New feature or request label Oct 4, 2020
@AmoebeLabs AmoebeLabs self-assigned this Oct 6, 2020
@AmoebeLabs AmoebeLabs changed the title Support templating the sak tools within a (tool) assembly Support templating the sak tools within a toolset Oct 14, 2020
@AmoebeLabs
Copy link
Owner Author

Using the name 'toolset' for a group of 'tools'

@AmoebeLabs AmoebeLabs added this to the Public release milestone Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
before release enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant