Skip to content

Descriptions of what the examples do would be helpful for new to YAML users #29609

@DrJohnM61

Description

@DrJohnM61

Feedback

The examples given for YAML code are useful but it would be even better if there was an explanation of the code or even better still, there were comments in the code as to what exactly is being achieved. For example, there is no description as to what this code actually does and it would be simple to add a description such as: "when the office motion sensor is triggered to on, the air conditioning is turned on and an input datetime variable is set for two hours later (from now) to automatically turn the air conditioning off." Even better would be the inclusion of comments to describe the actions being performed and also references to where or how you would define such items as input_datetime:turn_off_ac

While this is showing a specific example for your documentation, the lack of a helpful description for example code is generic throughout.

automation:

  • trigger:
    • platform: state
      entity_id: binary_sensor.motion
      to: "on"
      action:
    • service: climate.turn_on
      target:
      entity_id: climate.office
    • service: input_datetime.set_datetime
      target:
      entity_id: input_datetime.turn_off_ac
      data:
      datetime: >
      {{ (now().timestamp() + 26060)
      | timestamp_custom('%Y-%m-%d %H:%M:%S') }}
  • trigger:
    • platform: time
      at: input_datetime.turn_off_ac
      action:
    • service: climate.turn_off
      target:
      entity_id: climate.office

URL

https://www.home-assistant.io/docs/automation/trigger/

Version

2023.10.5

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    automationstaleThe PR had no activity for quite some time, and is marked as Stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions