Rules explained (automation or not)?

Hi everyone,

This driving me nuts, that I can’t see what’s probably abvious. So please help me get a better understanding :slight_smile:

So I have these rules here which in my head makes sense and they do also work:

Living Room

LED Light TV

- alias: '[Living Room] LED Turn On'
  trigger:
    platform: state
    entity_id: media_player.samsung_tv
    from: 'off'
    to: 'on'
  condition:
    condition: state
    entity_id: sun.sun
    state: 'below_horizon'
  action:
  - service: light.turn_on
    entity_id: light.led_tv_mbel

- alias: '[Living Room] LED Turn Off'
  trigger:
    platform: state
    entity_id: media_player.samsung_tv
    from: 'on'
    to: 'off'
  condition:
    condition: state
    entity_id: sun.sun
    state: 'below_horizon'
  action:
  - service: light.turn_off
    entity_id: light.led_tv_mbel

If you look at my action, then I’m calling the ligh.turn_on & off.
Both rules are shows in my ui under the automations card;

image

Then I have these rules here, which I’ve kinda copied somewhere from here in the community, in order to get some of the basic things up and running in the beginning. If you take a look at the actions - then it has double service?

Hobbyroom

Motion Sensor Trigger light

- alias: '[Hobbyroom] Motion/Lux Turn On Gateway LED'
  trigger:
    platform: state
    entity_id: binary_sensor.motion_sensor_158d00012441a4
    from: 'off'
    to: 'on'
  condition:
    condition: numeric_state
    entity_id: sensor.illumination_158d00012441a4
    below: 100
  action:
  - service: light.turn_on                            //This one does the actual command
    entity_id: light.gateway_light_34ce0088ed14
    data:
      brightness: 5
      color_name: red
  - service: automation.turn_on                  //But what does this do and why?
    data:
      entity_id: automation.MOTION_ON

- alias: '[Hobbyroom] Motion/Lux Tun Off Gateway LED'
  trigger:
    platform: state
    entity_id: binary_sensor.motion_sensor_158d00012441a4
    from: 'on'
    to: 'off'
    for:
      minutes: 5
  action:
  - service: light.turn_off                              //This one does the actual command
    entity_id: light.gateway_light_34ce0088ed14
  - service: automation.turn_off                  //But what does this do and why?
    data:
      entity_id: automation.MOTION_OFF

image

So why is that extra part even there and is it needed?

It does what it says it does - i.e. it turns on/off the automations called motion_on/off you haven’t show them so we can’t say exactly what they do but at a guess I would say that they turn off the motion automations to do with the lights. It may be that you didn’t copy all of the automations or that you have since modified them or deleted them. Without seeing the automations on/off we can’t say if they are needed or not - so try commenting them out.

Hey Keith,
The thing is - I don’t see any automations.xxxx anywhere?
So maybe I just copied it, because I though I would need it :smiley:

Will try to delete it and see if the things still work!

EDIT: It actually does… did this earlier, so I wouldn’t make a fool out of myself, whih didn’t work and now it does :blush:

Thanks…

To find all of your entity_id’s look under the dev tools and click <> (states), it’s in the side bar menu at the bottom.

Yes thanks man!