♾ Sensor Light Add On - Media & Movie Lights - House Alarm Lights - Smoke Alarm Lights & Exhaust Fans + More

@kobejo34

Have you put the script into Lights - Switches - Scenes - Scripts? If you use the light entity and use Transition - ON will that work?

Blacky :grinning:

Like this?

@kobejo34

Seems like you’re using a scene, not a script, that’s probably why it looks like the script isn’t working. Swap it out for the script and give it another try :wink:

Blacky :grinning:

Hi @Blacky ,
First of all great blueprint. But it appears it doesn´t work for me. :sob:

I´ve checked everything. The YAML and all that and it seems it´s correctly setup or I´m missing something terribly obvious. The automation simply doesn´t trigger.

Platform of the media player is Amazon Fire TV Cube.
I double checked and even added all possible media player combinations but the automation never triggers. I can see the media_player indicating the status of “Playing” but nothing.

Here´s my yaml

alias: Movie Night Plex
description: ""
use_blueprint:
  path: Blackshome/sensor-light-add-on.yaml
  input:
    trigger_entities:
      - media_player.fire_tv
      - media_player.plex_plex_for_android_tv_aftgazl
    trigger_on_state:
      - playing
      - "on"
      - Playing
    app_attribute: []
    trigger_off_state:
      - paused
      - idle
      - standby
      - "off"
    off_include_light_control:
      - use_transition
    off_light_switch:
      entity_id:
        - light.gaming_room_pc
        - light.living_room_ceiling_back
        - light.hue_lightstrip_plus_1_2
        - light.smart_curtains
    include_end_turn_on: enable_end_turn_on
    end_snapshot_name: lights_before_movies
    end_light_switch:
      entity_id:
        - light.gaming_room_pc
        - light.living_room_ceiling_back
        - light.hue_lightstrip_plus_1_2
        - light.smart_curtains
    end_include_light_control:
      - use_transition
    intermission_light_switch:
      entity_id:
        - light.smart_curtains
        - light.hue_lightstrip_plus_1_2
        - light.living_room_ceiling_back
    intermission_include_light_control:
      - use_transition
    include_start_turn_off: enable_start_turn_off
    include_intermission: intermission_enable

Can you give me some feedback on what might be wrong?
Really appreciate your time.
Thank you.

@jfplopes

Just quickly looking at it (sorry big day today) you have no Movie Lights. Just add a light in light.hue_lightstrip_plus_1_2 and set it to 0% brightness (that will turn it OFF).

Let us know how you go. Like this… I have also changed your Intermission Lights and Lights ON at End so you can see how it works. Adjust as required.

alias: Movie Night Plex
description: ""
use_blueprint:
  path: Blackshome/sensor-light-add-on.yaml
  input:
    trigger_entities:
      - media_player.fire_tv
      - media_player.plex_plex_for_android_tv_aftgazl
    trigger_on_state:
      - playing
      - "on"
      - Playing
    app_attribute: []
    trigger_off_state:
      - paused
      - idle
      - standby
      - "off"
    off_include_light_control:
      - use_transition
    off_light_switch:
      entity_id:
        - light.gaming_room_pc
        - light.living_room_ceiling_back
        - light.smart_curtains
    include_end_turn_on: enable_end_turn_on
    end_snapshot_name: lights_before_movies
    end_light_switch:
      entity_id:
        - light.gaming_room_pc
        - light.living_room_ceiling_back
        - light.hue_lightstrip_plus_1_2
        - light.smart_curtains
    end_include_light_control:
      - use_transition
      - use_brightness
    intermission_light_switch:
      entity_id:
        - light.smart_curtains
        - light.hue_lightstrip_plus_1_2
        - light.living_room_ceiling_back
    intermission_include_light_control:
      - use_transition
      - use_brightness
    include_start_turn_off: enable_start_turn_off
    include_intermission: intermission_enable
    light_switch:
      entity_id: light.hue_lightstrip_plus_1_2
    include_light_control:
      - use_brightness
    light_brightness: 0
    intermission_light_brightness: 20

Blacky :grinning:

Thank you @Blacky . That was the issue.

A minor feedback regarding the app selection. There are two options available. One for Chromecast and another for Apple TV. In my case I’m using Plex on Fire TV Cube. For Fire TV Cube I used the application name “com.plexapp.android”.

With that said, marvelous automation blueprint. Thank you again for your help and this fine blueprint.
Here’s my updated config:

alias: Movie Night Plex
description: ""
use_blueprint:
  path: Blackshome/sensor-light-add-on.yaml
  input:
    trigger_entities:
      - media_player.fire_tv
    trigger_on_state:
      - playing
    app_attribute:
      - com.plexapp.android
    trigger_off_state:
      - standby
      - "off"
      - idle
      - paused
      - unavailable
    off_include_light_control: []
    off_light_switch:
      entity_id:
        - light.gaming_room_pc
        - light.living_room_ceiling_back
        - light.hue_lightstrip_plus_1_2
        - light.smart_curtains
        - light.nanoleaf_light_panels_59_c9_f3
        - switch.living_room_motion_sensor_motion_sensor_enabled
    include_end_turn_on: enable_end_turn_on_snapshot
    end_snapshot_name: lights_before_movies
    end_light_switch:
      entity_id:
        - light.gaming_room_pc
        - light.living_room_ceiling_back
        - light.hue_lightstrip_plus_1_2
        - light.smart_curtains
        - switch.living_room_motion_sensor_motion_sensor_enabled
        - light.nanoleaf_light_panels_59_c9_f3
    end_include_light_control: []
    intermission_light_switch:
      entity_id:
        - light.smart_curtains
        - light.hue_lightstrip_plus_1_2
        - light.living_room_ceiling_back
        - light.nanoleaf_light_panels_59_c9_f3
    intermission_include_light_control: []
    include_start_turn_off: enable_start_turn_off
    include_intermission: intermission_enable
    light_switch:
      entity_id: light.hue_color_spot_6
    include_light_control: []
    off_light_transition_off: 3
    end_snapshot_helper: input_boolean.light_before_movies
    intermission_state:
      - paused
      - idle

Omg I feel like such an idiot. well I selected the right one that was really a posting mistake as I tried a lot of stuff. I copied the blueprint and the only way I can get it to work is like this.

action: script.ashley_s_light_fader
data:
light: light.family_lamps
lampBrightnessScale: zeroToTwoFiftyFive
transitionTime:
hours: 0
minutes: 0
seconds: 30
easingTypeInput: easeInOutSine
endBrightnessPercent: 5
endBrightnessEntityScale: zeroToTwoFiftyFive
autoCancelThreshold: 10
shouldStopIfTheLampIsTurnedOffDuringTheFade: true
shouldResetTheStopEntityToOffAtStart: false
shouldInvertTheValueOfTheStopEntity: false
minimumStepDelayInMilliseconds: 100
shouldTryToUseNativeLampTransitionsToo: true
isDebugMode: false

Ok I got it to work by having a script call the main script which is what I think you said.

1 Like

@jfplopes

Thanks for the update… glad you are up and running.

Blacky :grinning:

I’m struggling a lot to get this to turn off my lights when I want to watch a movie. It looks like my SHIELD uses the “playing” as a trigger state, but it doesn’t turn off the lights. Can anyone help?

alias: Sensor Light Add On
description: ""
use_blueprint:
  path: Blackshome/sensor-light-add-on.yaml
  input:
    light_brightness: 69
    include_end_turn_on: disable_end_turn_on
    end_light_switch:
      entity_id:
        - light.bedroom_2
        - light.living_room
        - light.kitchen
        - light.hallway
    include_automation_link: disable_automation_link
    automation_link: []
    include_start_turn_off: enable_start_turn_off
    off_light_switch:
      entity_id:
        - light.hallway
        - light.living_room
        - light.kitchen
        - light.bedroom_2
    trigger_entities:
      - media_player.shield_3
      - media_player.v24d
      - media_player.shield_2
      - media_player.shield
      - media_player.lg_webos_tv_oled65b8pla
    trigger_off_state:
      - standby
      - "off"
    trigger_on_state:
      - playing
    include_intermission: intermission_disable
    include_automation_link_time_delay: disable_time_delay
    automation_link_time_delay: 3.5
    off_light_transition_off: 5
    intermission_state: []
    end_light_brightness: 70
    end_light_transition_on: 3

Edit, I did some changes which I think have fixed it. Need to test tomorrow

alias: Sensor Light Add On
description: ""
use_blueprint:
  path: Blackshome/sensor-light-add-on.yaml
  input:
    light_brightness: 69
    include_end_turn_on: enable_end_turn_on
    end_light_switch:
      entity_id:
        - light.bedroom_2
        - light.living_room
        - light.kitchen
        - light.hallway
    include_automation_link: disable_automation_link
    automation_link: []
    include_start_turn_off: enable_start_turn_off
    off_light_switch:
      entity_id:
        - light.hallway
        - light.living_room
        - light.kitchen
        - light.bedroom_2
    trigger_entities:
      - media_player.shield_3
      - media_player.shield_2
      - media_player.shield
      - media_player.lg_webos_tv_oled65b8pla
    trigger_off_state:
      - standby
      - "off"
    trigger_on_state:
      - playing
      - Playing
      - "on"
    include_intermission: intermission_disable
    include_automation_link_time_delay: disable_time_delay
    automation_link_time_delay: 3.5
    off_light_transition_off: 5
    intermission_state: []
    end_light_brightness: 70
    end_light_transition_on: 3
    app_attribute:
      - org.jellyfin.androidtv
      - Jellyfin
    light_switch:
      entity_id:
        - light.hallway
        - light.living_room
        - light.kitchen
        - light.bedroom_2

@klovnious

Close! Here’s how it works:

The Movie Lights option must include at least one light. If you’d like a light to remain OFF during movie mode, simply set its brightness to 0%.

In this example, I chose the kitchen lights as they’re most likely to support brightness control. If yours don’t, just replace them with another light that does.

Also, take note that I’ve selected the brightness option to allow this control.

Your YAML below.

alias: Sensor Light Add On
description: ""
use_blueprint:
  path: Blackshome/sensor-light-add-on.yaml
  input:
    light_brightness: 0
    include_end_turn_on: enable_end_turn_on
    end_light_switch:
      entity_id:
        - light.bedroom_2
        - light.living_room
        - light.kitchen
        - light.hallway
    include_automation_link: disable_automation_link
    automation_link: []
    include_start_turn_off: enable_start_turn_off
    off_light_switch:
      entity_id:
        - light.hallway
        - light.living_room
        - light.bedroom_2
    trigger_entities:
      - media_player.shield_3
      - media_player.shield_2
      - media_player.shield
      - media_player.lg_webos_tv_oled65b8pla
    trigger_off_state:
      - standby
      - "off"
    trigger_on_state:
      - playing
      - Playing
      - "on"
    include_intermission: intermission_disable
    include_automation_link_time_delay: disable_time_delay
    automation_link_time_delay: 3.5
    off_light_transition_off: 5
    intermission_state: []
    end_light_brightness: 70
    end_light_transition_on: 3
    app_attribute:
      - org.jellyfin.androidtv
      - Jellyfin
    light_switch:
      entity_id:
        - light.kitchen
    end_include_light_control:
      - use_brightness
    include_light_control:
      - use_brightness

Blacky :grinning:

When trying to do a home assistant automation using this blueprint I got the error: "Error rendering variables: UndefinedError: ‘list object’ has no attribute ‘entity_id’

Changed default: to default: {} for light entities after googling about similar problems.

Now the script renders and works as intended for me.

@Sakakidash

You can also add a light entity in and set the brightness to 0. This way it will also turn OFF.

Blacky :grinning:

I also get the same error with this automation but don’t really understand the solution you’ve posted - any chance you can elaborate please?

Error rendering variables: UndefinedError: ‘list object’ has no attribute ‘entity_id’

My lights are turning on to intermission levels due to sun elevation trigger even if my trigger is not in an “On” state (i.e. my lights are turning on when the TV is off and media paused). Is this intended function? I suppose paused is the intermission option, but AppleTV stays paused forever even with the TV off. I only want the initial turn on to occur if motion is detected per my linked Sensor light automation or if the media player is in “on” state (playing).

Thanks for your hard work on these blueprints!