Table of Contents
Entities
Entities are another building block of Platypush. Many integrations will store their state or connected devices in the form of entities - e.g. the sensors detected by the Z-Wave/Zigbee/Bluetooth integration, or the lights connected to a Hue bridge, or your cloud nodes, or your custom Arduino/ESP machinery, and so on.
Entities provide a consistent interface to interact with your integrations regardless of their type and the plugin that handles them. For instance, all temperature sensors will expose the same interface, regardless if they are Bluetooth or Zigbee sensors, and all the media plugins will expose the same interface, regardless if they manage Chromecasts, Kodi, Plex, Jellyfin or a local VLC player.
Once you enable the HTTP backend and a few integrations that export entities and register a user, you can query the detected entities via:
curl -XPOST -H 'Content-Type: application/json' \
-H "Authorization: Bearer $YOUR_TOKEN" \
-d '{"type":"request", "action":"entities.get"}' \
http://localhost:8008/execute
All the entities expose the same interface and can be manipulated through the
same API. Also, when an entity is updated it always emits an
EntityUpdateEvent
,
so you can easily create hooks that react to these events and act on multiple
types of entities.
If you enabled the HTTP backend, then you can also access all the entities from the home panel of the Web UI.