Thank you – I will try this too. Wanted to share that I was in the meantime able to solve like this (below the answer that Chat GPT gave me including the code (!), which actually works:
Yes, it is possible to make your REST API service show up as an entity in Home Assistant so that it can be controlled by blueprints and automations. To achieve this, you can use the rest_command
integration and create a template switch or light that is linked to your REST API service.
Here’s an example configuration that demonstrates how to set up a template switch that controls your REST API service:
switch:
- platform: template
switches:
light23:
value_template: "{{ is_state('switch.light23', 'on') }}"
turn_on:
service: rest_command.light23on
turn_off:
service: rest_command.light23off
In this configuration, we define a template switch named “light23” that uses the is_state
function to determine its current state based on the state of the switch.light23
entity. The turn_on
and turn_off
actions are set to call your REST API service using the rest_command.light23on
and rest_command.light23off
services, respectively.
Once you have set up the template switch, it will appear as a controllable entity in Home Assistant, and you can use it in blueprints and automations like any other switch or light entity.
Remember to replace switch.light23
, rest_command.light23on
, and rest_command.light23off
with the actual names of your entities and services.