Xbox on Lights On

Hi. I created an automation whereby when I turn on my Xbox, or more specifically when the Xbox logs into my account, the light turns on 3o minutes before sunset. I don’t know what’s going on, but it’s not working. The light itself works fine and is made with ESP32+LEDs – WLED. If you have a moment, could you take a look at my blueprint and see where the error is?

alias: Xbox On
description: ""
triggers:
  - type: turned_on
    device_id: 7d2de328eccbb2533a3f0239a1163ee3
    entity_id: bff9ac68eea494aaf0b4252aafeb40fd
    domain: binary_sensor
    trigger: device
conditions:
  - condition: sun
    after: sunset
    before: sunrise
    before_offset: "-00:30:00"
actions:
  - data:
      brightness_pct: 40
      rgb_color:
        - 120
        - 0
        - 255
      effect: Solid
    action: light.turn_on
    target:
      entity_id: light.wled
      device_id: 148e78961c7fa80531254e4e3e7ea383
mode: single
1 Like

Please post your code as preformatted text (</> in the toolbar). It’s very difficult to read otherwise.

You might also have a look at the docs on using sunrise/sunset as conditions - above/below horizon works much better.

You swapped your triggers & conditions. What you have right now only turns on the light if you switch on your xbox and it’s past 30 minutes before sunset.

Set the trigger to sun and the condition to xbox, and it will turn on your light 30 mins before sunset if your xbox is currently on.

1 Like

I made corrections, but still nothing came of it.

alias: Xbox On
description: ""
triggers:
  - trigger: sun
    event: sunset
    offset: "-00:30:00"
conditions:
  - type: is_on
    condition: device
    device_id: 7d2de328eccbb2533a3f0239a1163ee3
    entity_id: bff9ac68eea494aaf0b4252aafeb40fd
    domain: binary_sensor
actions:
  - data:
      brightness_pct: 50
      rgb_color:
        - 120
        - 0
        - 255
      effect: Solid
    action: light.turn_on
    target:
      entity_id: light.wled
      device_id: 148e78961c7fa80531254e4e3e7ea383
mode: single

The same story is with the Nvidia Shield

alias: Shield on patyk on
description: ""
triggers:
  - trigger: sun
    event: sunset
conditions:
  - condition: device
    device_id: 03df9754b33450dd742e9f57b0eb0cb8
    domain: media_player
    entity_id: 35ef07ee44363307decb3b6b001c7c01
    type: is_on
actions:
  - data:
      brightness_pct: 50
      effect: Solid
      rgb_color:
        - 255
        - 255
        - 255
    action: light.turn_on
    target:
      entity_id: light.wled
      device_id: 148e78961c7fa80531254e4e3e7ea383
mode: single

*patyk it is name my led lights

This isn’t helpful to people trying to help you from halfway across the world.

At the very least, show us your Xbox & shield binary sensor history for the hour before sunset.

Even better, show the traces of both automations, when they were triggered but didn’t behave like you expected.

I just wanted to say that the lights still aren’t working despite the changes that have been made. Below i put more info

That says at the exact time the sun met that condition it fired then checked whatever pixel warlord is - it checked for on. It was off so executions stopped.

PixelWarlord is my Xbox :slight_smile: Ok if its on light whont on 30 minuts before sun is down.

Ok well that’s fine but that’s what happened it detected it as off when that trigger hit so it did nothing…

Thanks for Reply but the same story is with Nvidia Shield also lights wont on when shield is On.

First please no more screenshots most of us are reading this on our phones. And screenies are Bad.

Please download the trace and look at it and post THAT in a code block as instructed earlier in the future.

Now all of these are the same thing.

Trigger fires conditions are checked… In that order. The condition is checked ONLY when the trigger fires.

So it will Only look (trigger) when the sun GOES down not because it IS down. When it goes down at that EXACT MOMENT it checks your Status in the condition block.

In your case it was off.

It did exactly what you told it to do.

If you’re trying to make it work just because it’s dark. That’s a different story

Thx for answers and patience. you mean tracer Like this ??

Xbox ligts on

1 Like

Both your pictures show that the state of the Xbox and the Shield was unavailable when the automation triggered. This means that either you are referencing an unreliable device, or else it means that the device was offline during the automation trigger.
How are these 2 devices integrated in HA, and can you check their history to see whether you see unavailable at any point during the automation trigger time?

@NathanCu I’m not sure where you saw that the state was off. Did I miss something in the trace pictures?

More coffee necessary Shadow. But that’s why I wanted the actual trace. Thanks for the catch.

1 Like

tomorrow after work I will configure everything again