Webhook automation/cloud hook/nabu casa - how to get status?


I have nabu casa webhooks up and running to turn a simple smart plug on and off. It works great but I don’t see any API to get the status of the switch after the job has fired. The webhook always returns 200 OK even if the automation is disabled or the switch is unplugged. It would be cool if both of these conditions were detectable somehow. Is there a way to get current entity status that I’m missing/being planned?

If not, something like this would be great:

  • Webhook invocation returns ID that can be looked up to see if home assistant accepted the job
  • Status API for looking up jobs by ID to see if they were accepted/rejected/ignored and some kind of job payload from home assistant
  • Sensor API (?) for checking the live status of switches

This would let us write code like this:

response1 = request.post("http://hooks.nabu.casa/ASDF....")
if (response1.status_code == 200):
  print("hook accepted")

  # blocking API while waiting for home assistant is probably not smart so do a lookup on the job ID
  # with an OAuth-token (obtained elsewhere).
  job_id = response1.json()['job_id']
  url = "http://hooks.nabu.casa/status/geoff/" + job_id
  headers = {'Authorization': 'Bearer ' + auth_token}
  data = {}
  response2 = requests.post(url, json=data, headers=headers)
  if (response2.status_code == 200):
   print("home assistant says" + response2.json()["payload"]);

    # in the automation settings, we did something to lookup the current status of the switch
    # immediately after the automation fires and return a custom payload
    print("The light is: " + response2.json()["payload"]["light_status"]) # "off"
    entity_id = response2.json()["payload"]["light_entity_id"])

    # wait a while to see if people are fiddling (more likely a separate function)

    url = "http://hooks.nabu.casa/sensor/geoff/" + entity_id
    headers = {'Authorization': 'Bearer ' + auth_token}
    data = {}
    response3 = requests.post(url, json=data, headers=headers)
    if (response3.status_code == 200):
      print("The light is: " + response3.json()[entity_id][status]) # "on" (someone changed it..)
      print("error getting sensor value")
      print(response3.json()["reason"]) # "unreachable"  (unplugged smart switch)
    print("error getting job status")
    print(response2.json()["reason"]) # "invalid sensor id" (bad job config)
  print("error submitting hook")
  print(response1.json()["reason"]) # "job disabled"

Is this something that’s on the radar - if not, can it be?