Zum Inhalt springen

Module M0 - Core / Entity Mapping

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

File: packages/grow_core.yaml

What it does

This module is the foundation every other module builds on. It lets you map your existing Home Assistant entities (switches, sensors, etc.) to the logical functions the Grow Assistant needs, without hardcoding any entity IDs into the package files themselves.

How mapping works

Each mappable function has an input_text helper named input_text.grow_map_<function>. You put the entity ID of your actual device (e.g. switch.growtent_dehumidifier) into that helper’s value - either by editing it directly in Settings -> Devices & Services -> Helpers, or via the fields on Dashboard 1.

All current mappings are aggregated into sensor.grow_core_validation, which exposes an attribute called report with three parts:

  • mapping: a dictionary of every function key and the entity ID currently assigned to it (or an empty string if unmapped).
  • issues: a list of human-readable problems - missing required mappings, a mapped entity that no longer exists, or the same entity assigned to two functions at once.
  • issue_count / status: a summary count and ok/issues flag.

binary_sensor.grow_core_setup_incomplete turns on whenever issue_count is greater than zero, so it can drive dashboard warnings or (later) notifications.

Required vs. optional

Currently required: Temperature Sensor, Humidity Sensor, and at least one of Dehumidifier/Humidifier. Everything else (lighting, CO2, substrate sensors, weather-station extras, energy metering) is optional - the system is designed to run safely with only the required fields set.

Derived values already computed here

  • sensor.grow_vpd_current: Vapor Pressure Deficit in kPa, calculated from the mapped temperature and humidity sensors using the Magnus/Tetens approximation. Returns unavailable/unchanged if either sensor is unmapped or has no value.
  • sensor.grow_substrate_vwc_average, sensor.grow_substrate_ec_average, sensor.grow_substrate_temperature_average: averages across whichever of the four substrate sensors are both mapped AND toggled on via the input_boolean.grow_avg_include_sensor<N>_<metric> helpers. A sensor that is unmapped or currently unavailable is silently excluded rather than breaking the average.
  • sensor.grow_temperature_current, sensor.grow_humidity_current (added in Phase 2): stable pass-through sensors that simply mirror the currently-mapped temperature/humidity source’s value. They exist because static Lovelace/apexcharts-card YAML can’t reference “whatever entity is currently mapped” - it needs a fixed entity_id. Dashboard 2’s gauges and historical charts read these instead of the raw mapped entity, so the dashboard config keeps working even if you remap to a different physical sensor later. Same guarded fallback pattern as sensor.grow_vpd_current.

Configuration parameters also defined here

input_number.grow_plant_count, input_number.grow_dripper_count, and input_number.grow_dripper_flow_lph are defined in this package (used later by the Irrigation module, M2, to compute water volume per irrigation event).

Known limitation

sensor.grow_core_validation’s top-level state (the issue count as a number) can lag one update cycle behind its own report attribute, because it reads back this.attributes from the previous update. The report attribute itself (and therefore the Dashboard 1 status card, which reads the attribute directly) is always current. This is a deliberate, standard Home Assistant template pattern - not a bug.