Help in UI re-styling

Hello, I’m trying to create an UI for my Netro Sprinkler, but the result is very odd and awful.
Any help in formatting it? I would like to create a table with text, buttons and input_numbers.

##################################
 # IRRIGAZIONE
 ##################################
  - badges: []
    panel: true
    visible: true
    path: irrigazione
    title: Irrigazione
    entities:
      - sensor.centralina_irrigazione
    cards:
      - type: vertical-stack
        cards:
               - type: horizontal-stack
                 cards:
                   - type: markdown
                     content: >-
                      {{ states['sensor.centralina_irrigazione'].attributes.DeviceName }}
                   - card:
                       entity: sensor.centralina_irrigazione
                       image: '${states[''sensor.centralina_irrigazione''].attributes.StatusImage}'
                       type: 'custom:hui-image-element'
                       style:
                         top: 45%
                         left: 35%
                         width: 5%
                         height: 5%
                         transform: translate(0%,2%)
                     entities:
                       - sensor.centralina_irrigazione
                     type: 'custom:config-template-card'
               - type: horizontal-stack
                 cards:
                    - type: vertical-stack
                      cards:
                       - type: markdown
                         content: "Zona"
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone1Name }}
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone2Name }}
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone3Name }}
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone4Name }}
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone5Name }}
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone6Name }}
                    - type: vertical-stack
                      cards:
                       - type: markdown
                         content: "Innaffiata"
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone1Watered }}
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone2Watered }}
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone3Watered }}
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone4Watered }}
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone5Watered }}
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone6Watered }}
                    - type: vertical-stack
                      cards:
                       - type: markdown
                         content: "Prossimo ciclo"
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone1Next }}
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone2Next }}
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone3Next }}
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone4Next }}
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone5Next }}
                       - type: markdown
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone6Next }}
                    - type: vertical-stack
                      cards:
                       - type: markdown
                         content: "Minuti"
                       - entities:
                                - entity: input_number.minuti_zona_1
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         type: entities
                       - entities:
                                - entity: input_number.minuti_zona_2
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         type: entities
                       - entities:
                                - entity: input_number.minuti_zona_3
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         type: entities
                       - entities:
                                - entity: input_number.minuti_zona_4
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         type: entities
                       - entities:
                                - entity: input_number.minuti_zona_5
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         type: entities
                       - entities:
                                - entity: input_number.minuti_zona_6
                         style: |
                                  ha-card {
                                    height: 70px
                                  }        
                         padding: '0px'                                  
                         type: entities
                    - type: 'custom:config-template-card'    
                      entities:
                        - input_number.minuti_zona_1
                        - input_number.minuti_zona_2
                        - input_number.minuti_zona_3
                        - input_number.minuti_zona_4
                        - input_number.minuti_zona_5
                        - input_number.minuti_zona_6
                      card:
                         type: vertical-stack
                         cards:
                               - type: markdown
                                 content: "Innaffia"
                               - type: 'custom:button-card'
                                 style: |
                                          ha-card {
                                            height: 70px
                                          }        
                                 padding: '0px'                                  
                                 icon: 'mdi:water-pump'
                                 icon_height: 40px
                                 tap_action:
                                   action: call-service
                                   service: script.water_a_zone
                                   data_template:
                                     zona: 1
                                     minuti: >
                                        [[[ return states['input_number.minuti_zona_1'].state | 0; ]]]
                               - type: 'custom:button-card'
                                 style: |
                                          ha-card {
                                            height: 70px
                                          }        
                                 padding: '0px'                                  
                                 icon: 'mdi:water-pump'
                                 icon_height: 40px
                                 tap_action:
                                   action: call-service
                                   service: script.water_a_zone
                                   service_data:
                                     zona: 2
                                     minuti: >
                                        [[[ return states['input_number.minuti_zona_2'].state | 0; ]]]
                               - type: 'custom:button-card'
                                 style: |
                                          ha-card {
                                            height: 70px
                                          }        
                                 padding: '0px'                                  
                                 icon: 'mdi:water-pump'
                                 icon_height: 40px
                                 tap_action:
                                   action: call-service
                                   service: script.water_a_zone
                                   service_data:
                                     zona: 3
                                     minuti: >
                                        [[[ return states['input_number.minuti_zona_3'].state | 0; ]]]
                               - type: 'custom:button-card'
                                 style: |
                                          ha-card {
                                            height: 70px
                                          }        
                                 padding: '0px'                                  
                                 icon: 'mdi:water-pump'
                                 icon_height: 40px
                                 tap_action:
                                   action: call-service
                                   service: script.water_a_zone
                                   service_data:
                                     zona: 4
                                     minuti: >
                                        [[[ return states['input_number.minuti_zona_4'].state | 0; ]]]
                               - type: 'custom:button-card'
                                 style: |
                                          ha-card {
                                            height: 70px
                                          }        
                                 padding: '0px'                                  
                                 icon: 'mdi:water-pump'
                                 icon_height: 40px
                                 tap_action:
                                   action: call-service
                                   service: script.water_a_zone
                                   service_data:
                                     zona: 5
                                     minuti: >
                                        [[[ return states['input_number.minuti_zona_5'].state | 0; ]]]
                               - type: 'custom:button-card'
                                 style: |
                                          ha-card {
                                            height: 70px
                                          }        
                                 padding: '0px'                                  
                                 icon: 'mdi:water-pump'
                                 icon_height: 40px
                                 tap_action:
                                   action: call-service
                                   service: script.water_a_zone
                                   service_data:
                                     zona: 6
                                     minuti: >
                                        [[[ return states['input_number.minuti_zona_6'].state | 0; ]]]

could you be more specific? I can already see a table with some text, icons and input_numbers

  • Image is too big… style doesn’t work to reduce its size
  • Input numbers --> I cannot see the whole slider, label is hidden etc…
  • Table is not fitting column content, all columns are equal and I need to set the row height…

what image?

fix your style then

it might happen if you put a lot of entities horizontally. change your input_numbers to box or redesign your layout?

afaik using standard stacks you can do nothing about it.
have you tried layout-card to get control of your layout?

The image with watering is too big and style doesn’t seem to affect its size…

well, it’s all about where you put it.
styling might be a tricky thing as you need to know well what you’re doing (sometimes it’s even impossible).

I pasted the code of the full view. Could you check what’s wrong?

Definitely better with layout-card… but still issues :frowning:

 ##################################
 # IRRIGAZIONE
 ##################################
  - badges: []
    panel: true
    visible: true
    path: irrigazione
    title: Irrigazione
    entities:
      - sensor.centralina_irrigazione
    cards:
      - type: custom:layout-card
        layout: vertical
        column_width: 100%
        cards:
          - type: markdown
            content: >-
                {{ states['sensor.centralina_irrigazione'].attributes.DeviceName }}
          - type: custom:layout-card
            layout: grid
            gridrows: 120px 50px 50px 50px 50px 50px 50px 50px 50px 
            gridcols: 120px 120px 140px 500px 120px
            cards:
              - card:
                   entity: sensor.centralina_irrigazione
                   image: '${states[''sensor.centralina_irrigazione''].attributes.StatusImage}'
                   type: 'custom:hui-image-element'
                entities:
                   - sensor.centralina_irrigazione
                type: 'custom:config-template-card'
                gridrow: 1 
                gridcol: 1 
                style: "ha-card { height: 100%; }"
              - type: entities
                entities: 
                  - sensor.centralina_irrigazione
                gridrow: 1 
                gridcol: 2 / 6
                style: "ha-card { height: 100%; }"
                #######################
                # ZONE
                #######################
              - type: markdown
                content: "Zona"
                padding: '0px'                                  
                gridrow: 2
                gridcol: 1
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                  {{ states['sensor.centralina_irrigazione'].attributes.Zone1Name }}
                padding: '0px'                                  
                gridrow: 3
                gridcol: 1
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                  {{ states['sensor.centralina_irrigazione'].attributes.Zone2Name }}
                padding: '0px'                                  
                gridrow: 4
                gridcol: 1
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                  {{ states['sensor.centralina_irrigazione'].attributes.Zone3Name }}
                padding: '0px'                                  
                gridrow: 5
                gridcol: 1
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                  {{ states['sensor.centralina_irrigazione'].attributes.Zone4Name }}
                padding: '0px'                                  
                gridrow: 6
                gridcol: 1
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                  {{ states['sensor.centralina_irrigazione'].attributes.Zone5Name }}
                padding: '0px'                                  
                gridrow: 7
                gridcol: 1
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                  {{ states['sensor.centralina_irrigazione'].attributes.Zone6Name }}
                padding: '0px'                                  
                gridrow: 8
                gridcol: 1
                style: "ha-card { height: 100%; }"
                #######################
                # INNAFFIATA
                #######################
              - type: markdown
                content: "Innaffiata"
                padding: '0px'                                  
                gridrow: 2
                gridcol: 2
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone1Watered }}
                padding: '0px'                                  
                gridrow: 3
                gridcol: 2
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone2Watered }}
                padding: '0px'                                  
                gridrow: 4
                gridcol: 2
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone3Watered }}
                padding: '0px'                                  
                gridrow: 5
                gridcol: 2
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone4Watered }}
                padding: '0px'                                  
                gridrow: 6
                gridcol: 2
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone5Watered }}
                padding: '0px'                                  
                gridrow: 7
                gridcol: 2
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone6Watered }}
                padding: '0px'                                  
                gridrow: 8
                gridcol: 2
                style: "ha-card { height: 100%; }"
                #######################
                # PROSSIMO CICLO
                #######################
              - type: markdown
                content: "Prossimo ciclo"
                padding: '0px'                                  
                gridrow: 2
                gridcol: 3
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone1Next }}
                padding: '0px'                                  
                gridrow: 3
                gridcol: 3
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone2Next }}
                padding: '0px'                                  
                gridrow: 4
                gridcol: 3
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone3Next }}
                padding: '0px'                                  
                gridrow: 5
                gridcol: 3
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone4Next }}
                padding: '0px'                                  
                gridrow: 6
                gridcol: 3
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone5Next }}
                padding: '0px'                                  
                gridrow: 7
                gridcol: 3
                style: "ha-card { height: 100%; }"
              - type: markdown
                content: >-
                          {{ states['sensor.centralina_irrigazione'].attributes.Zone6Next }}
                padding: '0px'                                  
                gridrow: 8
                gridcol: 3
                style: "ha-card { height: 100%; }"
                #######################
                # MINUTI
                #######################
              - type: markdown
                content: "Minuti"
                padding: '0px'                                  
                gridrow: 2
                gridcol: 4
                style: "ha-card { height: 100%; }"
              - type: entities
                entities:
                    - entity: input_number.minuti_zona_1
                padding: '0px'                                  
                gridrow: 3
                gridcol: 4
                style: "ha-card { height: 100%; }"
              - type: entities
                entities:
                    - entity: input_number.minuti_zona_2
                padding: '0px'                                  
                gridrow: 4
                gridcol: 4
                style: "ha-card { height: 100%; }"
              - type: entities
                entities:
                    - entity: input_number.minuti_zona_3
                padding: '0px'                                  
                gridrow: 5
                gridcol: 4
                style: "ha-card { height: 100%; }"
              - type: entities
                entities:
                    - entity: input_number.minuti_zona_4
                padding: '0px'                                  
                gridrow: 6
                gridcol: 4
                style: "ha-card { height: 100%; }"
              - type: entities
                entities:
                    - entity: input_number.minuti_zona_5
                padding: '0px'                                  
                gridrow: 7
                gridcol: 4
                style: "ha-card { height: 100%; }"
              - type: entities
                entities:
                    - entity: input_number.minuti_zona_6
                padding: '0px'                                  
                gridrow: 8
                gridcol: 4
                style: "ha-card { height: 100%; }"
                #######################
                # BOTTONI
                #######################
              - type: markdown
                content: "Innaffia"
                padding: '0px'                                  
                gridrow: 2
                gridcol: 5
                style: "ha-card { height: 100%; }"
              - type: custom:config-template-card
                entities:
                    - sensor.centralina_irrigazione
                    - input_number.minuti_zona_1
                padding: '0px'                                  
                gridrow: 3
                gridcol: 5
                style: "ha-card { height: 100%; }"
                card:
                     type: 'custom:button-card'
                     padding: '0px'                                  
                     icon: "${ states['sensor.centralina_irrigazione'].state === 'Innaffiando' ? 'mdi:water-off' : 'mdi:water' }"
                     tap_action:
                       action: call-service
                       service: script.water_a_zone
                       data_template:
                         zona: 1
                         minuti: >
                            [[[ return states['input_number.minuti_zona_1'].state | 0; ]]]
              - type: custom:config-template-card
                entities:
                    - sensor.centralina_irrigazione
                    - input_number.minuti_zona_2
                padding: '0px'                                  
                gridrow: 4
                gridcol: 5
                style: "ha-card { height: 100%; }"
                card:
                     type: 'custom:button-card'
                     padding: '0px'                                  
                     icon: "${ states['sensor.centralina_irrigazione'].state === 'Innaffiando' ? 'mdi:water-off' : 'mdi:water' }"
                     tap_action:
                       action: call-service
                       service: script.water_a_zone
                       data_template:
                         zona: 2
                         minuti: >
                            [[[ return states['input_number.minuti_zona_2'].state | 0; ]]]
              - type: custom:config-template-card
                entities:
                    - sensor.centralina_irrigazione
                    - input_number.minuti_zona_3
                padding: '0px'                                  
                gridrow: 5
                gridcol: 5
                style: "ha-card { height: 100%; }"
                card:
                     type: 'custom:button-card'
                     padding: '0px'                                  
                     icon: "${ states['sensor.centralina_irrigazione'].state === 'Innaffiando' ? 'mdi:water-off' : 'mdi:water' }"
                     tap_action:
                       action: call-service
                       service: script.water_a_zone
                       data_template:
                         zona: 3
                         minuti: >
                            [[[ return states['input_number.minuti_zona_3'].state | 0; ]]]
              - type: custom:config-template-card
                entities:
                    - sensor.centralina_irrigazione
                    - input_number.minuti_zona_4
                padding: '0px'                                  
                gridrow: 6
                gridcol: 5
                style: "ha-card { height: 100%; }"
                card:
                     type: 'custom:button-card'
                     padding: '0px'                                  
                     icon: "${ states['sensor.centralina_irrigazione'].state === 'Innaffiando' ? 'mdi:water-off' : 'mdi:water' }"
                     tap_action:
                       action: call-service
                       service: script.water_a_zone
                       data_template:
                         zona: 4
                         minuti: >
                            [[[ return states['input_number.minuti_zona_4'].state | 0; ]]]
              - type: custom:config-template-card
                entities:
                    - sensor.centralina_irrigazione
                    - input_number.minuti_zona_5
                padding: '0px'                                  
                gridrow: 7
                gridcol: 5
                style: "ha-card { height: 100%; }"
                card:
                     type: 'custom:button-card'
                     padding: '0px'                                  
                     icon: "${ states['sensor.centralina_irrigazione'].state === 'Innaffiando' ? 'mdi:water-off' : 'mdi:water' }"
                     tap_action:
                       action: call-service
                       service: script.water_a_zone
                       data_template:
                         zona: 5
                         minuti: >
                            [[[ return states['input_number.minuti_zona_5'].state | 0; ]]]
              - type: custom:config-template-card
                entities:
                    - sensor.centralina_irrigazione
                    - input_number.minuti_zona_6
                padding: '0px'                                  
                gridrow: 8
                gridcol: 5
                style: "ha-card { height: 100%; }"
                card:
                     type: 'custom:button-card'
                     padding: '0px'                                  
                     icon: "${ states['sensor.centralina_irrigazione'].state === 'Innaffiando' ? 'mdi:water-off' : 'mdi:water' }"
                     tap_action:
                       action: call-service
                       service: script.water_a_zone
                       data_template:
                         zona: 6
                         minuti: >
                            [[[ return states['input_number.minuti_zona_6'].state | 0; ]]]

@AhmadK How can I reduce the padding/space from cell borders? padding parameter doesn’t seem to work…

well, I’d suggest opening Inspector and experimenting.
I don’t use layout-card myself, still thinking about it so cannot provide you with a solution right now.

Hi Stefano,

Did you integrate your Netro controller with HA? if yes, could you share how?

Thanks.