Simple example needed of add-on that recognizes service `hassio.addon_stdin`

Do you know any VERY SIMPLE add-on that recognizes the service hassio.addon_stdin ?
Please, let me know.

I have searched for some on the internet, but they are too complex to understand where to start.
Docs isn’t very clean about everything that is needed to develop an add-on with this functionality.

Here is another source: https://www.home-assistant.io/integrations/hassio/#service-hassioaddon_stdin

What I DO know:

  • Based in the docs, it is required homeassistant_api: true in the config.yaml of the add-on.

What I DON’T know:

  1. Is it incompatible with any other configuration? Like ingress, for example.
  2. Does it need any other option enabled/configured other than homeassistant_api: true ?
  3. Does startup option matter ? I am defining services
  4. Does it work with any programming language ? I am trying to use nodejs.
  5. How to know to what service running in the container the data will be sent when calling hassio.addon_stdin ? Does it make sense ?
  6. As the service name starts with hassio, it made me think hassio_api: true is also required.

Thanks for any help in advance.

What are you trying to achieve?
hassio.addon_stdin is a specific service of the supervisor that, well, sends data to the stdin of the addon container.

See addons/run.sh at 5dc039373ac85eced80fd33282300e561e853186 · home-assistant/addons · GitHub fir how it works

Thanks @koying ! I also found this one today… rpc_shutdown

Now I have some answers to my questions…

  1. It doesn’t seem incompatible with any other configuration.
  2. It seems to require stdin: true too.
  3. startup doesn’t matter.
  4. The entrypoint is a shell script (CMD [ "./run.sh" ]). Once there, the input can be sent to any programming language I want.
  5. I used curl to send the input from the shell script to my nodejs webserver that is running as a service (/etc/services.d/...).
  6. I haven’t tested removing that option yet.

I am developing an add-on that works based on some requests.
My first attempt was to expose a webserver to work as REST API, but I read a little about ingress and didn’t understand how I could invoke my endpoints. I don’t know whether ingress is a requirement for exposing REST API.
Then I read about hassio.addon_stdin and found it quite simple on how to use it.
So, at the moment, I am using hassio.addon_stdin to request some tasks that doesn’t require any response.
I will study later how to respond to the requests properly. Currently, I am thinking on sending events ( POST /api/events/<event_type> )

Anyway, I had some advances since yesterday.