-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
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') }}
- platform: state
- trigger:
- platform: time
at: input_datetime.turn_off_ac
action: - service: climate.turn_off
target:
entity_id: climate.office
- platform: time
URL
https://www.home-assistant.io/docs/automation/trigger/
Version
2023.10.5
Additional information
No response