thomasloven / lovelace-state-switch

🔹Dynamically replace lovelace cards depending on occasion
MIT License
382 stars 27 forks source link

State-Switch inside config-template-card doesn't work #104

Closed Veuchez closed 1 year ago

Veuchez commented 1 year ago

State-Switch inside config-template-card doesn't work, I don't see anything. If I remove " ${LANG_STATE..." the card works again but I lose the functionality of config-template-card. Here is an excerpt of my code. Am I doing something wrong?

type: custom:config-template-card
variables:
  LANG_STATE: states['input_select.smarther_cucina_language'].state
entities:
  - input_select.smarther_cucina_mode
  - input_select.smarther_cucina_language
card:
  type: custom:layout-card
  layout_type: grid
  layout_options:
    grid-template-columns: 67% 5% 28%
    grid-template-rows: auto
    margin: 0
  cards:
    - type: custom:state-switch
      entity: input_select.smarther_cucina_mode
      states:
        temperature:
          type: custom:apexcharts-card
          card_mod:
            style: |
              ha-card {
              background:none;
              border:0;
              border-radius:10px 0 0 10px!important;
              box-shadow:none;
              transition:none
              }
          graph_span: 24h
          header:
            show: true
            show_states: true
            colorize_states: false
            title: |
              ${LANG_STATE === 'EN' ? 'TEMPERATURE' : LANG_STATE === 'IT' ?
              'TEMPERATURA' : 'no language'}
          entities:
            - entity: sensor.smarther_cucina_temperatura
              type: area
              color: orange
              name: |
                ${LANG_STATE === 'EN' ? 'Thermostat cucina' : LANG_STATE ===
                'IT' ? 'Termostato cucina' : 'no language'}
              show:
                extremas: true
          apex_config:
            chart:
              height: 190px
              width: 100%
            tooltip:
              enabled: false
            stroke:
              width: 2
              curve: smooth
            fill:
              type: gradient
              gradient:
                type: vertical
                shadeIntensity: 0
                opacityFrom: 1
                opacityTo: 0
                stops:
                  - 0
                  - 98
                  - 100
            grid:
              show: true
              yaxis:
                lines:
                  show: true
              xaxis:
                lines:
                  show: true
            xaxis:
              axisBorder:
                show: false
                offsetX: -3
              forceNiceScale: true
              labels:
                offsetY: -3
                hideOverlappingLabels: true
                trim: false
                style:
                  fontSize: 11
                axisTicks:
                  tickAmount: dataPoints
                datetimeFormatter:
                  hour: H
                  day: d/M
            yaxis:
              axisBorder:
                show: false
                offsetX: 0
                height: 0
              decimalsInFloat: 1
              forceNiceScale: true
              labels:
                hideOverlappingLabels: false
                trim: false
                style:
                  fontSize: 11
                axisTicks:
                  tickAmount: dataPoints
ildar170975 commented 1 year ago

You mixed FOUR cards in a code which is supposed to be a Minimal Working Example.

Veuchez commented 1 year ago

And it's not okay? are there any limits?

ildar170975 commented 1 year ago

Minimal Working Example - a code demonstrating an issue. If you dealt with a software development you know what is a SW testing & localizing a problem. What you posted is a complex code w/o any attempts to localize the issue.

Veuchez commented 1 year ago

I solved it was my coding problem. Sorry for the waste of time.