Read and display service call response

Is there any way of reading and displaying the response from a service call?

Like from this:

- service: vacuum.send_Command
  data:
    entity_id: vacuum.xiaomi_vacuum_cleaner
    command: miIO.info

This is what the command’s response should look like: https://github.com/marcelrv/XiaomiRobotVacuumProtocol/blob/40af48f468debf4b5df34e944e39a140c696cf2e/miIO-info.md

If it’s not possible through a service call, is it possible through a shell command (like https://www.npmjs.com/package/miio)?

Since the miio command output is json, I created a script that runs miio and redirected the output to a file in /config/www and then used a REST template to fetch the json through http://hassio:8123/local/miio.json

So, is there a way to capture the response from a service call?
If I need to do it using a script, what must be in the script, how do I call it, and how do I get hold of the resulting data?

2 Likes