Skip to content

Code Standards

James Callaghan edited this page Jul 31, 2020 · 4 revisions

Automation

I try to follow this standard in all my automations.

  • I like to add single line spaces between each trigger, condition and action to make the file more readable.
  • I also add a basic comment to explain what is happening in that block.
  • I always leave the condition section in even if I have no conditions by using condition: [] which makes it clear there are no conditions.
  • I default to single quotes ' unless working with a template.
  • If I have sections commented out or ideas I add a # //TODO comment comment to help when I come back but also because I can search for these as well as use the GitHub issues extension to integrate these comments with my GitHub issues.
  • Where I have related issues in GitHub I add the issue number or link to the related issue using # //RELATED #id or url.
alias: 'Area - Automation descripton'
id: '8caa45ed-7406-40ea-96a6-d6ffecf27390'
description: 'Helpful description'
initial_state: true
mode: single

trigger: []

condition: []

action:

  # HTML5 notification to all devices.
  - service: notify.html5_notification
    data_template:
      title: ''
      message: ''

# //TODO Add note about items that still need work where appropriate.

# //RELATED 
# Add GitHub issue link or number about related items.
Clone this wiki locally