Provide access to the device to entity_id mapping (or entity_id to device) in the API

In the GUI there is clearly an ability to see the entities in a device or from an entity find its device. This should also be available in the API. First, from an architectural perspective the GUI should not in general have special secret access to the underlying state system since alternative GUIs won’t be able to provide equivalent function. Secondly, there is a practical need to know that a “device” has gone away other then by heuristically observing that a bunch of like named entities have gone unavailable. Right now the advanced user building a (e.g.) controller that uses the API must rely on naming conventions to see this relationship and naming conventions are always a bad idea for representing actual programmatic relationships.