diff --git a/guides/configuration-types.rst b/guides/configuration-types.rst index 6428bbd83..29e32a906 100644 --- a/guides/configuration-types.rst +++ b/guides/configuration-types.rst @@ -472,6 +472,8 @@ variables can be provided to them. This means that packages can be used as `templates`, allowing complex or repetitive configurations to be stored in a package file and then incorporated into the configuration more than once. +Additionally packages could contain a ``defaults`` block which provides +subsitutions for variables not provided by the ``!include`` block. As an example, if the configuration needed to support three garage doors using the ``gpio`` switch platform and the ``time_based`` cover @@ -502,11 +504,17 @@ platform, it could be constructed like this: door_location: right open_switch_gpio: 15 close_switch_gpio: 18 + open_duration: "1min" + close_duration: "50s" .. code-block:: yaml # In garage-door.yaml + defaults: + open_duration: "2.1min" + close_duration: "2min" + switch: - id: open_${door_location}_door_switch name: ${door_name} Garage Door Open Switch @@ -524,11 +532,11 @@ platform, it could be constructed like this: open_action: - switch.turn_on: open_${door_location}_door_switch - open_duration: 2.1min + open_duration: ${open_duration} close_action: - switch.turn_on: close_${door_location}_door_switch - close_duration: 2min + close_duration: ${close_duration} stop_action: - switch.turn_off: open_${door_location}_door_switch