API - Device Inventory?

Newcomer to Home Assistant here. Just came over from Domoticz and I’m liking it so far. I’ve everything mostly working as I’d like but one big missing bit is a decent mobile experience right now. When we were using Domoticz, I’d setup Imperihome to serve as our mobile front end and enjoyed it. I see that HA doesn’t provide support for this, so I figured I’d roll my own (seems relatively easy to do via Node-RED).

One thing I can’t currently figure out is how to get a list of current devices/entities along with their “type”. I can query the states through the API, but I don’t believe that gives me a device type for each item (is it a light? does it support dimming? RGB? etc). I suppose that I could probably try and infer this from some of the attributes present, but that wouldn’t work for devices that are currently off (dimmers don’t have a brightness when off).

Is there something that I’m missing that would make this possible?

check here

https://developers.home-assistant.io/docs/en/external_api_rest.html

http://localhost:8123/api/states?api_password=password

I’ve definitely looked into that endpoint previously and didn’t find exactly what I was looking for.

I do see “supported_features” under the “attributes” section, but this appears to be a bitfield value that can only be decoded by looking into the source to determine the available options. I’ll go that route, if needed, but I was hoping for a bit simpler route to find a basic device listing.

Did u try templating?

{% for device in states %}
{{ device.entity_id }} — {{ device.attributes.device_class }}
{%- endfor %}.

Maybe I’m missing something. I dropped that into the template dev tool and it spits out a list of all the entity IDs but there doesn’t appear to be anything available in the device_class attribute.

Also, I’m unclear how this would alter that is exposed through the API.

For now I’ve gone the route of hard coding the bitfield values from the source to determine available features. It’s working well, but obviously depends on those options never changing. I should have a working Imperihome setup for lights, switches and locks shortly. Sensors appear to be a bit of a different beast, so that may take some more doing.