REST sensor: how to handle frequent 503 error messages

I try to read the state of my VZUG washing maschine into various sensors. It has a simple API that I can call from the command line:

$ curl -s\?command\=getDeviceStatus | jq
  "DeviceName": "",
  "Serial": "11021 XXXXXX",
  "Inactive": "true",
  "Program": "",
  "Status": "",
  "ProgramEnd": {
    "End": "",
    "EndType": "0"
  "deviceUuid": "0000XXXXXX"

That works very well using a regular RESTful sensor with the various JSON attributes specified:

  - platform: rest
    name: "Waschmaschine VZUG"
    unique_id: "sensor642643"
    value_template: "{{ not value_json.Inactive }}"
      - Inactive
      - Program
      - Status

The challenge is that the API regularly returns an HTTP error 503, completely disregarding the regular API syntax:

$ curl -s\?command\=getDeviceStatus | jq
  "error": {
    "code": 503.01

This results in my sensors being undefined half of the time.

I’d like to check if the API returns the status values, and only then update the sensors. Searching for solutions, I’ve found this hint, but I’m too new to grasp the overall setup of how to read the values, where to put the update logic, and how to define the sensors.

Any pointers would be highly appreciated.