<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 960 320" xmlns="http://www.w3.org/2000/svg"
     font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif">

  <!-- Background -->
  <rect width="960" height="320" fill="#F8FAFC" rx="10"/>

  <!-- ══════════════════════════════════════════════════════════
       TITLE BAR
       ══════════════════════════════════════════════════════════ -->
  <text x="480" y="28" text-anchor="middle" font-size="13" font-weight="700" fill="#1E293B">Home Assistant Device Structure</text>
  <line x1="20" y1="36" x2="940" y2="36" stroke="#E2E8F0" stroke-width="1"/>

  <!-- ══════════════════════════════════════════════════════════
       PARENT: Inverter Device  (centred top)
       ══════════════════════════════════════════════════════════ -->
  <rect x="350" y="48" width="260" height="90" rx="7" fill="#F1F5F9" stroke="#475569" stroke-width="2"/>
  <text x="480" y="68" text-anchor="middle" font-size="12" font-weight="700" fill="#0F172A">Inverter Device</text>
  <line x1="355" y1="74" x2="605" y2="74" stroke="#CBD5E1" stroke-width="1"/>
  <text x="480" y="88" text-anchor="middle" font-size="10" fill="#475569">Status · fault codes · firmware</text>
  <text x="480" y="102" text-anchor="middle" font-size="10" fill="#475569">Inverter &amp; IPM temperature</text>
  <text x="480" y="122" text-anchor="middle" font-size="9" fill="#94A3B8" font-style="italic">parent device — always present</text>

  <!-- Connector lines from parent bottom to child tops -->
  <!-- Parent bottom-centre is at x=480, y=138 -->
  <line x1="480" y1="138" x2="480" y2="158" stroke="#CBD5E1" stroke-width="1.5"/>
  <!-- Horizontal branch -->
  <line x1="102" y1="158" x2="858" y2="158" stroke="#CBD5E1" stroke-width="1.5"/>
  <!-- Drops to each child -->
  <line x1="102" y1="158" x2="102" y2="178" stroke="#CBD5E1" stroke-width="1.5"/>
  <line x1="302" y1="158" x2="302" y2="178" stroke="#CBD5E1" stroke-width="1.5"/>
  <line x1="658" y1="158" x2="658" y2="178" stroke="#CBD5E1" stroke-width="1.5"/>
  <line x1="858" y1="158" x2="858" y2="178" stroke="#CBD5E1" stroke-width="1.5"/>

  <!-- ══════════════════════════════════════════════════════════
       CHILD 1: Solar Device
       ══════════════════════════════════════════════════════════ -->
  <rect x="20" y="178" width="164" height="118" rx="6" fill="#FFFBEB" stroke="#F59E0B" stroke-width="1.5"/>
  <text x="102" y="197" text-anchor="middle" font-size="11" font-weight="700" fill="#92400E">Solar</text>
  <line x1="25" y1="203" x2="179" y2="203" stroke="#FDE68A" stroke-width="1"/>
  <text x="102" y="218" text-anchor="middle" font-size="9" fill="#78350F">pv1_power · pv2_power</text>
  <text x="102" y="231" text-anchor="middle" font-size="9" fill="#78350F">pv3_power (3-string models)</text>
  <text x="102" y="244" text-anchor="middle" font-size="9" fill="#78350F">solar_total_power</text>
  <text x="102" y="257" text-anchor="middle" font-size="9" fill="#78350F">energy_today · energy_total</text>
  <text x="102" y="278" text-anchor="middle" font-size="8" fill="#B45309" font-style="italic">AC voltage · frequency (1-phase)</text>

  <!-- ══════════════════════════════════════════════════════════
       CHILD 2: Grid Device
       ══════════════════════════════════════════════════════════ -->
  <rect x="220" y="178" width="164" height="118" rx="6" fill="#EFF6FF" stroke="#3B82F6" stroke-width="1.5"/>
  <text x="302" y="197" text-anchor="middle" font-size="11" font-weight="700" fill="#1D4ED8">Grid</text>
  <line x1="225" y1="203" x2="379" y2="203" stroke="#BFDBFE" stroke-width="1"/>
  <text x="302" y="218" text-anchor="middle" font-size="9" fill="#1E40AF">grid_export_power</text>
  <text x="302" y="231" text-anchor="middle" font-size="9" fill="#1E40AF">grid_import_power</text>
  <text x="302" y="244" text-anchor="middle" font-size="9" fill="#1E40AF">grid_voltage · grid_frequency</text>
  <text x="302" y="257" text-anchor="middle" font-size="9" fill="#1E40AF">energy_to_grid_today</text>
  <text x="302" y="278" text-anchor="middle" font-size="8" fill="#3B82F6" font-style="italic">always present</text>

  <!-- ══════════════════════════════════════════════════════════
       CHILD 3: Load Device
       ══════════════════════════════════════════════════════════ -->
  <rect x="576" y="178" width="164" height="118" rx="6" fill="#F5F3FF" stroke="#8B5CF6" stroke-width="1.5"/>
  <text x="658" y="197" text-anchor="middle" font-size="11" font-weight="700" fill="#5B21B6">Load</text>
  <line x1="581" y1="203" x2="735" y2="203" stroke="#DDD6FE" stroke-width="1"/>
  <text x="658" y="218" text-anchor="middle" font-size="9" fill="#4C1D95">house_consumption</text>
  <text x="658" y="231" text-anchor="middle" font-size="9" fill="#4C1D95">self_consumption</text>
  <text x="658" y="244" text-anchor="middle" font-size="9" fill="#4C1D95">power_to_user · power_to_load</text>
  <text x="658" y="257" text-anchor="middle" font-size="9" fill="#4C1D95">load_energy_today</text>
  <text x="658" y="278" text-anchor="middle" font-size="8" fill="#7C3AED" font-style="italic">always present</text>

  <!-- ══════════════════════════════════════════════════════════
       CHILD 4: Battery Device
       ══════════════════════════════════════════════════════════ -->
  <rect x="776" y="178" width="164" height="118" rx="6" fill="#F0FDF4" stroke="#16A34A" stroke-width="1.5"/>
  <text x="858" y="197" text-anchor="middle" font-size="11" font-weight="700" fill="#15803D">Battery</text>
  <line x1="781" y1="203" x2="935" y2="203" stroke="#BBF7D0" stroke-width="1"/>
  <text x="858" y="218" text-anchor="middle" font-size="9" fill="#166534">battery_soc · battery_power</text>
  <text x="858" y="231" text-anchor="middle" font-size="9" fill="#166534">battery_voltage · battery_temp</text>
  <text x="858" y="244" text-anchor="middle" font-size="9" fill="#166534">charge_power · discharge_power</text>
  <text x="858" y="257" text-anchor="middle" font-size="9" fill="#166534">charge_energy_today</text>
  <text x="858" y="278" text-anchor="middle" font-size="8" fill="#16A34A" font-style="italic">hybrid &amp; off-grid only</text>

  <!-- ══════════════════════════════════════════════════════════
       FOOTER NOTE
       ══════════════════════════════════════════════════════════ -->
  <rect x="20" y="306" width="920" height="10" rx="3" fill="#F1F5F9" stroke="none"/>
  <text x="480" y="314" text-anchor="middle" font-size="8" fill="#94A3B8">
    Battery device is created automatically when a hybrid or off-grid profile is selected. Not present for grid-tied-only models (MIC, MIN TL-X, MID).
  </text>

</svg>
