Newbie my confusion with automations dealing entities, state, and devices in the GUI

I am new to HA, and when I got mine, the GUI is all I have ever known and used. However, the years of knowledge shared here speak of entities and states, and most of all show YAML that are just confusing to me.

For example:
If I want a family room light (Kasa switches) to come on at 5 pm, if motion (Aqara P2) is detected.

I simply from the GUI:
Device KASA Family Room Light

From that drop-down down I can select turn on or off and other options

Condition:
I select the Aqara P2 in the Family Room

From the drop-down, I can select ‘detected’, ‘occupied’, etc.

Time I select from the GUI.

So, the confusion when I see all these videos that say a device has entities and I need to create automation based on the entity or state of the device, I do not see or understand what that means in the GUI.

I do see in the GUI that I could pick entity or device to build an automation. However, it works for me just by picking the device.

State, entity - I don’t understand how to create automation in this way. I have many things automated in my home now, just by using the device drop-down selections. I’ve never built one using entity or state based on those drop-down selections in the GUI.

What am I missing or doing wrong?..yet it all still works. Do I need to use entity and state?

Still new at this, so I want to learn the correct way to build automation and not bad habits.

Please advise, thx

1 Like

This is the first part of your confusion.
Devices are one or more entities, like a thermostat controller (in HA called a climate device) that have a current temperature, a target temperature, maybe humidity also and maybe more.
One of those entities are set as the primary for the device and that is the one you control when you select Device.

In general it is not advised to use devices, because they set you up for trouble later if the device dies and needs to be replaced.
So in the case of you family room light you should use the switch entity instead of the device.

Now when it comes to YAML then it is just a text representation of your selections in the GUI.
It is easier to post on the forum and easier to get the overview of the settings.
In many places in HA where you can change settings there will be a text to switch to YAML and back. Sometimes it is in the 3 dots menu.
When it comes to automations there is a 3 dot menu to switch to YAML for the section of the automation, but there is also a 3 dot menu in the upper right corner for the entire setup to be switched to YAML.
Try to play a little with settings and switch back and forth between GUI and YAML and you will get the idea fast.

Not everything is possible to configure in the GUI, so something can only be done in YAML, but that is the next step when you have understood the relation between the GUI and the YAML.

1 Like

I honestly don’t know why you’re saying it works, because what you posted is not what you set out to do:

What you have is:
“When my family room light turns on, check if Aqara FP2 is occupied” (or something similar, since you didn’t post your automation)

You actually need:
“When Aqara FP2 is occupied
And if (condition) Time is after 5pm
Then turn on family room light”

Even that’s half an automation, since it doesn’t handle switching off the light. That’s why everyone here uses yaml - it’s easier to see what’s going on and what needs to be fixed in order to help someone achieve what they want.

1 Like

Thank you all for the wisdom as I embark into HA. Thx