Attribue change does not trigger?

Hey all,

I am going crazy with triggering(!) an automation.

I have several Unifi Bullet G3 scattered around my house. As I do shutter control, lights et all with homeassistant I took the usual “sun” state to close the covers when the sun was setting. But sometimes due to rainy conditions or even a clear sky the time to open and close the covers is never on the spot. Then it occurred to me that the cameras have a very, very good attribute: is_dark. All cams turn on their IR when its “too dark” which is also spot-on for my taste.

I have an automation that when two cams in the front and two cams in the back turn their IR on (kind of a quorum) a bool is_day is set to false and during the morning another automation is setting the bool to true when the cams agree that it is day.

This works like a charm… but…

I am doing a trigger from camera.camera_garage (ie) and checking a change for the is_dark attribute. But even thou the attribute is correctly changing from true → false and vice-versa, there is nothing triggered. A trace shows “no traces found”. The main state of the camera “recording” never changes, just the one yaml attribute. Is there a bug that this is not working?

I am doing a time-pattern triggered condition, but that does not seem right (although working).

Here is a watered-down automation of what I am trying to accomplish:

alias: 'Debug: BasementCam bright'
description: 'Testing triggers'
trigger:
  - platform: state
    entity_id: camera.Camera_Basement
    attribute: is_dark
    from: 'true'
    to: 'false'
condition: []
action:
  - service: notify.mobile_app_a57phone
    data:
      message: 'Basementcam: Bright.'
      title: Basement-Cam.
mode: single

Even thou the attribute “is_dark” is changing in the Developer Tools this is never triggered.

Thanks for any pointers!
-Chris.

If the is_dark attribute state is a boolean (rather than a string) you need to remove the quotes from around true and false in the to and from.

I think that did the trick! At least in the debug automation this worked.
But the editor is always making my True and False to “true” and “false”.

Whats the right way to check vs a boolean in the editor here? (non yaml one?)

Thanks soo much!

The editor results are interpreted. You can’t trust them.

If the attribute state is not in quotes when you look at it in Developer Tools / States then it is a boolean. If it is in quotes then it is a string.

Thank you kindly-- this issue has been solved.

Great! Please mark the post that helped as the solution to assist others that may be searching for the same thing.

Linking this topic to another one that had the same issue:

The Automation Editor automatically adds quotes to true and false thereby changing their type from boolean to string (i.e. undesirable behavior in this situation).