What actually is a "device"?

I am using pyscript to write a monitoring script and one of my goals is to automatically gather devices in my setup, and check if they are available.

After a lot of reading, I have doubts about what a device actually is.

We have plenty of ways to retrieve states of entities. A device can have several entities and while the signification of each state of such entity is clear (documented), I am not sure whether a device can be unavailable.

Question 1: what is a device and how can I get a list of devices programmatically (even indirectly)

Question 2: is there a concept of “state” for a device? If so - where can I get it?

(for Question 1, I am curious if a device is something more than a container for entities)

A device in Home Assistant is a collection of entities and/or services.

The word is also used to to refer to a physical object.

Thank you. I was looking for that in the API documentation but should have widened my search.

Apologies, I had intended to actually write something, not just post a link - but someone came to the door, so I didn’t have time to do more than post a link. Hope it helped.

Yes, thank you. It is good that you posted it - when I am interrupted I usually find my post in the draft two weeks after…

The general answer I ended up is that it is not easy to use devices (no API endpoint for instance), and in my case of monitoring it does not make much sense because a device has no state.

1 Like

That makes sense. Plus if a device is offline, all of the entities will also be unavailable.