Trimming the automation.yaml code

Greeting all,
I’m wondering if anyone has suggested a default platform for a trigger in an automation. For example:
Currently we would have this:

trigger:
     platform: state
     entity_id: binary_sensor.stair_motion
     to: 'on'
   action:
    - service: light.turn_on
      data:
        entity_id: light.hue_white_lamp_3

With a default platform of state, and a default action to follow said state, it would look like this:

trigger:
     entity_id: binary_sensor.stair_motion
action:
     entity_id: light.hue_white_lamp_3

or with a time delay:

trigger:
     entity_id: binary_sensor.stair_motion
     for: 00:10:00
action:
     entity_id: light.hue_white_lamp_3

Any thoughts?

You’ve gone for saving a few lines of text at the expense of readability. It’s not at all apparent what’s going on there, particularly with the action.

The “overhead” of adding a few characters to make it obvious is so low as to be irrelevant IMO.

2 Likes