Borders - Cards in cards

I feel like this should be simple but it is eluding me…

Here is what I have:

card1

Here is the simplified code:

type: vertical-stack
cards:
  - type: entities
    style: |
      ha-card {
        background: rgba(0, 0, 0, 0);
        box-shadow: none;
      }
    entities:
      ... Entity 1, Entity 2 ...
  - type: horizontal-stack
    cards:
      ... Sun, Mon, Tue ...
	  
show_header_toggle: false
title: Card 1

Here is what I want it to look like:

card2

Can’t seem to get there.

In a nutshell, I want it to look like all my cards are grouped together in a single card.

Stack In Card maybe?

1 Like

I think I tried that and several other card types but I couldn’t figure out how to get the border around it all. It seems to me that all those types of custom cards are ways of organizing the cards that you put in them, but getting a border around the whole group is what I can’t figure out.

Don’t use a vertical stack card. Use an entities card with the custom:hui-element card.

Screenshot_2021-05-20 Overview - Home Assistant

card_mod:
  class: top-level-card
entities:
  - entity: switch.zone_3
    name: Sprinkler Valve
    type: 'custom:multiple-entity-row'
    toggle: true
    state_color: true
    entities:
      - entity: binary_sensor.zone_3_day_active
        name: Day Active
      - entity: sensor.zone_3_time_remaining
        name: Remaining
  - entity: automation.irrigation_zone_3_am
    name: Enable AM Schedule
    type: 'custom:multiple-entity-row'
    toggle: true
    state_color: true
    entities:
      - entity: input_datetime.zone_3_am_on_time
      - entity: input_number.zone_3_run_time
  - entity: automation.irrigation_zone_3_pm
    name: Enable PM Schedule
    type: 'custom:multiple-entity-row'
    toggle: true
    state_color: true
    entities:
      - entity: input_datetime.zone_3_pm_on_time
      - entity: input_number.zone_3_run_time
  - card_type: horizontal-stack
    cards:
      - entity: input_boolean.zone_3_mon
        name: Mon
        template: day_button
        type: 'custom:button-card'
      - entity: input_boolean.zone_3_tue
        name: Tue
        template: day_button
        type: 'custom:button-card'
      - entity: input_boolean.zone_3_wed
        name: Wed
        template: day_button
        type: 'custom:button-card'
      - entity: input_boolean.zone_3_thu
        name: Thu
        template: day_button
        type: 'custom:button-card'
      - entity: input_boolean.zone_3_fri
        name: Fri
        template: day_button
        type: 'custom:button-card'
      - entity: input_boolean.zone_3_sat
        name: Sat
        template: day_button
        type: 'custom:button-card'
      - entity: input_boolean.zone_3_sun
        name: Sun
        template: day_button
        type: 'custom:button-card'
    type: 'custom:hui-element'
show_header_toggle: false
title: Garden Beds
type: entities
3 Likes

Thank you!!! That was exactly what I was looking for.

As with most HA issues I have had, when I find the answer to one question, 3 more pop up. Care to share your “day_button” template? I think I know the code but trying to clean things up and figure out how to implement it like you have (i.e. where to put it and in what format). Right now, I have:

     - entity: input_boolean.zone_1_mon
        name: Mon
        styles:
          card:
            - font-size: 12px
        state:
          - icon: 'mdi:cancel'
            value: 'off'
          - icon: 'mdi:check-circle'
            styles:
              card:
                - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
            value: 'on'
        type: 'custom:button-card'
2 Likes
  day_button:
    color_type: icon
    hold_action:
      action: none
    show_label: false
    show_name: true
    show_state: false
    state:
      - icon: 'mdi:checkbox-marked-circle'
        styles:
          card:
            - border: solid 1px var(--paper-item-icon-active-color)
            - box-shadow: 0px 0px 10px 3px var(--paper-item-icon-active-color)
          name:
            - color: var(--primary-text-color)
        value: 'on'
      - icon: 'mdi:cancel'
        styles: null
        value: 'off'
    styles:
      card:
        - border-radius: 10px
        - border: solid 1px var(--primary-color)
        - box-shadow: none
        - padding: 6px 0px
        - margin: 0px 0px
        - '--ha-card-background': 'rgba(0, 0, 0, 0)'
      grid:
        - grid-template-areas: '"i" "n"'
        - grid-template-rows: 33% auto
        - grid-template-columns: auto
      icon:
        - width: 28px
      name:
        - justify-self: middle
        - align-self: end
        - font-size: 14px
        - padding: 0px 0px
        - color: var(--secondary-text-color)
    tap_action:
      action: toggle
3 Likes

Thanks again.

The posts on your irrigation system have been extremely helpful. Saved me tons of time.

What type of controller do you use to control the sprinkler valves?

An ESP32 mini board running ESPHome and a few relay modules driving 24VAC garden irrigation valves you can buy at any hardware store.

The 24VAC plug pack to drive the valves is pretty much universally available too.

EDIT:

EspHome config:

esphome:
  name: irrigation_controller
  platform: ESP32
  board: mhetesp32minikit

wifi:
  ssid: 'WAPRU'
  password: !secret wifi_pwd
  manual_ip:
    static_ip: 10.1.1.89
    gateway: 10.1.1.1
    subnet: 255.255.255.0

api:
  password: !secret api_password

logger:
  level: WARN

ota:
  password: !secret esp_pwd

esp32_ble_tracker:
  scan_parameters:
    active: false

sensor:
  - platform: wifi_signal
    name: "Irrigation WiFi Signal"
    update_interval: 4s
    filters:
      - sliding_window_moving_average:
          window_size: 15
          send_every: 15
          send_first_at: 1

  - platform: xiaomi_hhccjcy01
    mac_address: 'C4:7C:8D:6B:12:1F'
    temperature:
      name: "Lawn Temperature"
    moisture:
      name: "Lawn Moisture"
    illuminance:
      name: "Lawn Illuminance"
    conductivity:
      name: "Lawn Soil Conductivity"
#    battery_level:
#      name: "Lawn Battery Level"

  - platform: ble_rssi
    mac_address: C4:7C:8D:6B:12:1F
    name: "Moisture Sensor RSSI"
    icon: mdi:bluetooth
    filters:
      - sliding_window_moving_average:
          window_size: 15
          send_every: 15
          send_first_at: 1

binary_sensor:
  - platform: status
    name: "Irrigation Status"

switch:
  - platform: gpio
    pin:
      number: GPIO17
    name: "Zone 1"
    icon: mdi:sprinkler
  - platform: gpio
    pin:
      number: GPIO27
    name: "Zone 2"
    icon: mdi:sprinkler
  - platform: gpio
    pin:
      number: GPIO32
    name: "Zone 3"
    icon: mdi:sprinkler

  - platform: restart
    name: "Irrigation Restart"

Yeah, I have a similar setup in the works. WEMOS D1 Mini driving 5 relays. Was trying to figure out a good failsafe in case HA crashed with a valve on and I was out of town. Think I just figured it out. The D1 is flashed with Tasmota and I think I can set a timeout on each relay using the pulsetime command. Need to do some testing to make sure.

Haven’t explored ESPHome yet. Most of my nodes are either Tasmota or custom firmware using MQTT.

Has that xiaomi sensor (MiFlora?) been reliable and useful?

Reliable?

No, not until I hacked it out of its case and put it in another waterproof box with more batteries and a larger antenna.

Since then it has been perfectly reliable.

And yeah it has been useful. It prevents my irrigation cycles running if the lawn moisture content is above 40%. A value I came to by trial and error that is highly dependant on where and how it is stabbed into the lawn.

Hi tom_I. Very like your card. I’m newbie and don’t understand how to do this. Can you share the code of several entities:
binary_sensor.zone_3_day_active,
sensor.zone_3_time_remaining,
automation.irrigation_zone_3_am,
input_datetime.zone_3_am_on_time,
input_number.zone_3_run_time,
input_boolean.zone_3_mon
Thanks you so much!

It is all available in this topic:

Thanks for your share! It worked fine.Test

1 Like

hi,

probably a newbie question, but I am trying to replicate this solution but I don’t know where to put this “template code”? in the dashboard yaml file? if so, where exactly?

thanks
Christian

I’m no expert, so there could be a more appropriate location, but it worked when I did this:

  • Home Screen
  • Click 3 vertical dots and select “Edit Dashboard”
  • Click 3 vertical dots and select “Raw configuration editor”
  • Paste the template code at the end