Hi everybody,
I’m currently working on a Home Assistant integration into SEPIA Open Assistant and was wondering if I’m missing some features/endpoints of the REST API.
From other open-source smart-home HUBs like openHAB or FHEM I’m used to having a single URL for a device (entity), a device independent way to read and write the state and the option to write custom tags to store for example configuration data.
In HA the process is much more complex. For example to control a dimmable light you need to know where your state is (e.g. in “attributes.brightness”, IF the device is ON) and you have to call 3 different URLs. To read the state you call the “states” API of the entity and to write it you need to know the “services” of the platform (e.g. turn_on and turn_off for “light”) and the platform/domain specific request body. In addition I cannot find a way to reliably store custom configurations since “attributes” is not always available (e.g. for sensor entity: yes, for number entity: no :-/) AND it depends on the current state (probably because it was initially meant to be part of the state not the entity).
I’ve tried to use the “template” integration to simplify things and created something like configuration and control entities via the configuration.yaml as proxies for real entites. This opens up the possibility to write proper custom attributes and streamline certain things, but in the end it just shifts a lot of work from managing REST calls to setting up proxy entities. I’m not sure if all HA user would feel comfortable doing this.
Before I go further down this road I just wanted to ask the community again if there is maybe a better way to simplify things that I just haven’t discovered yet. Maybe some REST endpoint that works as a generalized “set state” service for entities and internally finds the correct property to write (e.g. you send “state: 50” and it writes “attributes.brightness_pct: 50” etc.)?
Any idea would be much appreciated