{
  "version": 1,
  "minor_version": 1,
  "key": "lovelace.dashboard_grow",
  "data": {
    "config": {
      "views": [
        {
          "title": "Mission Control",
          "type": "sections",
          "max_columns": 2,
          "badges": [
            {
              "type": "entity",
              "entity": "sensor.spider_farmer_80f1b2b3b64a_temperature"
            },
            {
              "type": "entity",
              "entity": "sensor.spider_farmer_80f1b2b3b64a_humidity"
            },
            {
              "type": "entity",
              "entity": "sensor.spider_farmer_80f1b2b3b64a_vpd"
            },
            {
              "type": "entity",
              "entity": "sensor.grow_tent_power"
            }
          ],
          "sections": [
            {
              "type": "grid",
              "cards": [
                {
                  "type": "heading",
                  "heading": "Surveillance & Environment"
                },
                {
                  "type": "custom:advanced-camera-card",
                  "cameras": [
                    {
                      "camera_entity": "camera.tapo_c100_mainstream",
                      "live_provider": "ha"
                    }
                  ],
                  "view": {
                    "default": "live"
                  },
                  "menu": {
                    "buttons": {
                      "frigate": {
                        "enabled": false
                      },
                      "timeline": {
                        "enabled": false
                      }
                    }
                  }
                },
                {
                  "type": "heading",
                  "heading": "Plant Health"
                },
                {
                  "type": "horizontal-stack",
                  "cards": [
                    {
                      "type": "custom:stack-in-card",
                      "cards": [
                        {
                          "type": "custom:mushroom-template-card",
                          "primary": "P1",
                          "secondary": "{{ '⚠️' if is_state('plant.grow_plant_1', 'problem') else '✅' }}",
                          "icon": "mdi:flower",
                          "icon_color": "{{ 'red' if is_state('plant.grow_plant_1', 'problem') else 'green' }}",
                          "layout": "vertical"
                        },
                        {
                          "type": "custom:mushroom-chips-card",
                          "alignment": "center",
                          "chips": [
                            {
                              "type": "entity",
                              "entity": "sensor.grow_plant_1_soil_moisture",
                              "icon": "mdi:water-percent"
                            },
                            {
                              "type": "entity",
                              "entity": "sensor.grow_plant_1_soil_fertility",
                              "icon": "mdi:sprout"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "custom:stack-in-card",
                      "cards": [
                        {
                          "type": "custom:mushroom-template-card",
                          "primary": "P2",
                          "secondary": "{{ '⚠️' if is_state('plant.grow_plant_2', 'problem') else '✅' }}",
                          "icon": "mdi:flower",
                          "icon_color": "{{ 'red' if is_state('plant.grow_plant_2', 'problem') else 'green' }}",
                          "layout": "vertical"
                        },
                        {
                          "type": "custom:mushroom-chips-card",
                          "alignment": "center",
                          "chips": [
                            {
                              "type": "entity",
                              "entity": "sensor.grow_plant_2_soil_moisture",
                              "icon": "mdi:water-percent"
                            },
                            {
                              "type": "entity",
                              "entity": "sensor.grow_plant_2_soil_fertility",
                              "icon": "mdi:sprout"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "custom:stack-in-card",
                      "cards": [
                        {
                          "type": "custom:mushroom-template-card",
                          "primary": "P3",
                          "secondary": "{{ '⚠️' if is_state('plant.grow_plant_3', 'problem') else '✅' }}",
                          "icon": "mdi:flower",
                          "icon_color": "{{ 'red' if is_state('plant.grow_plant_3', 'problem') else 'green' }}",
                          "layout": "vertical"
                        },
                        {
                          "type": "custom:mushroom-chips-card",
                          "alignment": "center",
                          "chips": [
                            {
                              "type": "entity",
                              "entity": "sensor.grow_plant_3_soil_moisture",
                              "icon": "mdi:water-percent"
                            },
                            {
                              "type": "entity",
                              "entity": "sensor.grow_plant_3_soil_fertility",
                              "icon": "mdi:sprout"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "custom:stack-in-card",
                      "cards": [
                        {
                          "type": "custom:mushroom-template-card",
                          "primary": "P4",
                          "secondary": "{{ '⚠️' if is_state('plant.grow_plant_4', 'problem') else '✅' }}",
                          "icon": "mdi:flower",
                          "icon_color": "{{ 'red' if is_state('plant.grow_plant_4', 'problem') else 'green' }}",
                          "layout": "vertical"
                        },
                        {
                          "type": "custom:mushroom-chips-card",
                          "alignment": "center",
                          "chips": [
                            {
                              "type": "entity",
                              "entity": "sensor.grow_plant_4_soil_moisture",
                              "icon": "mdi:water-percent"
                            },
                            {
                              "type": "entity",
                              "entity": "sensor.grow_plant_4_soil_fertility",
                              "icon": "mdi:sprout"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "type": "custom:stack-in-card",
                      "cards": [
                        {
                          "type": "custom:mushroom-template-card",
                          "primary": "P5",
                          "secondary": "{{ '⚠️' if is_state('plant.grow_plant_5', 'problem') else '✅' }}",
                          "icon": "mdi:flower",
                          "icon_color": "{{ 'red' if is_state('plant.grow_plant_5', 'problem') else 'green' }}",
                          "layout": "vertical"
                        },
                        {
                          "type": "custom:mushroom-chips-card",
                          "alignment": "center",
                          "chips": [
                            {
                              "type": "entity",
                              "entity": "sensor.grow_plant_5_soil_moisture",
                              "icon": "mdi:water-percent"
                            },
                            {
                              "type": "entity",
                              "entity": "sensor.grow_plant_5_soil_fertility",
                              "icon": "mdi:sprout"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "grid",
              "cards": [
                {
                  "type": "heading",
                  "heading": "Secondary Environment"
                },
                {
                  "type": "vertical-stack",
                  "cards": [
                    {
                      "type": "custom:apexcharts-card",
                      "graph_span": "48h",
                      "header": {
                        "show": true,
                        "title": "48h Klima-Vergleich (Geglättet)"
                      },
                      "yaxis": [
                        {
                          "id": "temp",
                          "min": 10,
                          "max": 35,
                          "apex_config": {
                            "tickAmount": 5
                          }
                        },
                        {
                          "id": "hum",
                          "opposite": true,
                          "min": 20,
                          "max": 100,
                          "apex_config": {
                            "tickAmount": 5
                          }
                        }
                      ],
                      "series": [
                        {
                          "entity": "sensor.spider_farmer_80f1b2b3b64a_temperature",
                          "name": "Zelt Temp",
                          "yaxis_id": "temp",
                          "stroke_width": 3,
                          "color": "#00ff00",
                          "group_by": {
                            "func": "avg",
                            "duration": "10m"
                          }
                        },
                        {
                          "entity": "sensor.0x00158d0002c9fa8b_temperature",
                          "name": "Außen Temp (ZB)",
                          "yaxis_id": "temp",
                          "stroke_width": 2,
                          "color": "darkgreen",
                          "group_by": {
                            "func": "avg",
                            "duration": "10m"
                          }
                        },
                        {
                          "entity": "sensor.spider_farmer_80f1b2b3b64a_humidity",
                          "name": "Zelt Hum",
                          "yaxis_id": "hum",
                          "stroke_width": 3,
                          "color": "#00bfff",
                          "group_by": {
                            "func": "avg",
                            "duration": "10m"
                          }
                        },
                        {
                          "entity": "sensor.0x00158d0002c9fa8b_humidity",
                          "name": "Außen Hum (ZB)",
                          "yaxis_id": "hum",
                          "stroke_width": 2,
                          "color": "#1a4b6e",
                          "group_by": {
                            "func": "avg",
                            "duration": "10m"
                          }
                        }
                      ],
                      "apex_config": {
                        "stroke": {
                          "curve": "smooth",
                          "dashArray": [
                            0,
                            5,
                            0,
                            5
                          ]
                        },
                        "legend": {
                          "show": true
                        },
                        "grid": {
                          "borderColor": "#333",
                          "strokeDashArray": 4
                        }
                      }
                    },
                    {
                      "type": "custom:apexcharts-card",
                      "graph_span": "48h",
                      "header": {
                        "show": true,
                        "title": "48h VPD Verlauf (kPa)"
                      },
                      "yaxis": [
                        {
                          "id": "vpd",
                          "min": 0,
                          "max": 2.5,
                          "decimals": 2,
                          "apex_config": {
                            "tickAmount": 5
                          }
                        }
                      ],
                      "series": [
                        {
                          "entity": "sensor.spider_farmer_80f1b2b3b64a_vpd",
                          "name": "Zelt VPD",
                          "yaxis_id": "vpd",
                          "stroke_width": 3,
                          "color": "#ff9800",
                          "group_by": {
                            "func": "avg",
                            "duration": "10m"
                          }
                        }
                      ],
                      "apex_config": {
                        "stroke": {
                          "curve": "smooth"
                        },
                        "annotations": {
                          "yaxis": [
                            {
                              "y": 0.8,
                              "y2": 1.2,
                              "borderColor": "#00ff00",
                              "fillColor": "#00ff00",
                              "opacity": 0.1,
                              "label": {
                                "text": "Optimum Veg",
                                "style": {
                                  "background": "#00ff00",
                                  "color": "#000"
                                }
                              }
                            }
                          ]
                        },
                        "legend": {
                          "show": true
                        },
                        "grid": {
                          "borderColor": "#333",
                          "strokeDashArray": 4
                        }
                      }
                    }
                  ]
                },
                {
                  "type": "grid",
                  "columns": 2,
                  "square": false,
                  "cards": [
                    {
                      "type": "custom:mushroom-entity-card",
                      "entity": "sensor.grow_env_sensor_1_temperature",
                      "name": "S1 Innen",
                      "icon_color": "orange"
                    },
                    {
                      "type": "custom:mushroom-entity-card",
                      "entity": "sensor.0x00158d0002c9fa8b_temperature",
                      "name": "ZB Außen",
                      "icon_color": "blue"
                    },
                    {
                      "type": "custom:mushroom-entity-card",
                      "entity": "sensor.grow_env_sensor_1_humidity",
                      "name": "S1 Feuchte",
                      "icon_color": "cyan"
                    },
                    {
                      "type": "custom:mushroom-entity-card",
                      "entity": "sensor.0x00158d0002c9fa8b_humidity",
                      "name": "ZB Feuchte",
                      "icon_color": "light-blue"
                    },
                    {
                      "type": "custom:mushroom-entity-card",
                      "entity": "sensor.grow_env_sensor_1_pressure",
                      "name": "Druck In"
                    },
                    {
                      "type": "custom:mushroom-entity-card",
                      "entity": "sensor.0x00158d0002c9fa8b_pressure",
                      "name": "Druck Out"
                    }
                  ]
                }
              ]
            },
            {
              "type": "grid",
              "cards": [
                {
                  "type": "heading",
                  "heading": "Equipment & Controls"
                },
                {
                  "type": "tile",
                  "entity": "binary_sensor.spider_farmer_80f1b2b3b64a_growth_plan_running",
                  "name": "Growth plan active",
                  "vertical": false,
                  "features_position": "bottom"
                },
                {
                  "type": "tile",
                  "entity": "sensor.spider_farmer_80f1b2b3b64a_growth_progress",
                  "name": "Growth plan progress",
                  "icon": "fa6-solid:percent",
                  "vertical": false,
                  "features_position": "bottom"
                },
                {
                  "type": "horizontal-stack",
                  "cards": [
                    {
                      "type": "custom:mushroom-light-card",
                      "entity": "light.spider_farmer_80f1b2b3b64a_primary_light",
                      "name": "Light",
                      "show_brightness_control": true,
                      "use_light_color": true
                    },
                    {
                      "type": "custom:mushroom-fan-card",
                      "entity": "fan.spider_farmer_80f1b2b3b64a_blower",
                      "name": "Blower",
                      "show_percentage_control": true
                    }
                  ]
                },
                {
                  "type": "horizontal-stack",
                  "cards": [
                    {
                      "type": "custom:mushroom-fan-card",
                      "entity": "fan.spider_farmer_80f1b2b3b64a_fan",
                      "name": "Fan",
                      "tap_action": {
                        "action": "more-info"
                      }
                    },
                    {
                      "type": "custom:mushroom-entity-card",
                      "entity": "fan.spider_farmer_80f1b2b3b64a_heater",
                      "name": "Heater",
                      "icon": "mdi:fire"
                    }
                  ]
                },
                {
                  "type": "glance",
                  "entities": [
                    {
                      "entity": "sensor.grow_tent_power",
                      "name": "Watt"
                    },
                    {
                      "entity": "sensor.grow_tent_current",
                      "name": "Ampere"
                    },
                    {
                      "entity": "sensor.grow_tent_voltage",
                      "name": "Volt"
                    },
                    {
                      "entity": "binary_sensor.grow_tent_consumer_connected",
                      "name": "Status"
                    }
                  ]
                }
              ]
            },
            {
              "type": "grid",
              "cards": [
                {
                  "type": "heading",
                  "heading": "Grow Planer"
                },
                {
                  "type": "custom:mushroom-entity-card",
                  "entity": "input_datetime.grow_startdatum",
                  "name": "Startdatum",
                  "icon": "mdi:calendar-start"
                },
                {
                  "type": "custom:stack-in-card",
                  "cards": [
                    {
                      "type": "markdown",
                      "content": "{% set start_state = states('input_datetime.grow_startdatum') %} {% if start_state not in ['unknown', 'unavailable'] %}\n  {% set start = as_timestamp(start_state) %}\n  {% set heute = as_timestamp(now().strftime('%Y-%m-%d')) %}\n  {% set tage = ((heute - start) / 86400) | int %}\n  {% set start_dt = start_state | as_datetime %}\n  ### Aktueller Tag: {{ tage }}\n  | Phase | Zeitraum | Status |\n  | :--- | :--- | :--- |\n  | **Keimung** | bis {{ (start_dt + timedelta(days=5)).strftime('%d.%m.') }} | {{ '🟢 Aktiv' if tage <= 5 else '✅ OK' }} |\n  | **Sämling** | bis {{ (start_dt + timedelta(days=19)).strftime('%d.%m.') }} | {{ '⏳' if tage < 6 else ('🟢 Aktiv' if tage <= 19 else '✅ OK') }} |\n  | **Wachstum** | {{ (start_dt + timedelta(days=20)).strftime('%d.%m.') }} bis {{ (start_dt + timedelta(days=35)).strftime('%d.%m.') }} | {{ '⏳' if tage < 20 else ('🟢 Aktiv' if tage <= 35 else '✅ OK') }} |\n  | **Blüte** | {{ (start_dt + timedelta(days=36)).strftime('%d.%m.') }} bis {{ (start_dt + timedelta(days=90)).strftime('%d.%m.') }} | {{ '⏳' if tage < 36 else ('🟢 Aktiv' if tage <= 90 else '✅ OK') }} |\n  \n  **Voraussichtliche Ernte: {{ (start_dt + timedelta(days=80)).strftime('%d.%m.%y') }}**\n  ---\n  **Sorten:** 2x Amnesia XXL, 2x Sticky Orange, 1x Purple Skunk\n{% endif %}\n"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  }
}