I am trying to create a simple automation that should be working based on what I am looking at but I must be missing something because it won’t trigger.
I have a trigger of when motion is detected with the condition of lux below 1000 lumens then turn on my kitchen and dining lights.
OK excellent. I will make the changes and report back. Just wondering how I can get that info myself. How I came to add that state was in the state history it was reporting Detected & Clear. So I figured that was the two states I could automate on.
You can also see the attributes are true and false.
Are you sure your sensor has an attribute named illuminance? It’s more likely that a sensor called “sensor.kitchen_luminance_sensor_illuminance” holds the illuminance value in its state… you can check which attributes an entity has in the same States tab discussed earlier.
If your sensor doesn’t have illuminance listed in its attributes in the States tab, remove it from your condition:
Double check your trigger entity in the States tab too… in your original post you had attribute: occupancy. Based on the entity info screenshot you provided earlier, it looks like the binary sensor does have an occupancy attribute, but it uses true or false as its values. I would suggest using the binary sensor’s state, not the occupancy attribute.
@stumbows,
From a diagnostic approach, I always try to isolate the conditions to test them individually.
For example, remove the “conditions:” section so you can just test that the motion sensor is working as you expect. You could verify this from the automations list where it will show you the last time the automation was executed.
If it’s executed and your light turns on, then there’s an issue with your condition. You could test this independently with the same approach by putting it in the trigger section.
If it’s executed without the conditions: section, but your light doesn’t come on, then your issue is with your “actions:” section, In my automations, I see that light.turn_on is using a device_id instead of an entity_id.
Thank you for the suggestions. The comment about calling the entity id over the device id got me thinking.
First I disabled the condition of illuminance and the motion detection still didn’t work so I rebuilt the whole automation using the call of the device instead of entity like this.
alias: Kitchen LED Strips ON
description: Turn Kitchen LED Strips on if the Light Brightness in the Kitchen is over a certain level
triggers: []
conditions:
- type: is_illuminance
condition: device
device_id: 34351ee27588060dd0c530a63211304f
entity_id: aa853bc0d42cf70651cd93553f60f316
domain: sensor
below: 10
actions:
- type: turn_on
device_id: 53828b7902b98a9e43cf32a4e2958ca4
entity_id: b1303657c8c63951303bdbc1792bab2d
domain: light
brightness_pct: 10
- type: turn_on
device_id: 99bab6be668f87372f7042c3fb29f1ec
entity_id: 8727efeb4b5194c35b73516039b5a9f2
domain: light
brightness_pct: 10
mode: single
If I test the condition it fails. But If I run the action it executes the actions. What did I do wrong? I assume the action will not perform the "Then Do’ section if “And If” conditions failed