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

Lightning quick!

Thank you so much!
Send you someting your way :sunglasses:.

1 Like

Hello, I’m having an issue with this blueprint. I am using a NVIDIA Shield and trying the use the chromecast feature (which presents as a media_player entity) to trigger this automation. For some reason I am getting this error message:

Stopped because of unknown reason "null" at July 31, 2023 at 10:34:50 AM (runtime: 0.00 seconds)

I get this error right as I start playing something and the automation stops right away and nothing happens. Any ideas? I tried to use the android remote integration, but that won’t trigger this blueprint at all.

@Nomar383

Hi Kalen

Firstly welcome to the community :+1:

Could you please provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can help. To do this go into your automation, top right 3 dots, Edit in YAML, copy all the code, come back to the forum and in your reply at the top tool bar click on “</>” and paste code in there.

Blacky :smiley:

alias: Den - Lights Auto - Media Playing
description: ""
use_blueprint:
  path: Blackshome/sensor-light-add-on.yaml
  input:
    trigger_entities:
      - media_player.den_shield
    trigger_on_state:
      - "on"
      - playing
    trigger_off_state:
      - "off"
      - turned_off
    time_delay: 5
    light_switch:
      entity_id:
        - light.floor_lamp_l
        - light.floor_lamp_r
    include_light_control:
      - use_brightness
      - use_transition
    light_brightness: 20
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.den_lux
    ambient_light_value: 10
    include_automation_link: enable_automation_link
    automation_link:
      - input_boolean.den_lights_auto_bypass

Thanks for taking a look!

@Nomar383

Hi Kalen, thanks for providing your YAML of the automation.

Everything looks good.

Could you do something for me?

Go into the developer tools, in the states tab search for your media player ( media_player.den_shield). It will show the state your media player is in. Could you then do the following.

  1. Play a movie and check the state.
  2. Pause a movie and check the state.
  3. Stop a movie and check the state.

Then make sue your state (the one shown in developer tools) is selected for ON & OFF

If the state is not there then please let us know.

Either way can you let us know how you go.

Thanks for your help.

Blacky :smiley:

Okay, so the states for this entity are as follows:

  1. “playing”
  2. “paused”
  3. “off”

Should “playing” be in quotes in my YAML maybe?

@Nomar383

Hi Kalen, sorry for the delay. This is a bug (can’t believe I missed this one :relieved:). I have fixed it and a new release will be out soon. Just testing everything again.

Once the new release 1.3 is out please update and let us know if it working for you.

Good news is now you know what to put in your;

  • On State = Playing
  • OFF State = OFF

If you would like the lights to go back and use the main sensor light automation when you pause then;

  • On State = Playing
  • OFF State = OFF & Paused

If you would like to use intermission option.

  • On State = Playing
  • OFF State = OFF
  • Intermission enabled and select Paused and set up your lights.

Thanks for your help.

PS: No it was not quotes.

Blacky :smiley:

New Update - Version 1.3

Bugs Fixes :bug:

  • Fixed major bug that stopped the automation from working if you didn’t add any entities in “Start Turn OFF Options” and “End Turn ON Options”. You would also get an error message like this;
Stopped because of unknown reason "null" at July 31, 2023 at 10:34:50 AM (runtime: 0.00 seconds)

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:

Enjoy

Blacky :grinning:

FAQ

HOW TO UPDATE A BLUEPRINT

There are a couple ways to do this. Below is one example on how to update a blueprint. You can also find out more information on the Home Assistant official website if you prefer.

This is the official Home Assistant web site Using Automation Blueprints - Home Assistant

Example Below

1 - First most important, do a full backup of your Home Assistant, and store it in a location where you can get to it if you brick your Home Assistant (on a separate computer not running Home Assistant).

2 - To update a blueprint you must have a file editor. There are few to choose from. If you don’t have one already installed then this is how to add the official “File Editor” into your Home Assistant. Go to Settings / Add-ons and then click on “add-on store”. In the " Official add-ons" heading you will see “File Editor”, click on it and install it.

3 - In all my Blueprints, the official latest code is in the first post at the top. There is a link to my GitHub were you can find the code to copy. For this blueprint you will need to copy the code from GitHub.

  • Go to my GitHub link at the top of this post Click Here, in the code area there will be a “Raw” button. If you click on it you will then be able to easily copy the code without copping anything else.

4 - When you have copied the code, go into your file editor. At the top leftish there is a folder icon. If you click on it a navigation area is shown. Navigate to the file of the blueprint you would like to update. For this blueprint it should be in “blueprints/automation/Blackshome” and select “sensor-light-add-on.yaml” file.

5 - Once you select the file you should see the code of the blueprint displayed in the right section. At the top of all my blueprints it should say the name, in this case, “Sensor Light Add On” and you should also see the version you are on. This let’s you confirm that you are on the correct blueprint your about to update and not changing some other code that could brick you HA. Once confirmed, delete all the code and paste the new code you copied before in its place. You should now see the name again and the new version in the code at the top confirming your paste was successful and you are happy to proceed. When you pasted the code a red save button pops up and most importantly you will also see a green tick. If you don’t see this green tick, then stop, something is wrong, check the steps again until you see the green tick. If you see the green tick and you are happy with everything (again, a backup of HA) then and only then should you click save.

6 - Once saved you will need to reload the blueprint to reflect the changes before it will take affect. In the file editor you will see a cog wheel at the top right. When you click on it, select “Reload Automations”. A confirmation will pop up to confirm if your happy to proceed, click yes if your happy.

You have now updated a blueprint :tada:.

To check everything was done correctly, go into your automation and or the blueprint, you should see the new version displayed at the top confirming you are on the latest.

Enjoy

Blacky :smiley:

Back to FAQ: Click Here

The latest update appears to have fixed my issues. Thanks!

1 Like

Thanks for letting us know.

New Update - Version 1.4

New Features :new:

Added two new by-pass options.

  • Enable the By-pass - Turn automation ON
  • Enable the By-pass - Turn automation OFF

Bugs Fixes :bug:

  • Fixed bug if a switch was turn ON at the start of the automation.
  • Fixed an error when transition was disabled like shown below. This was probably when you are using zigbee2mqtt.
Transition value 0 is not valid.

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:

Enjoy

Blacky :grinning:

Hi,

Thanks for the great blueprint! One smaller issue I’ve noticed in my setup: I’m using the sun condition, which initially works as expected, however when the sun sets while watching a movie, the lights aren’t turned on, only after changing the TV state the next time. Would be great if the lights get turned on when reaching the set sun elevation while the TV is on as well

Thanks,
Jones

@JN_Jones

Hi Jones

Thanks for the feedback. Yes I agree, and I better do the same for ambient. I will do an update for this :+1:

Blacky :smiley:

1 Like

New Update - Version 1.5

New Features :new:

Added two new features to sun and ambient options.

  • If the trigger is in an ON state, and the automation is blocked from running due to a sun or ambient condition, it will now turn ON when sun or ambient falls below its setting.
  • If the automation is running, when sun or ambient rises above its setting, it will now turn the automation OFF.

Bugs Fixes :bug:

  • Fixed bug in “Enable the By-pass - Turn automation OFF” for snapshots.
  • Fixed bug in “Enable the By-pass - Turn automation OFF” for intermission lights.

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:

Enjoy

Blacky :grinning:

1 Like

Is there a way to extend the turn off time past 30 min. ? I’ve got a bathroom situation where 30 min. Isn’t enough.

@potts-mike

You can just simply type the number (time) you would like into the text box and click save :wink:

Another small point/suggestion: I’m using this alongside adaptive lighting. Overall this works fine, when the blueprint turns the lights on or adjusts them, adaptive lighting marks them as manually controlled. However on pause or at the end I’d like to go back to the lights being controlled by AL. The easiest way to do this would be to call a service provided by AL. While there are some workarounds to achieve this, I’d like to see this possibility directly in the blueprint. Basically besides activating lights or scenes calling any arbitrary service.

@JN_Jones

Will the " Intermission Option" work?

If you go back to the sensor light blueprint it should reactivate you AL.

Let me know if it is not doing this and I will have to install AL.

Blacky :smiley:

Hi, the when (intermission/end) work as expected. The only topic is what to do - I’m currently not using the sensor light bp in that room so can’t test that now but from my understanding of AL so far there are three ways to get a light back from manual control:

  1. Turning it off and back on (which might be a solution with the sensor bp but would cause at least a short flickering)
  2. Define a timeout for manual control. As the time until pause/end differ and are not known beforehand this isn’t a solution here.
  3. Calling the corresponding service

There might be other ways but I’m not yet that familiar with ALs internals. I was also thinking about using the snapshot functionality but I’m not entirely sure how AL would react on that and whether it’d reset manual control. I’ll try to dig deeper into other possibilities but unfortunately am a bit busy the next few days.